SQLSTATE[42S22]: Column not found: 1054 Unknown column 'slug' in 'where clause' (SQL: select count(*) as aggregate from `users` where `slug` = test12345 and `users`.`deleted_at` is null)
nakamotojp opened this issue · comments
- I install new LavaLite, and create new User from
FOO.com/user/register
, then I have error[SQLSTATE[42S22]: Column not found: 1054 Unknown column 'slug' in 'where clause' (SQL: select count(*) as aggregate from
userswhere
slug= test12345 and
users.
deleted_atis null)](https://FOO.ap-northeast-1.amazonaws.com/user/register#top)
- so I make slug in users table, and create new User, then I have error
Class "App\Http\Controllers\Auth\Role" not found
- of caurse , I already migrated, and composer updated.
class Role{}
- /lavalite/app/Facades/Role.php
- /lavalite/app/Forms/Role.php
- /lavalite/app/Litepie/Role.php
- /lavalite/app/Models/Role.php
- /lavalite/vendor/lavalite/framework/src/Litepie/Roles/Forms/Role.php
- /lavalite/vendor/lavalite/framework/src/Litepie/Roles/Models/Role.php
function findBySlug{}
- /lavalite/vendor/lavalite/framework/src/Litepie/Database/Traits/Sluggable.php
public static function findBySlug($slug, $columns = ['*'])
{
return self::whereSlug($slug)->first($columns);
}
- /lavalite/vendor/lavalite/framework/src/Litepie/Repository/Eloquent/BaseRepository.php
public function findBySlug($value = null, $columns = ['*'])
{
$this->applyCriteria();
$this->applyScope();
$model = $this->model->whereSlug($value)->first($columns);
$this->resetModel();
return $this->parserResult($model);
}
function attachRole
- /lavalite/vendor/lavalite/framework/src/Litepie/Roles/Models/Role.php
public function attachRoles($user)
{
$guard = $this->getGuardRoute();
$roles = config('auth.register.roles.' . $guard, null);
if ($roles == null) {
return;
}
foreach ($roles as $role) {
$roleId = Role::findBySlug($role)->id;
$user->attachRole($roleId);
}
return true;
}
- /lavalite/vendor/lavalite/framework/src/Litepie/Roles/Interfaces/HasRoleAndPermission.php
public function attachRole($role);
/lavalite/vendor/lavalite/framework/src/Litepie/Roles/Models/Role.php
class Role extends Model implements RoleHasRelationsContract
{
use Filer;
use Hashids;
use Sluggable;
use PresentableTrait;
use RoleHasRelations;
if I add use Litepie\Roles\Models\Role;
in /lavalite/app/Http/Controllers/Auth/RegisterController.php
there are Call to undefined method App\Models\User::notify()
, Because I am not logged in.
Breeze Wouldn't you use it?