Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel 8: Call to database function

I’m using a Laravel 8 for website developement, and on the next part of code, I execute a query:

$assig = DB::table('table')
->where('table.column', '=', "oneValue")
->select('anfunctionOnDatabase(2,table.columDesc)')
->get();

but it no works.

How I need call to database function on laravel?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks

>Solution :

Use selectRaw()

like this;

$assig = DB::table('table')
    ->where('table.column', '=', "oneValue")
    ->selectRaw('anfunctionOnDatabase(2,table.columDesc)')
    ->get();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading