thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.77k stars 2.67k forks source link

Can't create admin user #5144

Closed mervinz closed 3 years ago

mervinz commented 3 years ago

Version information

Description

I have installed voyager successfully in a new project however, am unable to create admin user account. The below error is displayed when I try to access the admin panel.

BadMethodCallException Call to undefined method App\Models\User::hasPermission()

Steps To Reproduce

Steps to reproduce the behavior:

  1. composer require tcg/voyager
  2. php artisan voyager:admin your@email.com --create

Screenshots

illuminate forwardcall

ryancatlin commented 3 years ago

Have you ran php artisan voyager:install?

Pangroms commented 3 years ago

Hi all, I do have the exact same issue. (First time I’m using voyager)

I did run php artisan voyager:install --with-dummy

When trying to create new admin account:

BadMethodCallException
Call to undefined method App\Models\User::setRole()

The user is indeed created with a role_id set up to null instead of 1 (admin).

When trying to access the login panel :

BadMethodCallException
Call to undefined method App\Models\User::hasPermission()

My info : Laravel 8.15 Voyager: v1.4 PHP: 7.4.12

mervinz commented 3 years ago

Have you ran php artisan voyager:install?

Hello @ryancatlin , Yes I have followed the installation steps. I have tried in a new project using laravel breeze for auth scaffolding and voyager works fine. However, when I use laravel Jetstream this error occurs.

MrCrayon commented 3 years ago

Call to undefined method App\Models\User::hasPermission()

Means Voyager has not been properly installed.

If you are installing Voyager 1.4.2 on Laravel 8, Voyager is not going to find User model and you should see this message at the end of install process:

Unable to locate "User.php" in app or app/Models. Did you move this file? You will need to update this manually. Change "extends Authenticatable" to "extends \TCG\Voyager\Models\User" in your User model

To solve the problem you need to follow instructions or install dev branch, to be noted that Laravel 8 is still not fully supported and there are problems with seeders.

If that does not help we can reopen this issue.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.