Your IP : 216.73.216.79


Current Path : /var/www/html/dynaweb-starter/plugin/dynaweb-widget/src/Repositories/
Upload File :
Current File : /var/www/html/dynaweb-starter/plugin/dynaweb-widget/src/Repositories/BaseRepository.php

<?php

namespace Dynaweb\DynawebWidget\Repositories;

use Dynaweb\DynawebWidget\Contracts\BaseRepositories;

class BaseRepository implements BaseRepositories
{
    public $model;

    public function __construct($model)
    {
        $this->model = $model;
    }

    /***
     * Get All
     */
    public function getAll()
    {
        return $this->model::all();
    }

    /***
     * Get By Id
     */
    public function getById($id)
    {
        return $this->model::find($id);
    }

    /***
     * Delete
     */
    public function delete($id)
    {
        return $this->model::delete($id);
    }

    /***
     * Create
     */
    public function create($payload)
    {
        return $this->model::create($payload);
    }

    /***
     * Update
     */
    public function update($id, $payload)
    {
        return $this->model::findOrFail($id)->update($payload);
    }
}