Laravel is incredible for beginners, yet I find that a ton of developers posting comments on how "Laravel doesn't do XXX by default" so it can't be done and there is a bug.
I am not trying to say that Laravel is entirely without bugs (or things that I believe should work a bit differently), but look around at what you can do before calling a convention a bug.
I am especially irked by those that don't look at the configuration and see what can be changed under the hood with little to no work.
Apparently everyone knows to change database configuration, but magically ignore the 10 other files in the app/config
folder.
So, here are a few things you might like to change from the defaults:
1. Timezone (config/app
)
If you want Carbon (the datetime package used by Laravel) to show better dates, you should probably realize that Laravel overrides your system PHP default.
2. Authentication Model (config/auth
)
If you are developing modularly (and you really should be), you will have your eloquent model stuffed in a namespace. Good for you! But now the Auth package is messed up…
Before you go run to install Sentry before you need it, change the Model property in the Auth config.
3. Auth Reminder Email (config/auth
)
The default email reminder isn't anything to write home about.
Chances are that you want to use a namespaced nice little email of your own.
Well, turns out there's a config for that!
So template to your Blade content naming it whatever you want in the reminder['email']
config.
4. Email From (config/mail
)
Chances are that you don't want to run around telling all of your application emails who they are from.
This one is pretty simple, just drop the address
and name
you want it to be from and delete the boilerplate from your mailers.
5.1. View Storage Path (config/view
)
You can dictate one or more locations where your views can be stored.
So, if you aren't too fond of your views in app/views
you could place them anywhere you want and include it in the paths
array.
5.2. View Storage Path (anywhere)
The view storage path can also be modified on the fly.
Just use View::addLocation('path/to/your/views')
before calling View::make
.
This is helpful in modular application building where you could litterally have everything for a single functionality in a dedicated namespace and folder.
6 Pagination Template (config/view
)
There are a ton of different CSS libraries out there.
And while Twitter Bootstrap 2.X is the most popular of the bunch, you may want to modify your pagination to work with something else.
Create a view anywhere you want and use the syntax found in the example pagination template (found in vendor/laravel/framework/src/Illuminate/Pagination/views/slider.php
.
I may end up doing a post on using later.
7 Workbench Credentials (config/workbench
)
While some of you may not be planning on writing a package within your Laravel apps, I suggest filling out the information in the config/workbench
file just in case you decide to later.
This will save you headaches when you run php artisan workbench
later in life.
Just remember, before you go complaining about a core convention, look in the config file. There is probably a config for that!!!