jeudi 3 décembre 2015

Override default collection name with Laravel and mongodb

get_users works fine but let's say I want to use a different collection with my other functions. Is there a way to pass in the collection name via the Controller maybe?

class User extends Eloquent {
    protected $collection = 'users_collection';

    function get_users() {
        $results = Users::all();
        return $results;
    }

    function get_user_test() {
        // I want to query against a different collection
    }


}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire