Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0
Solution

found my error. i was querying the wrong database so it did exist but my app was using a different database where the stored procedure didn't exist.

i also switched out DB::statement for DB::select. with DB::statement i get a true/false result instead of a resultset.

Last updated 2 years ago.
0

Hey,

I'm using Eloquent ORM along with SLIM.

This is my AppModel

use Illuminate\Database\Eloquent\Model as Eloquent;

/**
 * Description of GetPostProcedure
 *
 * @author hemant
 */
class GetPostProcedure extends Eloquent {

    public function getPost($user_id, $post_id) {

        $SQL = 'get_view_user_post(' . $post_id . ',' . $user_id . ',5.5)';

//        return $this->select('call ' . $SQL, [$post_id, $user_id]); // call type 1

        return DB::select('call ' . $SQL); // call type 2
    }

}

in Call type 1, i get back an object with no data at all. and in type 2, i get error

  • Fatal error: Class 'DB' not found in /var/www/html/new-mentor/app/models/GetPostProcedure.php on line 26

what can be done here??

0

Sign in to participate in this thread!

Eventy

Your banner here too?

w1n78 w1n78 Joined 21 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.