- AI-Powered Cyberattacks in 2026: How Hackers Use AI Agents
- US Outages Explained: What Happened to Microsoft, FAA and Banks
- Microsoft 365 Outage: Outlook, Teams and Copilot Down. What We Know
- Diwali Online Shopping Scams 2026: 10 Ways to Stay Safe
- 10 Best DDoS Protection Services for 2027
- 12 Best Web Application Firewalls (WAF) for 2027
- Best Ethical Hacking Tools in 2027: Free & Paid Picks
- Software supply chain attacks 2026: Timeline and developer checklist
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.

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
{
//
}



