Repositories/Repository.php

koel · app/Repositories/Repository.php · php · MIT
database

Generic Laravel repository base class providing CRUD operations and query helpers for Eloquent models.

// Source: https://github.com/koel/koel | License: MIT | Copyright 2015 Phan An
// Provided via justclaw.it.com; keep this notice with the code.
<?php

namespace App\Repositories;

use App\Repositories\Contracts\Repository as RepositoryContract;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection as SupportCollection;

/**
 * @template T of Model
 * @implements RepositoryContract<T>
 */
abstract class Repository implements RepositoryContract
{
    protected const int SEARCH_CANDIDATE_LIMIT = 1000;

    /** @var class-string<T> $modelClass */
    public string $modelClass;

    protected Guard $auth;

    /** @param class-string<T> $modelClass */


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key