6 months ago

Dynamically run seeder file from controller

Posted 6 months ago by nhayder

I'm seeding DB records from controller and things are going well till i'm decided to dynamically seed DB from multiple files

        $wSeeder = new \Database\Seeds\_JumbotronSeeder();

        $wSeeder->run($request->page_id, $wSorting);

so i need to do something like this

        $wSeeder = new \Database\Seeds\$request->seederFile();

        $wSeeder->run($request->page_id, $wSorting);

the solution above will totally help me out with my issued but i keep on getting error

{message: "syntax error, unexpected '$request' (T_VARIABLE), expecting identifier (T_STRING)",…}

any ideas on how to fix this ???

Please sign in or create an account to participate in this conversation.