Ad

Laravel - Status Code: 500 Internal Server Error

- 1 answer

hello i want to update my data in DB using V-form but 500 internal server error show: this is my function in controller:

   public function update(Request $request, $id)
{   $data =$request->all();

    //
    $client = Client::where('id', $data['client_id'])->first();

    DB::table('projets')->where('id',$id)->update(['name'=>$data['name'],'durre'=>$data['durre'],'description'=>$data['description'],'owner'=>$client->name,'budget'=>$data['budget']]);


}

and this is my route:

Route::apiResource('projet' ,'API\ProjetController');

and this is the vue code:

  modifier(){

           this.form.put('api/projet/'+ this.form.id).then(function(){

         $('#AjouterProjet').modal('hide')

                seww.fire(
                'Modifier!',
                'Your User has been Updated.',
                'success'
                )
                fire.$emit('ajoutprojet');

         }).catch(function(){

         })
        },
Ad

Answer

When you get 500 error, Check the last file on storage/logs directory and try to find the last error on this file, errors are in this format:

[date_time] [error_message] [stacktrace]
Ad
source: stackoverflow.com
Ad