LavaLite / cms

Multilingual PHP CMS built with Laravel and bootstrap

Home Page:https://lavalite.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. 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 userswhereslug= test12345 andusers.deleted_at is null)](https://FOO.ap-northeast-1.amazonaws.com/user/register#top)

image
image
image

  1. so I make slug in users table, and create new User, then I have error Class "App\Http\Controllers\Auth\Role" not found

image

image

  1. of caurse , I already migrated, and composer updated.

image

class Role{}

  1. /lavalite/app/Facades/Role.php
  2. /lavalite/app/Forms/Role.php
  3. /lavalite/app/Litepie/Role.php
  4. /lavalite/app/Models/Role.php
  5. /lavalite/vendor/lavalite/framework/src/Litepie/Roles/Forms/Role.php
  6. /lavalite/vendor/lavalite/framework/src/Litepie/Roles/Models/Role.php

function findBySlug{}

  1. /lavalite/vendor/lavalite/framework/src/Litepie/Database/Traits/Sluggable.php
    public static function findBySlug($slug, $columns = ['*'])
    {
        return self::whereSlug($slug)->first($columns);
    }
  1. /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

  1. /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;
    }
  1. /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.

image

Breeze Wouldn't you use it?