Check connection using
php artisan tinker
then
DB::connection()->getPdo();
What error are you getting while running
php artisan
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
laravel 8 project working with database, when i change new database and it doest not working, even php artisan command not working
PS C:\xampp\htdocs\laraauth> php artisan
In Connection.php line 712:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pheonix_crm.company_settings' doesn't exist (SQL: select * from company_settings
where id = 1 limit 1)
what have i done. change db name in .env file only.
Please help me. how to solve this error and do php artisan migrate:refresh
problem was solved. i've used view share on all pages through controller.php, when i comment that line it will working.
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function __construct()
{
//its just a dummy data object.
$company_info = DB::table('company_settings')->where('id', 1)->first();
$company_subscriptions = DB::table('company_subscriptions')->where('company_id', 1)->first();
$meta_data = DB::table('landing_pages')
->select('landing_page_meta_details.*')
->join('landing_page_meta_details', 'landing_page_meta_details.page_id', '=', 'landing_pages.id')
->where('is_default_landing_page', 1)->get();
View::share('cm_favicon', $company_info->site_favicon ?? '');
View::share('cm_logo', $company_info->site_logo ?? '');
View::share('copyrights', $company_info->copyrights ?? '');
View::share('site_name', $company_info->site_name ?? '');
View::share('meta_data', $meta_data ?? '');
View::share('expiry_date', $company_subscriptions->endAt ?? '');
}
}
Thank you for replying all.
Please or to participate in this conversation.