PHP code example of rkooistra / super-eloquent-repository
1. Go to this page and download the library: Download rkooistra/super-eloquent-repository library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rkooistra / super-eloquent-repository example snippets
/** @return string <Return the full path to the class here.> */
protected function getModelClass(): string
{
return \App\Entities\User::class;
}
public function getModel(): Builder;
public function setConnection($connection);
public function getAll(array $selectKeys = null, array $relations = null);
public function findByKey(
string $key,
string $value,
array $selectKeys = null,
array $relations = null
): Collection;
public function findByKeyWhereIn(
string $key,
array $array,
array $selectKeys = null
): Collection;
public function findByKeyWhereNotIn(
string $key,
array $array,
array $selectKeys = null
): Collection;
public function findOrFail(int $id, array $selectKeys = null): Model;
public function getAllResources (array $selectKeys = [], array $relations = []): Collection;
public function getAllResourcesWhereHas (string $whereHasRelation, $whereHasCallback, array $selectKeys = [], array $relations = []): Collection;
public function findByKeyWhereLike(string $key, string $value, array $selectKeys = null, array $relations = null): Collection;
public function updateResource(int $id, array $fields): int;
public function createResourceByArray(array $array): Model;
public function destroy(string $selectKey, array $ids): int;
public function destroyWhereNotIn(string $selectKey, array $ids): int;
public function firstOrCreate(array $insertables, string $identifierKey = 'id', array $selectKeys = [], array $relations = []): Model;
public function updateFirstOrCreate(array $insertables, string $identifierKey = 'id', array $selectKeys = [], array $relations = []): Model;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.