“Laravel Auth pengguna di konstruktor” Kode Jawaban

Laravel Auth

composer require laravel/ui
// Generate basic scaffolding...
php artisan ui bootstrap
php artisan ui vue
php artisan ui react

// Generate login / registration scaffolding...
php artisan ui bootstrap --auth
npm install && npm run dev
php artisan ui vue --auth
php artisan ui react --auth
Sikadner

Laravel mendapatkan pengguna auth di konstruktor

<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;

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);
        });
    }
}
Almabek

Laravel Make: auth

composer require laravel/ui
php artisan ui vue --auth
php artisan migrate
Adorable Anaconda

Laravel Auth

composer require laravel/ui

php artisan ui vue --auth

npm install && npm run dev
Almabek

Laravel membuat auth

Laravel's laravel/ui package provides a quick way to scaffold all of the routes and views you need for authentication using a few simple commands:

composer require laravel/ui

php artisan ui vue --auth
Cautious Constrictor

Laravel Auth pengguna di konstruktor

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

Jawaban yang mirip dengan “Laravel Auth pengguna di konstruktor”

Pertanyaan yang mirip dengan “Laravel Auth pengguna di konstruktor”

Lebih banyak jawaban terkait untuk “Laravel Auth pengguna di konstruktor” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya