PHP Class Learner\Repositories\Eloquent\CategoryRepository

Inheritance: extends AbstractRepository, implements Learner\Repositories\CategoryRepositoryInterface
Show file Open project: RryLee/learner.video

Public Methods

Method Description
__construct ( Category $category ) Create a new Category instance.
create ( array $data ) : array Create new category.
findAll ( ) : Illuminate\Database\Eloquent\Collection | Category[] Find all categories.
findImageById ( integer $id ) : string Find image path by id.
findRelationByName ( string $name ) : Illuminate\Database\Eloquent\Collection | Category[] Find category relation by name.
getCreateForm ( ) : CreateCategoryFormService Get create form service.
getUpdateForm ( ) : UpdateCategoryFormService Get update form service.
listIdAndName ( ) : array List id and name. (for admin)
listNameAndImageWithRelation ( ) : Illuminate\Database\Eloquent\Collection | Category[] List all category's name and image with relation
update ( integer $id, array $data ) : array Update category by id.

Method Details

__construct() public method

Create a new Category instance.
public __construct ( Category $category )
$category Learner\Models\Category

create() public method

Create new category.
public create ( array $data ) : array
$data array
return array

findAll() public method

Find all categories.
public findAll ( ) : Illuminate\Database\Eloquent\Collection | Category[]
return Illuminate\Database\Eloquent\Collection | Learner\Models\Category[]

findImageById() public method

Find image path by id.
public findImageById ( integer $id ) : string
$id integer
return string

findRelationByName() public method

Find category relation by name.
public findRelationByName ( string $name ) : Illuminate\Database\Eloquent\Collection | Category[]
$name string
return Illuminate\Database\Eloquent\Collection | Learner\Models\Category[]

getCreateForm() public method

Get create form service.
public getCreateForm ( ) : CreateCategoryFormService
return Learner\Services\Forms\CreateCategoryFormService

getUpdateForm() public method

Get update form service.
public getUpdateForm ( ) : UpdateCategoryFormService
return Learner\Services\Forms\UpdateCategoryFormService

listIdAndName() public method

List id and name. (for admin)
public listIdAndName ( ) : array
return array

listNameAndImageWithRelation() public method

List all category's name and image with relation
public listNameAndImageWithRelation ( ) : Illuminate\Database\Eloquent\Collection | Category[]
return Illuminate\Database\Eloquent\Collection | Learner\Models\Category[]

update() public method

Update category by id.
public update ( integer $id, array $data ) : array
$id integer
$data array
return array