//adding a Controller's path with method in laravel route.
//say Controller is 'PagesController'
//create controller: in terminal: php artisan make:controller PagesController
// -> app/Http/Controller/PagesController.php
//use ....
//use ,..
class PagesController{
public function index(){
$data = [
'title' => 'Home'
];
//for home.blade.php
return('home', compact('data'));
}
}
//create home.blade.php file in routes/
//->routes/home.blade.php
echo $data['title'];
//->routes/web.php
Route::('/', 'AppHttpControllerPagesController@index'); //using index() method