<?php

namespace App\Repositories;

use App\Models\Blog;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use App\Repositories\ReviewRepository;
use App\Models\Review;
use App\Validators\ReviewValidator;

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

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

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

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

    }

    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 getAllReviews()
    {
        return parent::all();
    }


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

}
