Laravel Community Tools by Tighten

Popular tricks

458 tricks
Auth::attempt($auth) giving problem. ErrorException in ClassLoader.php line 317: Uninitialized string offset: 0
Sanjar7 11 years ago 9988
5.0
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 9962
search query from scope in laravel model
sanjok1988 5 years ago 9912
Pagination with dots in laravel
wallacemax... 10 years ago 9907
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 9890
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 9860
Will validate a route pattern against the current route.
eugene_san... 12 years ago 9811
Check if string is in any url segment or at the one specified.
pabloleone 8 years ago 9781
Sometimes you may wish to eager load a relationship, but also specify additional query constraints for the eager loading query. Here's an example:
BenaliDjam... 6 years ago 9754