dimanche 26 novembre 2017

Undefined variable: task (View: C:\Users\jone\Desktop\ddd\resources\views\files\form.blade.php) in Laravel

I am going to submit file in My Laravel application. this is My fileController

private function saveUploads(Request $request, $fileUrl, $id)
    {

         //dd($request->only('task'));
        $file = new File;
        $file->file_name  = $request->file('file_name')->getClientOriginalName();
        $file->file_url   = $fileUrl;
        $file->project_id = $id;
        $file->task_id = $request->only('task')['task'];
        $file->save();
    }

and this is form.blade.php form acctions

action="">
            <div class="form-group">  //this is line line 39

and route

Route::post('projects/{projects}/files', [
     'uses' => 'FilesController@uploadAttachments',
     'as'   => 'projects.files',
     'middleware' => ['auth']
]);

but got following error

ErrorException in 88ff5154a46f749c29024e0c9f84c577f7c5025e.php line 39: Undefined variable: task (View: C:\Users\john\Desktop\ddd\resources\views\files\form.blade.php)

how can I fix this problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zEUYUa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire