Friday, 1 February 2019

Laravel controller
You may generate an invokable controller by using the --invokable option of the make:controller Artisan command:
php artisan make:controller ShowProfile


namespace App\Http\Controllers;

use App\User;
use App\Http\Controllers\Controller;

class ShowProfile extends Controller
     * Show the profile for the given user.
     * @param  int  $id
     * @return View
    public function __invoke($id)
        return view('user.profile', ['user' => User::findOrFail($id)]);

No comments:

Post a comment