Implement Controller in Laravel

Before creating a controller, you need to know the role of the controller. Through the controller in the laravel framework we are related to the database and our condition which we want to put and which page to ridirection is done by the controller. For example, we know that if we have to create a query of query or update and delete, then we can create this query in the controller.

Create Controller Laravel 6.0, Create Controller Laravel 5.8, Create Controller Laravel 5.7, Create Controller Laravel 5.6, Create Controller Laravel 5.5, Create Controller Laravel 5.4, Create Controller Laravel 5.3

How to create a controller in aravel. For this we run the command at cmd

php artisan make:controller UserController --resource

When you run this command on cmd, you will find a file named UserController in this directry of your controller’s file app/Http/Controllers.

The controller file is managed from the route file in this way.


Route::get('/','[email protected]');


namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class UserController extends Controller {
public function index(){