Laravel Quickies

Laravel Quickies is a quick tutorial I developed to help you remember how to do the major coding steps for the Laravel MVC PHP framework. If you don’t have an idea of how to do the things in this tutorial yet, you should probably read the more detailed tutorials I’ve written on each of the subjects below. This is meant just as a quick reference guide for those that already know the basics but need a quick refresher course in the high level steps to do things such as create a route, model, view or migration for example.

Laravel Quick Start Examples

Routes:

Enter the following code into routes.php to create a simple route:

Route::get(‘test’, function(){

return(‘<h1>Laravel Route Example</h1>Ian L. of Jafty.com created this simple Laravel route test.’);

});

visit the full Laravel routes tutorial here: http://jafty.com/blog/laravel-routes/

Controllers:

Add the following in a new file within the app/controllers directory to create a new controller:

class yourClass extends BaseController {

public function yourFunction() {

return “<h1>This is what gets output to the web page when the test route is visited by a user in this basic Controller Example</>”;

}

The above controller would need the following route set up in routes.php to make it work:

Route::get(‘test’, ‘yourClass@yourFunction’);

Finally, after you create a new controller, you always need to flush the autoload contents before the new controller will work, so do so by opening your command prompt that you use composer from and type:

composer dump-autoload

More Laravel quickies coming soon! For now, you can view all of my Laravel tutorials and posts by visiting the Laravel Category of my blog HERE!

3 Replies to “Laravel Quickies”

  1. Oops, just noticed your question was about Laravel and not WordPress,. Sorry about that. For Laravel, I would first make sure you took all the standard security precautions listed at:
    http://laravel.com/docs/security
    Then in regards to plugins, Laravel uses Packages. One good place to search for Laravel packages is on GitHub. Here is one example of a search I did on GitHub for Laravel Security that returned several packages related to Laravel security:
    https://github.com/search?q=laravel+security&type=Repositories&ref=searchresults

Leave a Reply

Your email address will not be published. Required fields are marked *