mardi 28 novembre 2017

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

i need print task_id in file table when some user is going to attach files. this is My form.blade.php file action

files/form.blade.php

action=""> //and this is line 39

and this is FilesController

 private function saveUploads(Request $request, $fileUrl, $id,$taskId)
    {
        $file = new File;
        $file->file_name  = $request->file('file_name')->getClientOriginalName();
        $file->file_url   = $fileUrl;
        $file->project_id = $id;
        $file->task_id = $taskId;


        $file->save();
    }

and this is My file attachment routes

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

and My file/form.blade.php is include with show.blade.php file in task folder in view directory

tasks/show.blade.php


<hr>
{!!$task->body!!}
<hr>
@include('comments.form')
@include('files.form') // form.blade.php include

but unfortunately I got this following errors

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

how can fix this problem?



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

Aucun commentaire:

Enregistrer un commentaire