In Laravel i auf eine bestimmte Seite zu verlinken, ich versuche aber es istNotFoundHttpException in RouteCollection.php Linie 161: Laravel 5.3
NotFoundHttpException in RouteCollection.php Linie 161 zeigt:
Hier mein Code helfen Sie mir bitte den Fehler
meiner Meinung nach ausrechnen:
{{ link_to_route('deleteFile', 'Delete', [$file->resid]) }}
in Routen:
Route::get('/deleteFile/{$id}',
['as'=>'deleteFile','uses'=>'[email protected]']);
und in der Steuerung:
class FilesController extends Controller{
public function deleteFile($id)
{
$file = Resource::find($id);
Storage::delete(config('app.fileDestinationPath').'/'.$file->filename);
$file->delete();
return redirect()->to('/upload');
}}
und das ist mein Modellcode:
namespace App;
use Illuminate\Database\Eloquent\Model;
class Resource extends Model
{
protected $table='resource';
public $fillable=['resname'];
}
Auf der Fehlerseite, Was ist die URL? – Albert
URL auf Fehler Seite: http: // localhost: 8000/deleteFile/2 –