Laravel Community Tools by Tighten

Recent tricks

458 tricks
Reference the connection by name, the database could be named differently in another environment.\ Note: you might want to add backticks to the database name if the name uses alternative characters.
orlissenbe... 11 years ago 12512
I like to set body id/class from within the child view (for css purposes). Previously I was passing this information to the view from the controller but decided I didn't like that, so I came up with this.
jwalton512 11 years ago 10377
Sometimes, you have differences between your dev set-up and production set-up that requires you to be able to set a different value for public_path. In your bindings.php file, just add the following code and you will be good.
ve2gmr 11 years ago 10623
Often a foreign key needs to be set to NULL. On my projects I often use a drop down for this, and using an empty string as an option value does not work. I (hopefully) improved on this method[1] to set null values only on certain fields when saving a model. The original idea is from stackoverflow[2]. This method uses a BaseModel from which all models inherit. Any FK fields should be added to the model's $nullable property (an array). The work is done by the BaseModel. [1] http://laravelsnippets.com/snippets/set-fields-to-null-instead-of-empty-value-to-avoid-problems-with-nullable-foreign-keys [2] http://stackoverflow.com/questions/17452923/empty-string-instead-of-null-values-eloquent/19101473#19101473
meigwilym 11 years ago 27733
Sometimes you'll need to put custom fields in your dropdown field, like user's firstname and name. That's how you can do it.
the-juju 11 years ago 13416
Hello what if your application when it is logout then you intentionally hit the back button on your web browser, what happened? your application will be returned to the original page, which should be redirected to the login page. Here I share a simple trick, put on a filters.php
cyberid41 11 years ago 24164
//laravel 5 make migration
doguhan 11 years ago 16851
reponse:json() to remove "" from numeric values
extjac 11 years ago 9194