thedevdojo / voyager

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

User avatar not updated. #2487

Closed ssi-anik closed 6 years ago

ssi-anik commented 6 years ago

First of all, THANKS for building this nice package.

Suggestion We may try to use users table to store the application users. So, wouldn't it be a good idea to use a separate table such as admins or something like this? laravel.log

fletch3555 commented 6 years ago

How you architect your application is 100% up to you. We try to make it a bit easier, but obviously can't meet every use-case.

Now for your issue... I have no idea what your complaint is. You say you can't update an image (implying you're already successfully logged into Voyager so the DB connection is fine), then show an error from the log showing the app is unable to find the DB.

Couple things

  1. Whether you use docker or something else really doesn't matter to the app. The app just needs to be able to talk to the DB. It's up to you to enter the appropriate configuration for this.
  2. I seriously doubt that error is relevant. If it was triggered by this action, then either you're using multiple database connections and have one set up wrong, or you've changed something about Voyager and we won't be able to support you (at least without knowing what was changed).
  3. You haven't described what you're doing to change the avatar image, or what it's showing (error message or otherwise), etc. In short, we need more information.
ssi-anik commented 6 years ago

Okay.

  1. Avatar: Yes. I overlooked the APP_URL in the .env file.
  2. I have attached a video with this comment. When I run php artisan it throws an error. Screencast.mp4
  3. Log file is also attached. laravel.log
fletch3555 commented 6 years ago

Can you share your config/database.php file? Also, please share any relevant .env entries (please don't share your password...)

ssi-anik commented 6 years ago

.env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:iZpWitSHyynrkC8Xyhx5l89H8W8g5jwEMb6dlCLZYiY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://127.0.0.1:8001

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel-voyager
DB_USERNAME=
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

config/database.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    'default' => env('DB_CONNECTION', 'mysql'),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    'connections' => [

        'sqlite' => [
            'driver' => 'sqlite',
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
        ],

        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
        ],

        'pgsql' => [
            'driver' => 'pgsql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
            'schema' => 'public',
            'sslmode' => 'prefer',
        ],

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => '',
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    */

    'migrations' => 'migrations',

    /*
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer set of commands than a typical key-value systems
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    */

    'redis' => [

        'client' => 'predis',

        'default' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,
        ],

    ],

];
ssi-anik commented 6 years ago

You're trying to connect to db. But, why is that?

fletch3555 commented 6 years ago

I'm not personally trying to connect to it, but just wanted to make sure the configuration was correct, which it seems to be. Voyager needs to connect as it dynamically builds out and registers Policies based on database entries (that's how the permissions system works). The errors in the log indicate that Laravel is unable to talk to the database server.

Since you're in docker, can you show that the 2 containers are running and connected (same network, ports are exposed, etc)?

ssi-anik commented 6 years ago

If I run the command inside a container, that's working properly. What's what I told before. I mainly asked is there any reason to connect to DB. Anyway, I didn't mean "you're going to connect to my database". :tongue: Okay. As you said, "For policies". Then it's Okay

fletch3555 commented 6 years ago

Yeah, sounds like your database may not actually be running, or something else about your container setup is incorrect. The app itself seems like it should be running fine once it has access to the DB.

I'm going to close this for now. If you have further issues with this, please comment here and we can reopen it.

github-actions[bot] commented 4 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.