app/Http/Controllers/Api/AlunosController.php
/**
   * Update the specified resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  \App\Aluno  $aluno
   * @return \Illuminate\Http\Response
   */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Aluno $aluno)
  {
    $this->validator($request);
    $aluno->name = $request->name;
    $aluno->email = $request->email;
    $aluno->curso_id = $request->curso_id;
    $aluno->data_nascimento = $request->data_nascimento;
    $aluno->save();
    $aluno = $aluno->where('id', $aluno->id)->with('Curso')->first();
    return response()->json(['aluno' => $aluno]);
  }
public function update ( Request $ request , Aluno $ aluno ) { $ this -> validator ( $ request ) ; $ aluno -> name = $ request -> name ; $ aluno -> email = $ request -> email ; $ aluno -> curso_id = $ request -> curso_id ; $ aluno -> data_nascimento = $ request -> data_nascimento ; $ aluno -> save ( ) ; $ aluno = $ aluno -> where ( 'id' , $ aluno -> id ) -> with ( 'Curso' ) -> first ( ) ; return response ( ) -> json ( [ 'aluno' => $ aluno ] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .