<?php

namespace App\Repositories;

use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\ColourRepository;
use App\Models\Colour;
use App\Validators\ColourValidator;

/**
 * Class ColourRepositoryEloquent.
 *
 * @package namespace App\Repositories;
 */
class ColourRepositoryEloquent extends BaseRepository implements ColourRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return Colour::class;
    }

    
    public function indexPage()
    {
        $get_colours = parent::all();
        return view('admin.colours.index', compact('get_colours'));
    }

    public function createPage()
    {
        return view('admin.colours.add');

    }
    public function editPage($id)
    {
        $find_colour = parent::find($id);
        return view('admin.colours.update', compact('find_colour'));

    }

    public function create($data)
    {
        return parent::create($data);
    }
    public function update($data, $id)
    {
        return parent::update($data, $id);

    }

    public function delete($id)
    {
        return parent::delete($id);
    }

    public function getById($id)
    {
        return parent::find($id);
    }


    public function getAllColours()
    {
        return parent::all();
    }
    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }
    
}
