app/Http/Controllers/Api/CursosController.php
/**
   * Store a newly created resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
  {
    $this->validator($request);
    $novoCurso = new Curso();
    $novoCurso->name = $request->name;
    $novoCurso->descricao = $request->descricao;
    $novoCurso->save();
    return response()->json(['curso' => $novoCurso]);
  }
public function store ( Request $ request ) { $ this -> validator ( $ request ) ; $ novoCurso = new Curso ( ) ; $ novoCurso -> name = $ request -> name ; $ novoCurso -> descricao = $ request -> descricao ; $ novoCurso -> save ( ) ; return response ( ) -> json ( [ 'curso' => $ novoCurso ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .