Creating a controller in laravel has never been easier like counting 123, all you have to do is just execute some command code.
Open your cmd and navigate to your laravel folder.
For example,
And then the command for creating controller.
Syntax:
php artisan make: controller ControllerName
Ex. php artisan make:controller LoginController
If you want to use your controller at web.php , you need to do like this.
Syntax:
Route::get('route_path'), 'ControllerName@methodName
Ex. Route::get('login/{name}', 'LoginController@register');
For you information, method is also equivalent to function.
After that you should be able to saw your controller file at app/Http/Controllers
In your controller write the method that you want.
Lastly execute the route, you should be able to get the return value of your function or any functionality that you have assign in your function.
If you are facing any problem on this, don't hesitate to message at Obstrum facebook page.
Hope this tutorial will help those in need.
If you want to get in touch with more tutorial, add me on google+ or like and follow our facebook page for more! Obstrum Facebook Page
EmoticonEmoticon