Hi Developers,
Lets learn How to Create Controller in Laravel using Artisan Command. By default laravel application provides the artisan command to create a controller file. We can also create the file without using any artisan command just like creating any document files, as we developers should follow the professionalism we should create any controller file using the artisan command, So lets see How to Create Controller in Laravel using Artisan Command
Learn to build Laravel controllers effortlessly with Artisan commands. Streamline your development process for efficient and organized code.
In Laravel the controller file can be created by using the following artisan command,
php artisan make:controller FirstController
after executing the above command the Controller file will be created in the below path,
app/Http/Controllers/FirstController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FirstController extends Controller
{
}
To create the Controller under any folder we should also mention the folder following by '/' symbol and then the controller name.Lets create the controller under Admin folder by using the following command,
php artisan make:controller Admin/FirstController
the above command will create the controller file in the path below,
app/Http/Controllers/Admin/FirstController.php
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
class FirstController extends Controller
{
}
We hope it helps everyone. Thanks for supporting ITSolutionsGuides and keep supporting us also follow us in social media platforms.
Be the first to know about releases and tutorial news and solutions.
We care about your data in our privacy policy.
ITSolutionsGuides was started mainly to provide good and quality web solutions for all the developers. We provide tutorials to support all the developers and also we try to provide solutions to the errors we face while coding.
Copyright © 2023 - 2024 All rights reserved | ITSolutionsGuides