Laravel Community Tools by Tighten

Recent tricks

458 tricks
First you create a file called Cors.php in app/Http/Middleware, then you register the middleware in the app/Http/Kernel.php file. If you want, you can change the default values adding the keys CORS_ALLOW_METHODS, CORS_ALLOW_ORIGINS, CORS_ALLOW_HEADERS and CORS_MAX_AGE to your .env file. Simple as that! This class is based on spatie/laravel-cors package.
lcdss 8 years ago 5287
If you have a @yield directive, you know that you can pass a default content in the 2nd argument. What if you want to pass the content of a view?
laraning 8 years ago 3954
Hello there! How to do Excel file validation in laravel? In Laravel you can use validate the file upload with extension using After Hooks. Read more from https://laravel.com/docs/5.5/validation#after-validation-hook
decipher 8 years ago 13265
I've developed a new package for translation handling. It works with Larvels default translation loader. You can export your translation files via artisan command to database. After translating all files you can simply reimport them from the database. The reimport creates all needed language folders and translation files for you. All you have to do is set the parameter "available_locales" in your config/app.php file. This way you can focus on one language in your dev environment. In production you export your default language, translate it and reimport it. All done with two artisan commands. See more under https://github.com/Brotzka/Laravel-Translation-Manager
Brotzka 8 years ago 6291
Sometimes you want to perform a chunk of code dependent on the environment. This trick makes it easy to check against multiple environments and returns a boolean.
mattstauff... 8 years ago 3540
If you ever wanted to see the SQL query that is being generated when using the Eloquent or the Query Buider, you can simply use to `toSql` method.
wilburpowe... 8 years ago 3645
If you have a dynamically generated list from DB, like [1 => 'First option', 2 => 'Second option', ...] use the following Collection magic to build a full select list with 'Please choose..' option at the beginning and 'Other..' option at the end.
subdesign 8 years ago 4516
This helper will helps you to serve the assets which is last updated by the server. The Main aim of this helper to eliminate the cache of the assets we updated in server.
decipher 8 years ago 5253
How to disable any ip from accessing your laravel app? Here is the solution. 1) Create Middleware "IPRestrictMiddleware". 2) Paste the code inside handle function. 3) Register the middleware in kernel function. 4) add the registered middleware in routes in order to restrict the access.
decipher 8 years ago 5352