Answers for "laravel import db"

PHP
1

import sql file from laravel

use Illuminate\Support\Facades\DB;

DB::unprepared(file_get_contents('PATH_TO_SQL'));
Posted by: Guest on December-01-2020
3

DB::transaction

use Illuminate\Support\Facades\DB;

DB::transaction(function () {
    DB::update('update users set votes = 1');

    DB::delete('delete from posts');
});
Posted by: Guest on December-09-2020

Browse Popular Code Answers by Language