diff --git a/app/Http/Controllers/Frontend/HomeController.php b/app/Http/Controllers/Frontend/HomeController.php index d2688182..4cec4b3b 100644 --- a/app/Http/Controllers/Frontend/HomeController.php +++ b/app/Http/Controllers/Frontend/HomeController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers\Frontend; use App\Contracts\Controller; +use App\Models\Enums\UserState; use App\Models\User; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Log; @@ -15,7 +16,7 @@ class HomeController extends Controller public function index() { try { - $users = User::orderBy('created_at', 'desc')->take(4)->get(); + $users = User::where('state', '!=', UserState::DELETED)->orderBy('created_at', 'desc')->take(4)->get(); } catch (\PDOException $e) { Log::emergency($e); return view('system/errors/database_error', [ diff --git a/app/Widgets/LatestPilots.php b/app/Widgets/LatestPilots.php index fc1e4c15..d3b479f3 100644 --- a/app/Widgets/LatestPilots.php +++ b/app/Widgets/LatestPilots.php @@ -3,6 +3,7 @@ namespace App\Widgets; use App\Contracts\Widget; +use App\Models\Enums\UserState; use App\Repositories\UserRepository; /** @@ -20,10 +21,11 @@ class LatestPilots extends Widget public function run() { $userRepo = app(UserRepository::class); + $userRepo = $userRepo->where('state', '!=', UserState::DELETED)->orderby('created_at', 'desc')->take($this->config['count'])->get(); return view('widgets.latest_pilots', [ 'config' => $this->config, - 'users' => $userRepo->with(['airline'])->recent($this->config['count']), + 'users' => $userRepo, ]); } }