sajad torkamani

Generate:

php artisan make:controller ProvisionServer --invokable

Edit as needed:

<?php
 
namespace App\Http\Controllers;
 
class ProvisionServer extends Controller
{
    /**
     * Provision a new web server.
     */
    public function __invoke()
    {
        // ...
    }
}

Add route:

use App\Http\Controllers\ProvisionServer;
 
Route::post('/server', ProvisionServer::class);
Tagged: Laravel