jeudi 1 décembre 2016

Laravel deleting a file NotFoundHttpException

this is my form in my view

         {!! Form::open(['url' => ['documents/{file}/{id}', $file->name, $file->id],'method' => 'delete']) !!}
         {!! Form::token() !!}
         {!! Form::submit('Delete') !!}
         {!! Form::close() !!}

controller in which i delete file from database and the original file

public function destroyFile($file_name, $id)
{
    File::findOrFail($id)->delete();
    $file_path = storage_path('documents').'/'.$file_name;
    $destinationPath = $file_path; File::delete($file_path);
    return redirect('/documents');
}

This is the route

Route::delete('documents/{file}/{id}','FilesController@destroyFile');

And when i press submit button I get NotFoundHttpException



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

Aucun commentaire:

Enregistrer un commentaire