Course Content
Laravel Introduction
Laravel is a PHP framework that uses the MVC architecture. Laravel is a robust framework that provides easy development of PHP web applications with features like a modular packaging system with a dedicated dependency manager, access to relational databases, and other utilities for application deployment and maintenance.
0/4
Laravel Routing
Routing is one of the essential concepts in Laravel. Routing in Laravel allows you to route all your application requests to its appropriate controller. The main functionality of the routes is to route all your application requests to the appropriate controller.
0/3
Laravel Controllers
Laravel controllers are an essential feature in a Laravel framework.
0/1
Private: Laravel
    About Lesson

    In the MVC framework, the letter ‘C’ stands for Controller. It acts as directing traffic between Views and Models. Controllers are used to handle the request logic within a single class, and the controllers are defined in the “app/http/Controllers” directory.

    Creating a Controller

    Open the command prompt or terminal based on the operating system you are using and type the following command to create a controller using the Artisan CLI (Command Line Interface).

    php artisan make:controller <controller-name>

    Replace the <controller-name> with the name of your controller. The created controller can be called from app/routes/web.php by the following syntax.

    Route::get('base URI','controller@method');

    Step 1 − Execute the following command to create UserController.

    php artisan make:controller UserController

    Step 2 − After successful execution, you will receive the following output.

    laravel controller

    Step 3 − You can see the created controller at app/Http/Controller/UserController.php with some basic coding already written for you and you can add your coding based on your need.

    <?php
    
    namespace App∖Http∖Controllers;
    
    use Illuminate∖Http∖Request;
    
    class UserController extends Controller
    {
        //
    }