mardi 1 novembre 2016

MethodNotAllowedHttpException Laravel 5.3

I couldn't update or delete, especially when i add Route::resource(....) in route file

web.php (route file)

Route::resource('home/activity','ActivityController');

edit.blade.php

{!!Form::model($activity,['action' => ['ActivityController@update',$activity->id]])!!}

<div class="form-group">
  {!! Form::label('Type :') !!} {!! Form::text('type',null,['class'=>'form-control']) !!}
</div>

<button class="btn btn-primary">Editer</button>

{!!Form::close()!!}

<br>
{!!Form::open(['Methode'=>'Delete','action' => ['ActivityController@destroy',$activity->id]])!!}

  {!! Form::submit('Delete',['class'=> 'btn btn-danger']) !!} 

{!! Form::close() !!}

model

  protected $table ='activities';
 protected $fillable =['type']

ActivityController

    public function update($id,Request $request){
        $activity = activity::findOrFail($id);
        $activity->update($request->all());
        return redirect('/home/activity');
    }

    public function destroy($id){
       Activity::destroy($id);
       return redirect('/home/activity');
    }

**Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire