vendredi 1 décembre 2017

how to send taskId to the table in Laravel 5.2

I have file attachment form and in this form I need send $task->id to the file table.

this is file form action,

action=" route('projects.files', 'taskId'=>$task->id)">

and this is FileController methods,

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 routes is this,

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

but when I submit data to the table task_id row data values is like this,

route('projects.files', 'tasks'=>$task->id)

how can I send project id instead above values?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire