i want to check the current admin
get the id of admin
Hi @OdaiTu ,
You should be able to use backpack_user()->id anywhere inside your app, in the latest Backpack. It will also apply a custom authentication guard, if you've specified one in your base.php config file. If you're running an old Backpack\Base version, it's the normal Auth::user(), with no auth guard applied.
Hope it helps.
Cheers!
@tabacitu
im not sure if i get it
right im using the last version
using backpack_user()->id gives me an call to undefined function
i have i users table and admins table
which i use is the admins table for backpack login and register
i want to send notifications to these admins base in there id`s
so i can display the notifications for each admin base on his id
i did this
Auth::guard(admin)->user();
but i miss something here
i dont know what it is
check your guard in config/backpack/base.php config file
@iMokhles its admin
@OdaiTu you seem to be using Backpack\Base 0.8.x if you get undefined function when using backpack_user(). For this version use \Auth::user()->id. I assume you're not using custom auth guards.
Cheers!
use Auth;
Auth::guard('admin')->user()->id;
For me
Auth::guard('backpack')->user() works perfectly.
use Auth;
Auth::guard('admin')->user()->id;
I have been working on something for 2 hours and your code helped me get it done man. Bless you
Most helpful comment
use Auth;Auth::guard('admin')->user()->id;