使用 illuminate/database 之后
通过命令 php webman make:model AuthRole 生成的model
如图:
查询语句:
$role = AuthRole::where(['status'=>1])->pluck('name','id');
报错:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wxshop.auth_roles' doesn't exist in /xxxxx/vendor/illuminate/database/Connection.php:368
请问在model 里面不主动写 protected $table = 'auth_role'; 的情况下,如何去除表名自带的s呢?
弄个基类,重写getTable()
https://github.com/wen-gg/webman-laravel-base/blob/main/src/Triats/BModelTrait.php