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

this is one of the reasons where Repositories come in handy

other than writing a query scope (http://laravel.com/docs/eloquent#query-scopes) I wouldn't know how to do it

I've written a couple of posts about repositories in L4 if you are interested, http://blog.zenry.nl

Last updated 2 years ago.
0

I have never tried this, bus i think you should be able to override get method in you mode, smth like this:

class YourModel extends Eloquent {

    protected $table = 'table';

    public function get()
    {
        parent::orderBy('column', 'DESC')->get();
    }
} 
Last updated 2 years ago.
0

Good thought, but it appears to not work :(

Last updated 2 years ago.
0

I noticed I did not add return, did you? :D

Last updated 2 years ago.
0

Tried that, still no

    public static function get()
    {
        return parent::orderBy('column', 'DESC')->get();
    }
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

T3chn0crat t3chn0crat Joined 26 Mar 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.