Laravel Community Tools by Tighten

Popular tricks

458 tricks
To setup configuration according to each environment you can set environmental variables. In this below example I am setting up an environmental variable "LARAVEL_ENV" with below values. staging as LARVEL_ENV staging production as LARVEL_ENV production Then in start.php under detect environment add the below code for getting the environment. You can add config files under respective folders.
ashwin-sur... 12 years ago 9909
Auth::attempt($auth) giving problem. ErrorException in ClassLoader.php line 317: Uninitialized string offset: 0
Sanjar7 11 years ago 9886
5.0
In Laravel 5, by default you have CSRF in every single POST. If you are new to Laravel and you use the usual HTML code to create inputs and forms then you will definitely encounter that error. Also, if you are coming from Laravel 4, again you might not know how to solve this error since 'Illuminate\Html\HtmlServiceProvider' is not installed by default anymore and HTML inputs and form have to be used. There are 3 solutions in order to fix it. 1) If you want to keep the usual HTML code and not use 'Illuminate\Html\HtmlServiceProvider' (since it is not installed by default in Laravel 5), then you can delete this line of code '\App\Http\Middleware\VerifyCsrfToken::class,' in app/Http/Kernel.php. However this is not a good practice. You can still do that though, in case you are building something small or an API. 2) You can install 'Illuminate\Html\HtmlServiceProvider' and do it the old good Laravel 4 way, which uses tokens by default, thus you don't have to worry about it anymore. 3) The last solution is in case you want to code the front end with the usual HTML code then you can use this line in your layout or in case you don't have a layout then in every single page. <input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" /> You can get Laravel 5 tutorials and projects for all levels (Beginners-Intermediate-Advanced) in this website www.codeexecutable.com/courses
codeexecut... 10 years ago 9829
search query from scope in laravel model
sanjok1988 5 years ago 9790
Pagination with dots in laravel
wallacemax... 10 years ago 9803
If your need usage DataTable with default configurations for many pages, do you can create your 'setter' for default table elements.
sr2ds 7 years ago 9765
Will validate a route pattern against the current route.
eugene_san... 12 years ago 9765
Hi guys , I wanna share with you this trick that you may don't know or did not used it before . what if you want to do something like this . Animals::dogs(); or Animals::cats(); how you can achieve this ... well it's simple with eloquent
anouarabds... 11 years ago 9696
When you save the password fields, it's been hashed every time. You have to put it in your User model. Thanks to Karl Merkli to add needsRehash
HakShinKen 12 years ago 9700
4.1