Skip to content
Advertisement

Problem with migrating sql function in phpmyadmin in Laravel

I have sql function that I need to migrate to phpmyadmin in order for my code to work. I make migration where I insert code for sql function and then I do php artisan migrate:fresh –seed it successfully completes and fills all table and it shows that migration worked.

JavaScript

But when I go in phpmyadmin it didn’t create function. I never worked with this sql functions before, so any help is much appreciated. I use Laravel 8.65. Here is my migration.

migration

JavaScript

Advertisement

Answer

DB::raw returns an Expression to be used in the query builder. It doesn’t run sql.

Use DB::statement for this.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement