Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/app/Shop/PriceExtras/Repositories/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/app/Shop/PriceExtras/Repositories/PriceExtraRepository.php
<?php

namespace App\Shop\PriceExtras\Repositories;

use App\Shop\PriceExtras\PriceExtra;
use Illuminate\Support\Collection;
use Jsdecena\Baserepo\BaseRepository;
use Illuminate\Database\QueryException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use App\Shop\PriceExtras\Repositories\Interfaces\PriceExtraRepositoryInterface;

class PriceExtraRepository extends BaseRepository implements PriceExtraRepositoryInterface
{
	/**
     * PriceExtraRepository constructor.
     * 
     * @param PriceExtra $dummy
     */
    public function __construct(PriceExtra $dummy)
    {
        parent::__construct($dummy);
        $this->model = $dummy;
    }

    /**
     * List all the PriceExtras
     *
     * @param string $order
     * @param string $sort
     * @param array $except
     * @return \Illuminate\Support\Collection
     */
    public function listPriceExtras(string $order = 'id', string $sort = 'desc', $except = []) : Collection
    {
        return $this->model->orderBy($order, $sort)->get()->except($except);
    }

    /**
     * Create PriceExtra
     *
     * @param array $params
     *
     * @return PriceExtra
     * @throws InvalidArgumentException
     */
    public function createPriceExtra(array $params) : PriceExtra
    {
        try {
        	return PriceExtra::create($params);
        } catch (QueryException $e) {
            throw new InvalidArgumentException($e->getMessage());
        }
    }

    /**
     * Update the dummy
     *
     * @param array $params
     * @return PriceExtra
     */
    public function updatePriceExtra(array $params) : PriceExtra
    {
        $dummy = $this->findPriceExtraById($this->model->id);
        $dummy->update($params);
        return $dummy;
    }

    /**
     * @param int $id
     * 
     * @return PriceExtra
     * @throws ModelNotFoundException
     */
    public function findPriceExtraById(int $id) : PriceExtra
    {
        try {
            return $this->findOneOrFail($id);
        } catch (ModelNotFoundException $e) {
            throw new ModelNotFoundException($e->getMessage());
        }
    }

    /**
     * Delete a dummy
     *
     * @return bool
     */
    public function deletePriceExtra() : bool
    {
        return $this->model->delete();
    }
}

Spamworldpro Mini