Laravel-admin: How to get the current authenticated admin user id in Form field value

Created on 26 Aug 2019  路  1Comment  路  Source: z-song/laravel-admin

How to get the current authenticated admin user id in Form field value

 $form->text('created_by', 'created_by')->default(Admin::user()->id)->setWidth(3, 2);

Error:

Symfony Component Debug Exception FatalThrowableError (E_ERROR)
Class 'AppAdminControllersAdmin' not found

Most helpful comment

@rajkumarForDev you must add to header
use Encore\Admin\Facades\Admin;
and then you can use Admin::user()->id

>All comments

@rajkumarForDev you must add to header
use Encore\Admin\Facades\Admin;
and then you can use Admin::user()->id

Was this page helpful?
0 / 5 - 0 ratings

Related issues

taimaiduc picture taimaiduc  路  3Comments

fokoz picture fokoz  路  3Comments

evans-kim picture evans-kim  路  3Comments

abufalbo picture abufalbo  路  3Comments

benny-sun picture benny-sun  路  3Comments