app/Http/Controllers/APICatalogController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id) {
        $m2 = Movie::findOrFail($id);
            $m2->title = $request->input('title');
            $m2->year = $request->input('year');
            $m2->director = $request->input('director');
            $m2->poster = $request->input('poster');               
            $m2->synopsis = $request->input('synopsis');  
            $m2->rented = $request->input('rented', false);
            $m2->save();
            return response()->json(['error'=>false, 'msg'=>'La película se ha modificado correctamente']);
    }
public function update ( Request $ request , $ id ) { $ m2 = Movie :: findOrFail ( $ id ) ; $ m2 -> title = $ request -> input ( 'title' ) ; $ m2 -> year = $ request -> input ( 'year' ) ; $ m2 -> director = $ request -> input ( 'director' ) ; $ m2 -> poster = $ request -> input ( 'poster' ) ; $ m2 -> synopsis = $ request -> input ( 'synopsis' ) ; $ m2 -> rented = $ request -> input ( 'rented' , false ) ; $ m2 -> save ( ) ; return response ( ) -> json ( [ 'error' => false , 'msg' => 'La película se ha modificado correctamente'] ) ; }
Update the specified resource in storage.
Update the specified resource in storage .