Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

581
Views
Laravel: cómo usar el usuario de autenticación dentro del alcance global

Quiero usar el usuario de autenticación en el ámbito global

Usuario.php

 public function scopeActive($query) { return $query->where('accessed_id', auth()->user()->accessed_id); } protected static function boot() { parent::boot(); static::addGlobalScope('customer_user', function (Builder $builder) { if(auth()->check()){ // check user is auth or not $builder->active(); } }); }

No puedo obtener el usuario de autenticación en el alcance porque el alcance se llamó antes después de la autenticación. ¿Es posible obtener el usuario de autenticación en el alcance global?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!