API Feature (#334)

This commit is contained in:
Saeed Vaziry
2024-11-01 16:49:57 +01:00
committed by GitHub
parent da7b24640e
commit 417bf73e44
143 changed files with 36520 additions and 586 deletions

View File

@ -4,7 +4,6 @@
use App\Models\Project;
use Filament\Widgets\Widget;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
class SelectProject extends Widget
@ -20,15 +19,7 @@ class SelectProject extends Widget
public function mount(): void
{
$this->currentProject = auth()->user()->currentProject;
$this->projects = Project::query()
->where(function (Builder $query) {
if (auth()->user()->isAdmin()) {
return;
}
$query->where('user_id', auth()->id())
->orWhereHas('users', fn ($query) => $query->where('user_id', auth()->id()));
})
->get();
$this->projects = auth()->user()->allProjects()->get();
}
public function updateProject(Project $project): void