app/Http/Controllers/APICatalogController.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) {
        $m1 = new Movie;
            $m1->title = $request->input('title');
            $m1->year = $request->input('year');
            $m1->director = $request->input('director');
            $m1->poster = $request->input('poster');               
            $m1->synopsis = $request->input('synopsis');  
            $m1->rented = $request->input('rented', false);
            $m1->save();
            return response()->json(['error'=>false, 'msg'=>'La película se ha creado correctamente']);
    }
public function store ( Request $ request ) { $ m1 = new Movie ; $ m1 -> title = $ request -> input ( 'title' ) ; $ m1 -> year = $ request -> input ( 'year' ) ; $ m1 -> director = $ request -> input ( 'director' ) ; $ m1 -> poster = $ request -> input ( 'poster' ) ; $ m1 -> synopsis = $ request -> input ( 'synopsis' ) ; $ m1 -> rented = $ request -> input ( 'rented' , false ) ; $ m1 -> save ( ) ; return response ( ) -> json ( [ 'error' => false , 'msg' => 'La película se ha creado correctamente'] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .