Msieprawski\ResourceTable\ResourceTable::of PHP Method

of() public static method

Sets builder and returns collection
public static of ( Builder | Builder $builder ) : Collection
$builder Illuminate\Database\Eloquent\Builder | Illuminate\Database\Query\Builder
return Msieprawski\ResourceTable\Generators\Collection
    public static function of($builder)
    {
        if ($builder instanceof \Illuminate\Database\Eloquent\Builder) {
            $builder = $builder->getQuery();
        }
        $collection = new Collection($builder);
        $collection = self::_addCustomAttributes($collection);
        self::$_lastCollection = $collection;
        return self::collection();
    }