I
I
igordata12020-09-02 20:45:25
Laravel
igordata1, 2020-09-02 20:45:25

How to make a correct redirect now 404?

public function destroy(Image $image, Product $id)
    {
        $product =  Product::find($id);

        Storage::disk('public')->delete('uploads/product_images/'.$image->id);

        $image->delete();

        return redirect('edit');
    }

Route::group(['middleware'  =>  'admin' ], function(){
    Route::get('/admin', '[email protected]');
    Route::get('/category/create ', '[email protected]');
    Route::post("/categories/category/store", "[email protected]");
    Route::get("/categories", "[email protected]");
    Route::get('/products', '[email protected]');
    Route::get('/product/create ', '[email protected]');
    Route::post("/products/product/store", "[email protected]");
    Route::get("/product/edit/{product}", "[email protected]")->name('edit');
    Route::post("/products/product/edit_store/{id}", "[email protected]_store");

    Route::get("/products/product/delete/{id}", "[email protected]");
    Route::get('images/{image}/destroy', '[email protected]')->name('images.destroy');
            <a href="/images/{{$image->id}}/destroy" class="card-link">удалить</a>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question