Welcome to laravelsnippets.com

A repository of useful code snippets for Laravel PHP framework. Submit, grab and share!

Source code of the site - Github link . We accept pull requests! =)


Most Recent Snippets

Snippet Posted
get a random record from a table 1 month ago 715 1 1
Camel case attributes 1 month ago 317 0 0
Laravel 5 custom pagination view 3 months ago 575 0 1
Get column names as array from Eloquent model 3 months ago 249 0 0
Validator for alphabetic chracters, dash, spaces and numbers. 3 months ago 158 0 0
Form with Files 4 months ago 312 1 0
Help identify table columns that are no longer used 4 months ago 141 0 0
Generate unique slugs 5 months ago 3439 4 4
Very Simple Menu Active for unlimited routes 5 months ago 2246 2 2
Echo sth. on variable fullfilling condition 5 months ago 95 0 0
Artisan Entity Generator 5 months ago 1567 0 0
PATH CLASS IN PHP 5 months ago 1315 0 1
Drop all tables with php artisan 5 months ago 2187 1 3
Menu Active with parameters and attributes supported! 6 months ago 1369 1 7
ApiController for sharing the same functionality 7 months ago 1668 0 1
Menu activated 7 months ago 2295 3 0
Get Supported Locales 7 months ago 1109 0 1
Import a mysql dump file with artisan command 8 months ago 2134 1 4
Generate a database dump file with using Artisan command 8 months ago 1392 2 3
Move domain permanetly(301) or temporarily (302) 8 months ago 1114 0 0
Fetch latest posts for each category 8 months ago 1640 2 0
PHPStorm Custom Live Templates and Theme, mostly Laravel related - v2 9 months ago 2988 4 0
Google Suggest Scraper 9 months ago 3348 2 3
Enable Routing on Unit Tests 9 months ago 983 0 0
Add Empty option to Form::select dropdowns 9 months ago 2484 0 1
App initialization 9 months ago 2106 1 4
Form HTML Error Macro 10 months ago 2135 2 5
Validator, Validation rule Or 10 months ago 1349 0 0
Mulltiple Nested views w/o Blade Template 10 months ago 1332 2 0
Get model columns 10 months ago 1305 0 0

Most Popular Snippets

Snippet Posted
Multilingual i18n routes. 1 year ago 434067 1 9
AngularJS with Laravel 1 year ago 25338 6 7
Custom Config Files & Values 1 year ago 17247 9 9
Custom Pagination Blade Template 1 year ago 14644 6 2
Flexible master layout 1 year ago 13990 8 24
Sentry Route Filters 1 year ago 13374 6 11
Managing Timestamps 1 year ago 13265 14 0
Using Namespace in Route Group 1 year ago 9481 4 2
Get all columns names from a Eloquent Model 1 year ago 9446 7 3
Using Laravel Blade with AngularJS Templates -- Redux (Alternate Method) 1 year ago 8930 4 2

Want to help with the site? We accept pull requests! Find us on Github