2

I'm not a Laravel developer, but I bought a website from CodeCanyon, and this is the error I'm getting.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ahimalayan.localizations' doesn't exist (SQL: select * from localizations where ip = 223.185.4 limit 1)

And the service provider is not answering much, and I need to upload it asap but he told me to use php artisan migrate:fresh—seed, but I'm not sure where to use it and how to use it. Can anyone please help? I'm a little bit friendly with coding.

Karl Hill
  • 12,937
  • 5
  • 58
  • 95
THE UNKNOWN
  • 21
  • 1
  • 1
  • 2
  • The command `php artisan migrate:fresh --seed` will revert all existing migrations an execute them all again, additionally will **"seed"** the database using the existing "seeders" (if your app have some). With that the table `localizations` will be created – Guille May 02 '22 at 19:24
  • thank you very much, now I know the what's the use case of the command but the thing is I've the migration folder and seeder folder in website files and i don't know where to use that command. can you please tell me? – THE UNKNOWN May 02 '22 at 19:32
  • 1
    You need to log into the server and change directory into the app and then run the command. Something like: `cd /var/www/myAppFolder` and then `php artisan migrate:fresh --seed`. – Watercayman May 02 '22 at 19:32
  • As Walter said you need to move to your app **root** path to execute the command, `cd /path/to/your/app`, then do `ls` or `ll` and look for a file called `artisan` if you see it, your are in the right place, then you can do `php artisan migrate:fresh --seed`. – Guille May 02 '22 at 19:39

2 Answers2

0

I suggest this steps for your problem :

  1. you need to create a new database in host control panel

  2. Rename example.env file name to .env in main root folder and put new database data inside that. just like this:


    DB_DATABASE=DB NAME
    DB_USERNAME=DB USERNAME
    DB_PASSWORD=DB PASSWORD

  1. then add this line inside routes/web.php file:
    Route::get('migrate', function() {
        \Illuminate\Support\Facades\Artisan::call('migrate:fresh -—seed');
    });
  1. now open this url on your browser to run migrations and seeds. then all required tables will be created automatically and some demo data will be inserted as well.

http://localhost/LaravelFolder/public/migrate

Ali Zamani
  • 53
  • 1
  • 4
0

You likely need to run these 2 commands in your app root path.

  php artisan migrate
  php artisan db:seed
agotfrid
  • 507
  • 5
  • 7