Update AdminShadowFilter, fix deleted profile bug

This commit is contained in:
Daniel Supernault 2023-12-19 04:01:41 -07:00
parent 5c1591fdff
commit a492a95a0e
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 8 additions and 1 deletions

View file

@ -19,7 +19,8 @@ class AdminShadowFilterController extends Controller
{
$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') {

View file

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Services\AccountService;
use App\Profile;
class AdminShadowFilter extends Model
{
@ -24,4 +25,9 @@ class AdminShadowFilter extends Model
return;
}
public function profile()
{
return $this->belongsTo(Profile::class, 'item_id');
}
}