1
I have a question, I would like to recover the data that is logged in without having to go through the view, and use them in any view, so I decided to do in the controller __construct
The more the Laravel doesn’t let me take the user data.
<?php
namespace App\Http\Controllers;
use App\User;
use app\Http\Requests\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Auth\Events\Authenticated;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->projects = Auth::user()->id;
return $next($request);
});
$projects = $request->user();
}
}
Your problem may be similar to this one: https://answall.com/questions/127178/p%C3%A1ginas-do-Laravel-5-2-redirecting-no-show-no-validator errors%C3%A7%C3%A3o/127187#127187
– Wallace Maxters