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