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 week ago 215 1 1
Camel case attributes 3 weeks ago 108 0 0
Laravel 5 custom pagination view 2 months ago 151 0 0
Get column names as array from Eloquent model 2 months ago 84 0 0
Validator for alphabetic chracters, dash, spaces and numbers. 3 months ago 57 0 0
Form with Files 3 months ago 103 0 0
Help identify table columns that are no longer used 3 months ago 52 0 0
Generate unique slugs 4 months ago 3142 4 4
Very Simple Menu Active for unlimited routes 4 months ago 2059 2 2
Echo sth. on variable fullfilling condition 4 months ago 39 0 0
Artisan Entity Generator 4 months ago 1452 0 0
PATH CLASS IN PHP 4 months ago 1211 0 1
Drop all tables with php artisan 5 months ago 1922 1 3
Menu Active with parameters and attributes supported! 5 months ago 1245 1 7
ApiController for sharing the same functionality 6 months ago 1546 0 1
Menu activated 6 months ago 2157 3 0
Get Supported Locales 7 months ago 1014 0 1
Import a mysql dump file with artisan command 7 months ago 2021 1 4
Generate a database dump file with using Artisan command 7 months ago 1286 2 3
Move domain permanetly(301) or temporarily (302) 7 months ago 1041 0 0
Fetch latest posts for each category 7 months ago 1530 2 0
PHPStorm Custom Live Templates and Theme, mostly Laravel related - v2 8 months ago 2786 3 0
Google Suggest Scraper 8 months ago 3225 2 3
Enable Routing on Unit Tests 8 months ago 909 0 0
Add Empty option to Form::select dropdowns 8 months ago 2239 0 1
App initialization 8 months ago 1974 1 4
Form HTML Error Macro 9 months ago 1980 2 5
Validator, Validation rule Or 9 months ago 1241 0 0
Mulltiple Nested views w/o Blade Template 9 months ago 1208 2 0
Get model columns 9 months ago 1203 0 0

Most Popular Snippets

Snippet Posted
Multilingual i18n routes. 1 year ago 433758 1 9
AngularJS with Laravel 1 year ago 24469 6 7
Custom Config Files & Values 1 year ago 16200 9 9
Custom Pagination Blade Template 1 year ago 13809 6 2
Flexible master layout 1 year ago 13740 8 24
Sentry Route Filters 1 year ago 13038 4 11
Managing Timestamps 1 year ago 12601 14 0
Using Namespace in Route Group 1 year ago 9245 4 2
Get all columns names from a Eloquent Model 1 year ago 8973 7 3
Using Laravel Blade with AngularJS Templates -- Redux (Alternate Method) 1 year ago 8489 4 2

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