0
votes

I'am new in laravel world. After php artisan migrate -seed command, I got the error MariaDB 10.4.6 PHP 7.3

The problem with SQL code shouldn't be

DB::table('settings')->insert($typi_settings);
$max = DB::table('settings')->max('id');
DB::select(DB::raw("select setval('typicms_settings_id_seq', $max)"));

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''typicms_settings_id_seq', 15)' at line 1 (SQL: select setval('typicms_settings_id_seq', 15))

1

1 Answers

0
votes

You are already doing a select by calling the select method on the QueryBuilder, try this instead:

DB::select(DB::raw("setval('typicms_settings_id_seq', $max)"));