- Create MapLayers trait (layer/phase visibility, filters) - Create MapInspections trait (inspection CRUD, viewer, editor) - Create MapIssues trait (issue count listeners) - Create MapFeatures trait (feature selection, progress, images) Tests: 101 passing (319 assertions)
36 lines
841 B
PHP
36 lines
841 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Projects\Traits;
|
|
|
|
use App\Models\Feature;
|
|
use App\Models\Issue;
|
|
use Livewire\Attributes\On;
|
|
|
|
trait MapIssues
|
|
{
|
|
public $openIssuesCount = 0;
|
|
|
|
#[On('issue-created')]
|
|
public function handleIssueCreated()
|
|
{
|
|
$this->openIssuesCount = Issue::where('project_id', $this->project->id)
|
|
->where('status', 'open')
|
|
->count();
|
|
}
|
|
|
|
#[On('issue-updated')]
|
|
public function handleIssueUpdated()
|
|
{
|
|
$this->openIssuesCount = Issue::where('project_id', $this->project->id)
|
|
->where('status', 'open')
|
|
->count();
|
|
}
|
|
|
|
#[On('issue-deleted')]
|
|
public function handleIssueDeleted()
|
|
{
|
|
$this->openIssuesCount = Issue::where('project_id', $this->project->id)
|
|
->where('status', 'open')
|
|
->count();
|
|
}
|
|
} |