首页 > 解决方案 > 为什么当我想 php artisan db:seed 时我不能 db:seed

问题描述

我需要帮助来解决这个问题,我似乎无法解决,因为我不知道该怎么做。请帮助调试我面临的这个播种错误。

Seeding: DefaultBlockedTypeTableSeeder
Seeding: DefaultBlockedItemsTableSeeder
Seeding: BlockedTypeTableSeeder
Seeding: BlockedItemsTableSeeder
Seeding: DefaultPermissionitemsTableSeeder

   Illuminate\Database\QueryException  : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'membership.permissions' doesn't exist (SQL: select * from `permissions` where `slug` = view.users and `permissions`.`deleted_at` is null limit 1)

  at C:\xampp\htdocs\laravel-auth-master\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673|

  Exception trace:

  1   Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'membership.permissions' doesn't exist")
      C:\xampp\htdocs\laravel-auth-master\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:63

  2   PDOException::("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'membership.permissions' doesn't exist")
      C:\xampp\htdocs\laravel-auth-master\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:61

  Please use the argument -v to see more details.

标签: laravel

解决方案


我猜AuthServiceProvider.php你在你的项目中定义了对数据库表感兴趣的 Gates(在这个错误中:权限),所以你必须注释这些并再次运行php artisan db:seed,完成后,去AuthServiceProvider.php并取消注释 Gates。


推荐阅读