CRUD Laravel 5 how to link to destroy of Resource Controller?
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Understanding Resource Controller & Linking Destroy Method in Laravel 5
CRUD stands for Create-Read-Update-Delete, which are the four fundamental operations that most applications need to perform on data. In Laravel, these operations are typically handled through resource controllers that automatically generate corresponding methods based on their name. For instance, if you have a `UserController` that extends the `ResourceController`, Laravel will create the necessary actions for each of those CRUD operations. However, sometimes you might want to link directly to the destroy action without routing through any other method. This section will explain how to do so effectively.
Let's first discuss resource controllers and routing in Laravel. A resource controller is a special type of controller which automatically generates routes for its actions based on the name of the controller class, with a prefix '/' added by default. It saves a lot of time since it handles all four CRUD operations (Create, Read, Update, and Delete) out-of-the-box.
To create a resource controller, you can use the `resource` method in your routes file:
```php
Route::resource('/user', 'BackEnd\UsersController');
```
The above code creates default routes based on your UserController class, named BackEnd\UsersController, and allows access to all standard CRUD operations. However, if you want to link directly to the destroy action, you need to create a custom route for that specific method using a different name. Let's modify the previous example:
```php
Route::post('/user/destroy/{id}', 'BackEnd\UsersController@destroy');
```
This creates a new route named `/user/destroy/{id}` and maps it to the `destroy` action in our UserController class. Now, if you want to link to this custom destroy route from your view template, you can do that easily:
```html
```
In this code snippet, we have used the `URL::route()` helper to generate a URL that corresponds to our custom route. Remember to use the correct name for your route ('user_destroy' in this case). You can also change the anchor text and class as needed to suit your style.
It is essential to note that even though you have created a custom destroy route, Laravel will still try to handle other requests through its default routes, as defined by the resource controller. This means that if the user tries to access an existing record using `/user/{id}`, it will still be handled correctly.
In conclusion, creating a custom route and linking it directly to a destroy action is possible in Laravel 5 by utilizing the `URL::route()` helper function to generate the appropriate URL for your application. This approach ensures that you can perform specific actions while maintaining the benefits of using resource controllers for automatic CRUD operations. Remember to handle all necessary security measures, such as authentication and authorization, to prevent unauthorized access to sensitive data.