How can i get the first record with laravel 4 raw queries.
Something like DB::select('')->first();
is not working
neither did DB::first('')
How can i get the first record with laravel 4 raw queries.
Something like DB::select('')->first();
is not working
neither did DB::first('')
The fact is that DB:select() returns an array, so you have to:
DB::select(DB::raw('select * from users'))[0];
You also can
DB::table('users')->first();
Use like this
$allmarketers = ProductStock::take(3)->get()[2];
Take will return how many rows you want and you use the offset like 2 to pick individual rows