Laravel Community Tools by Tighten

Popular tricks

458 tricks
Response::xml macro
localdisk 12 years ago 32557
Get the base URL of your Laravel 5 app page available anywhere in your JavaScript for jQuery to use. To do this you could have the following code in your template.blade.php file...
cpaddison 10 years ago 32324
5.0
I was looking for a way to change the .env-values within a controller or from something else. I found nothing, so I created my own little method. It takes an array of new values. The array key must be the key from the .env. The script overwrites the old .env. Yet not perfect, but works for now. UPDATE: I am developing a package which will provide this functionality in a better way. The package will ship with some more features. UPDATE: Here is the Link to the Package: https://github.com/Brotzka/laravel-dotenv-editor. Give it a try ;) There will be more features in a few days.
Brotzka 9 years ago 32228
5.0
I have put together a custom collection that will allow you to access a relationship on all objects in a collection. You can also run a method from an object in the collection on the entire collection such has touch or delete.
riddles888... 12 years ago 32229
4.0
Simple ACL laravel 5.2 Providers->AuthServiceProvider Register any application authentication / authorization services.
hendrilara 10 years ago 32181
Sometimes you need to add a new column to a table that already exists, for this we can use laravel migrations. In our command line we type (You can name the migration file as you want ) : php artisan migrate: make add_field_to_table. In line 14 we're adding a new field (table column) into our table. We type the field type if you don't know the field types you can find them in the documentation: http://laravel.com/docs/4.2/schema. Continuing with, we can specified if we want to add the field before or after an a column that already exists of course. In this case i'm using after but you should use whatever you need. Once we have finish, we go back to the command line we type: php artisan migrate. And that's it, we've updated our table. I guess that we can add as many fields as we need, i didn't try that but i think that it will works too. Cheers!
selenearzo... 11 years ago 31684
I've used this technique to check if I have called any `->with()` or other relations loaded on a model. I had a need for this since I have a lot of methods that require relation data in order to generate an appended property on the model. For example, if I want to pull all of the recent Posts of an Author and I want to store it on the model as `posts_this_month`, I would need to have Posts relation loaded. I want to force myself to eager load that data before I try to access it, otherwise I could run into an n+1 problem.
chadwithuh... 11 years ago 31125
Geographical Calculator was developed for laravel 5.8+ to help you to implement geographical calculation, with With several algorithms that help you deal with coordinates. See this package from here: https://github.com/karam-mustafa/laravel-geographical-calculator
karam-must... 4 years ago 31083
Automatically deleting related rows in Laravel (Eloquent ORM)
dickyeka 9 years ago 30450