Laravel Community Tools by Tighten

Popular tricks

458 tricks
Laravel's docs suggest to override the Model's getDates() methods when adding your own date fields. http://laravel.com/docs/4.2/eloquent#date-mutators To keep the default created_at, updated_at and deleted_at date fields, these must also be returned by the method, giving you at least 4 elements to the array. An easier (or at least, tidier) way is to set the protected $dates property with your own fields. These are merged with the defaults.
meigwilym 11 years ago 11517
This filter will prevent the route from having sessions enabled. Very useful for API calls and when you don't want sessions starting. Blog Post: http://dor.ky/laravel-prevent-sessions-for-routes-via-a-filter/
ssx 12 years ago 11512
Use this to generate a select box from a Eloquent Collection
xLink 12 years ago 11445
in this example there is a one to many relation. [course has many chapters]
Mahmoudz 11 years ago 11506
It's easy to notify one user by mail. But how to send a mail to all members of a Team? You can send one email to multiple recipients but it's not convenient, as it discloses recipient emails, which is not secure. Thus, you need to send bunch of personal emails on a loop. To do this create new TeamMailChannel and get MailChannel inside of it. Then iterate over users of a group and send emails. Your notification class should include TeamMailChannel inside via, however you should still use `toMail` method to prepare a message.
DavertMik 8 years ago 11507
5.6
This snippet can be used to view a linked list to all your available views, useful for reviewing different screens.
mohamed 12 years ago 11349
Hi ! Write your templates, controllers, ... without boring with translations. When you have finished to code, just execute the following command. It will generate and synchronise all needed files in your `lang/*/` directories. The package is available here : https://github.com/potsky/laravel-localization-helpers
potsky 12 years ago 11301
When saving/updating a model you might want to get a JSON response that includes some relationship data as well.
m4nuC 12 years ago 11286
Its Diffucult to convert whole object to an array . Normally we are Doing it By Iterate through foreach. By using Below Code we will reduce amount of line of code
kmlnyk 9 years ago 11286