<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Repository; use Doctrine\DBAL\Query\QueryBuilder; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Support\Collection; use Illuminate\Support\Traits\Macroable; use ModStart\Detail\Detail; use ModStart\Form\Form; use ModStart\Grid\Model; use ModStart\Support\Concern\HasArguments; abstract class Repository implements RepositoryInterface, SortRepositoryInterface, TreeRepositoryInterface { use Macroable; use HasArguments; protected $keyName = 'id'; protected $isSoftDeletes = false; public function getKeyName() { return $this->keyName ? $this->keyName : 'id'; } public function setKeyName($lwKEo) { $this->keyName = $lwKEo; } public function getCreatedAtColumn() { return 'created_at'; } public function getUpdatedAtColumn() { return 'updated_at'; } public function isSoftDeletes() { return $this->isSoftDeletes; } public function setIsSoftDeletes($bs1gy) { $this->isSoftDeletes = $bs1gy; } public function add(Form $yfPYJ) { throw new \RuntimeException('This repository does not support "add" method'); } public function editing(Form $yfPYJ) { throw new \RuntimeException('This repository does not support "editing" method'); } public function edit(Form $yfPYJ) { throw new \RuntimeException('This repository does not support "edit" method'); } public function show(Detail $uvktA) { throw new \RuntimeException('This repository does not support "show" method'); } public function deleting(Form $yfPYJ) { throw new \RuntimeException('This repository does not support "delete" method'); } public function delete(Form $yfPYJ, Arrayable $Qi0My) { throw new \RuntimeException('This repository does not support "delete" method'); } public function get(Model $xTADA) { throw new \RuntimeException('This repository does not support "get" method'); } public function getQuery(Model $xTADA) { throw new \RuntimeException('This repository dose not support "getQuery" method'); } private $sortColumn = 'sort'; public function getSortColumn() { return $this->sortColumn; } public function setSortColumn($HDpl6) { $this->sortColumn = $HDpl6; } public function sortEdit(Form $yfPYJ) { throw new RuntimeException('This repository does not support "sortEdit" method.'); } private $treePidColumn = 'pid'; private $treeTitleColumn = 'title'; private $treeSortColumn = 'sort'; public function getTreePidColumn() { return $this->treePidColumn; } public function setTreePidColumn($HDpl6) { $this->treePidColumn = $HDpl6; } public function getTreeTitleColumn() { return $this->treeTitleColumn; } public function setTreeTitleColumn($HDpl6) { $this->treeTitleColumn = $HDpl6; } public function getTreeSortColumn() { return $this->treeSortColumn; } public function setTreeSortColumn($HDpl6) { $this->treeSortColumn = $HDpl6; } public function getTreeItems($d2dlC) { throw new \RuntimeException('This repository does not support "getTreeItems" method.'); } public function getTreeAncestorItems() { throw new \RuntimeException('This repository does not support "getTreeAncestorItems" method.'); } public static function make(...$UbqnB) { return new static(...$UbqnB); } public static function instance($kZXWm, array $oKQKj = array()) { goto RPXsn; tCNsZ: if (is_string($kZXWm)) { $kZXWm = new $kZXWm($oKQKj); } goto svqfA; RPXsn: if (null === $kZXWm) { return null; } goto tCNsZ; svqfA: if ($kZXWm instanceof \Illuminate\Database\Eloquent\Model || $kZXWm instanceof \Illuminate\Database\Eloquent\Builder) { $kZXWm = EloquentRepository::make($kZXWm); } goto yUCFM; yUCFM: if (!$kZXWm instanceof \ModStart\Repository\Repository) { $UfDw1 = is_object($kZXWm) ? get_class($kZXWm) : $kZXWm; throw new \InvalidArgumentException("The class [{$UfDw1}] must be a type of [" . Repository::class . '].'); } goto sv0z_; sv0z_: return $kZXWm; goto pHvmv; pHvmv: } }