1 year ago

laravel is trying to update _method field

Posted 1 year ago by nnnayeem

Hello everyone,

One my project I am trying to update some data but getting this error

    SQLSTATE[42S22]: Column not found: 1054 Unknown column '_method' in 'field list' (SQL: update `vendors` set `_method` = PATCH, `_token` = LTWtWQjXpMd5Pi6xQdn2oS6PuaPovsKLP6Sz7M00, `name` = a, `phone` = 2323, `fatherName` = a, `motherName` = a, `gender` = male, `birthDate` = 2018-10-31, `permanentAdd` = a, `altPhone` = 121212, `nomineeName` = a, `nomineePhone` = 121212, `nomineeRelation` = Sister, `updated_at` = 2018-10-19 06:13:35 where `vendors`.`user_id` = 103 and `vendors`.`user_id` is not null)

My route:

Route::patch('profile/{id}/update','[email protected]');

My Controller:

        public function UpdateProfile(Request $request,$id){
    if(Auth::user()->id == $id){
        $data = $request->all();
        $rules = [
        $message = [
            'name.required'=>'name re',
        $user = User::findOrFail($id);
        return redirect('/vendor-profile');


I have searched solution for this problem onine. The are all telling to except the _method and _token method. Some saying to use $fillable property.

But I have already used $fillable property and also updated model in the above mentioned way. I just cant figure out what the problem is?

Please sign in or create an account to participate in this conversation.