mirror of
https://github.com/koel/koel
synced 2024-12-20 17:43:36 +00:00
21 lines
460 B
PHP
21 lines
460 B
PHP
<?php
|
|
|
|
namespace App\Repositories\Traits;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Collection;
|
|
|
|
trait ByCurrentUser
|
|
{
|
|
private function byCurrentUser(): Builder
|
|
{
|
|
return $this->model->whereUserId($this->auth->id());
|
|
}
|
|
|
|
/** @return Collection|array<Model> */
|
|
public function getAllByCurrentUser(): Collection
|
|
{
|
|
return $this->byCurrentUser()->get();
|
|
}
|
|
}
|