Laravel Tricks

Browse latest tricks and tips on Laravel.

Laravel Socialite : Authentification OAuth avec Google, Facebook et Github (Social login)

Un guide d'utilisation du package laravel/socialite pour connecter et/ou inscrire les utilisateurs avec un compte Google, Facebook, Github, ... : Social login ...
published on : 3 hours ago 12 Comments

Laravel Admin Panel - Fjord

Hello,Me and my cousin built an open source Admin-Panel/CMS for Laravel-Projects. One year ago we started with our first prototype. Just now we released the second version of the p ...
published on : 20 hours ago 12 Comments

php artisan serve

php artisan serve is a command by laravel framework to start the php development server. After running this command it invokes PHP builtin server. ...
published on : 1 hour ago 12 Comments

Laravel run artisan command from controller

In this trick you will see how to run artisan command from laravel controllerIn routes/web.phpRoute::get('/run-artisan-command-xyz','MyController@runArtisanCommand'); In your Cont ...
published on : 8 hours ago 12 Comments

Check user type in laravel

Add a type field in your auth table, once you added it save user type and check user type in Laravel using below code\Auth::user()->type // Returns logged in user typeRedirect u ...
published on : 1 day ago 12 Comments

Get user id laravel blade

Whenever it is required to get user id of loggedin user in Laravel. Use Auth facade, Auth facade is available every where if auth module is enabled in Laravel.In laravel balade use ...
published on : 1 hour ago 12 Comments

Laravel get logged in user data

In this trick we are going to see how to get logged in user data in laravel. You can get logged in user data using Auth facade in laravel. Below is simple Auth facade example $user ...
published on : 12 hours ago 12 Comments

How to get all records in Laravel?

You can simply use YourModel::all(); to select all records from table with Laravel Eloquent.Example Usage$posts= Post::all(); $posts->each(function($post){   //do ...
published on : 1 day ago 12 Comments

sqlstate hy000 error 2002 laravel

How to resolve sqlstate hy000 error 2002 in laravel.This type of error is occurred due to wrong database configration in .env file. Steps to resolve sqlstate hy000 error in Larave ...
published on : 9 hours ago 12 Comments

Laravel delete migration

How to delete a migration file in Laravel?Sometime we accidentally create a migration in laravel later we identify the particular migration is not required. In this post I am going ...
published on : 2 hours ago 12 Comments