Level 55
@ahoi the first argument is authenticated user
check in providers.users.model pointed correctly and try to clear cache after
php artisan optimize:clear
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everybody,
I moved the models to app/Models/ and this seems to work well.
But there's one thing:
If I perform php artisan make:policy UserPolicy I am getting this result:
<?php
namespace App\Policies;
use Illuminate\Auth\Access\HandlesAuthorization;
use ;
class UserPolicy
{
use HandlesAuthorization;
/**
* Create a new policy instance.
*
* @return void
*/
public function __construct()
{
//
}
}
You may noticed the use ; statement at the very beginning.
If I use php artisan make:policy UserPolicy --model=User I'm getting this:
<?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
use ;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \ $
* @return mixed
*/
public function viewAny( $)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \ $
* @param \App\Models\User $user
* @return mixed
*/
public function view( $, User $user)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \ $
* @return mixed
*/
public function create( $)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \ $
* @param \App\Models\User $user
* @return mixed
*/
public function update( $, User $user)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \ $
* @param \App\Models\User $user
* @return mixed
*/
public function delete( $, User $user)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \ $
* @param \App\Models\User $user
* @return mixed
*/
public function restore( $, User $user)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \ $
* @param \App\Models\User $user
* @return mixed
*/
public function forceDelete( $, User $user)
{
//
}
}
What did I miss here?
@ahoi the first argument is authenticated user
check in providers.users.model pointed correctly and try to clear cache after
php artisan optimize:clear
Please or to participate in this conversation.