Category Archives: PHP
Laravel Load Custom Error Views
This piece of code shows how to load different error views for each exceptions occurred, The display can be controlled depending on the context.
public function render($request, Exception $e) { if ($e instanceof HttpException) { $statusCode = $e->getStatusCode(); if (view()->exists('errors.'.$statusCode)) { return response(view('errors.'.$statusCode, [ 'msg' => $e->getMessage(), 'code' => $statusCode ]), $statusCode); } } return parent::render($request, $e); }
Laravel 5.1 Useful Resources
- Update account password – http://teamnik.org/how-to-update-user-password-in-laravel5/
- User ACL with Entrust – http://itsolutionstuff.com/post/laravel-52-user-acl-roles-and-permissions-with-middleware-using-entrust-from-scratch-tutorialexample.html
- Track user last login time – http://coffeecupweb.com/capture-last-login-time-in-laravel-5/
- Retain old input & object state with create edit form – https://laracasts.com/discuss/channels/code-review/clean-way-to-inject-old-input
- Load settings from database –
http://stackoverflow.com/questions/32824781/laravel-load-settings-from-database
https://laracasts.com/discuss/channels/general-discussion/l5-best-way-to-load-settings-from-database
- Custom Helper –
http://laravel-recipes.com/recipes/50/creating-a-helpers-file
http://stackoverflow.com/questions/28290332/best-practices-for-custom-helpers-on-laravel-5
- Cron Jobs
https://www.sitepoint.com/managing-cronjobs-with-laravel/
http://www.easylaravelbook.com/blog/2015/01/27/introducing-the-laravel-5-command-scheduler/
http://blog.mauriziobonani.com/laravel-cron-jobs-on-shared-hosting/
Hosting
- Host in a shared server – http://laraveldaily.com/laravel-and-shared-hosting-working-with-ftp-and-phpmyadmin/
Lumen
https://github.com/lucadegasperi/oauth2-server-laravel
http://esbenp.github.io/2015/05/26/lumen-web-api-oauth-2-authentication/
http://loige.co/developing-a-web-application-with-lumen-and-mysql/