Laravel Tricks

Browse latest tricks and tips on Laravel.

Laravel Http to https

Redirect all Laravel routes to Https from HttpHttps help us to secure our web application and increase your increase users trust on our website. HTTPS: HyperText Transfer Protocol ...
published on : 34 minutes ago 12 Comments

How to protect your .env file from public access in Laravel?

How to secure .env file in laravelIf you are a developer and developing an app on Laravel or Symfony then you certainly are familiar with a file named as .env file which  ...
published on : 19 hours ago 12 Comments

How to run Laravel Development server?

Start Laravel development ServerIn Laravel, we can run Laravel Development server by typing php artisan serve command on terminal or command line. Make sure your in Laravel's proje ...
published on : 29 minutes ago 12 Comments

What are named routes in Laravel?

Laravel Named Routes Named routing is another amazing feature of the Laravel framework. Named routes allow referring to routes when generating redirects or Urls more comfortably. Y ...
published on : 5 hours ago 12 Comments

How to get records between two date in Laravel using eloquent

Laravel eloquent between datesWe can get records between two dates laravel 5 with using Eloquent "whereBetween" method. Here sample function to get posts between two dates from the ...
published on : 12 hours ago 12 Comments

How to enable query log in Laravel?

Enable query log LaravelUse the enableQueryLog method: Use the enableQueryLog method:DB::connection()->enableQueryLog(); You can get an array of the executed queries by using t ...
published on : 1 hour ago 12 Comments

How to resolve MassAssignment Exception _token error in Laravel 5?

Mass assignment exception in model.phpIt seems you have not defined the fillable attribute in your Model. Please define it in your model class to allow table attributes as fillable ...
published on : 10 hours ago 12 Comments

Reading writing and deleting a File from disk or filesystem in Laravel 5

An Introduction To Laravel's FileSystemLaravel uses Frank de Jonge PHP Package For managing Filesystem. Laravel provides simple drivers to manage local filesystem, Amazon S3, and R ...
published on : 1 day ago 12 Comments

How to resolve phpunit/phpunit 5.7.8 requires ext-dom * error while installing Laravel 5

Installing php-xml extension on ubuntu based on php versionIf you are facing "phpunit/phpunit 5.7.8 requires ext-dom *" error at time of installing Laravel then you need to install ...
published on : 6 hours ago 12 Comments

How to assign multiple middleware to Laravel route ?

Laravel Multiple Middlewares on single UrlYou can assign multiple middlewares to Laravel route by using middleware method.Example // Assign multiple multiple middlewares to Laravel ...
published on : 34 minutes ago 12 Comments