Skip to content

Commit

Permalink
Update AdminShadowFilter, fix deleted profile bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dansup committed Dec 19, 2023
1 parent 5c1591f commit a492a95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Controllers/AdminShadowFilterController.php
Expand Up @@ -19,7 +19,8 @@ public function home(Request $request)
{
$filter = $request->input('filter');
$searchQuery = $request->input('q');
$filters = AdminShadowFilter::when($filter, function($q, $filter) {
$filters = AdminShadowFilter::whereHas('profile')
->when($filter, function($q, $filter) {
if($filter == 'all') {
return $q;
} else if($filter == 'inactive') {
Expand Down
6 changes: 6 additions & 0 deletions app/Models/AdminShadowFilter.php
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Services\AccountService;
use App\Profile;

class AdminShadowFilter extends Model
{
Expand All @@ -24,4 +25,9 @@ public function account()

return;
}

public function profile()
{
return $this->belongsTo(Profile::class, 'item_id');
}
}

0 comments on commit a492a95

Please sign in to comment.