Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel get auth user in constructor

<?php

namespace AppHttpControllers;

use AppUser;
use IlluminateSupportFacadesAuth;
use AppHttpControllersController;

class ProjectController extends Controller
{
    /**
     * All of the current user's projects.
     */
    protected $projects;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware(function ($request, $next) {
            $this->projects = Auth::user()->projects;

            return $next($request);
        });
    }
}
Comment

laravel auth user in constructor

public function __construct()
{
  $this->middleware(function ($request, $next) {
    $this->user = Auth::user();
    return $next($request);
  });
}
Comment

PREVIOUS NEXT
Code Example
Php :: CodeIgniter get_where order_by 
Php :: php time difference in hours 
Php :: get raw query laravel 
Php :: wp enqueue style 
Php :: migrate only one table laravel 
Php :: laravel storage save file folder on disk 
Php :: current URL without url site laravel 
Php :: PHP Warning: Version warning: Imagick was compiled against Image Magick version 1654 but version 1650 is loaded. 
Php :: get woocommerce order details Object 
Php :: wp wordpress logout 
Php :: slp price php 
Php :: pdo last id 
Php :: console log in php 
Php :: laravel migrate if not exists 
Php :: password strength php 
Php :: laravel RuntimeException Session store not set on request. 
Php :: php write to file 
Php :: php shell script 
Php :: how to use javascript variable in php 
Php :: malformed utf-8 characters possibly incorrectly encoded php 
Php :: increase memory laravel controller 
Php :: laravel sort by numbers 
Php :: php random 5 digit number 
Php :: laravel remove duplicates from array 
Php :: php reduce 
Php :: laravel model is dirty 
Php :: upload file in laravel 
Php :: yii app db createcommand join yii1 
Php :: laravel where not 
Php :: get extension from filename php 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =