Answers for "if exists in laravel sql"

PHP
2

laravel db exists

if (DB::table('orders')->where('finalized', 1)->exists()) {
    // ...
}

if (DB::table('orders')->where('finalized', 1)->doesntExist()) {
    // ...
}
Posted by: Guest on August-14-2021
1

check table exists in db laravel

if (!Schema::hasTable('table_name')) {
    // Code to create table
}
Posted by: Guest on July-15-2020

Browse Popular Code Answers by Language