0

I'm trying to use psr-4 autoload for the first time with Laravel. After I do that with models and I have the following eloquent model:

<?php namespace Models\Series;

class Player extends \BaseModel {}

It works fine, but if I add a collection like this:

public static function listing()
{
    return Player::paginate(15);
}

Then I receive this error:

Cannot redeclare class Models\Series\Player

I also tried replacing Player::paginate(15) with self::paginate(15), but for no avail.

user2094178
  • 9,204
  • 10
  • 41
  • 70

1 Answers1

0

instead of using static function in your model, why dont you just try using scope

namespace Models\Series;

class Player extends \BaseModel {

    public function scopeListing($query){
        return $query->paginate(15);
    }
}

i havent tested yet, but i hope i'll help :D