diff --git a/app/Http/Controllers/Admin/DealController.php b/app/Http/Controllers/Admin/DealController.php index 7ac9c00..261af71 100644 --- a/app/Http/Controllers/Admin/DealController.php +++ b/app/Http/Controllers/Admin/DealController.php @@ -11,7 +11,8 @@ class DealController extends Controller public function index() { return view('dashboards.admin.deals.index') - ->with('deals', $this->deals()); + ->with('pendingDeals', $this->pendingDeals()) + ->with('activeDeals', $this->activeDeals()); } public function approve(Deal $deal) @@ -30,7 +31,8 @@ public function approve(Deal $deal) } } - public function reject(Deal $deal){ + public function reject(Deal $deal) + { try { $deal->delete(); @@ -42,8 +44,13 @@ public function reject(Deal $deal){ } } - private function deals() + private function pendingDeals() { return Deal::where('active', false)->get(); } + + private function activeDeals() + { + return Deal::where('active', true)->get(); + } } diff --git a/app/Models/Admin.php b/app/Models/Admin.php index ecd4923..0ff2a5b 100644 --- a/app/Models/Admin.php +++ b/app/Models/Admin.php @@ -10,12 +10,14 @@ * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \App\Models\User|null $user + * * @method static \Illuminate\Database\Eloquent\Builder|Admin newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Admin newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Admin query() * @method static \Illuminate\Database\Eloquent\Builder|Admin whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Admin whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|Admin whereUpdatedAt($value) + * * @mixin \Eloquent */ class Admin extends Model diff --git a/app/Models/Broker.php b/app/Models/Broker.php index 6ecdc41..402e2dc 100644 --- a/app/Models/Broker.php +++ b/app/Models/Broker.php @@ -14,6 +14,7 @@ * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \App\Models\User|null $user + * * @method static \Illuminate\Database\Eloquent\Builder|Broker newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Broker newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Broker query() @@ -24,6 +25,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|Broker wherePhone($value) * @method static \Illuminate\Database\Eloquent\Builder|Broker whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Broker whereVerified($value) + * * @mixin \Eloquent */ class Broker extends Model diff --git a/app/Models/Customer.php b/app/Models/Customer.php index 05d834d..08834d0 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -13,6 +13,7 @@ * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \App\Models\User|null $user + * * @method static \Illuminate\Database\Eloquent\Builder|Customer newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Customer newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Customer query() @@ -22,6 +23,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|Customer whereLocation($value) * @method static \Illuminate\Database\Eloquent\Builder|Customer wherePhone($value) * @method static \Illuminate\Database\Eloquent\Builder|Customer whereUpdatedAt($value) + * * @mixin \Eloquent */ class Customer extends Model diff --git a/app/Models/Deal.php b/app/Models/Deal.php index e9000d1..424ab55 100644 --- a/app/Models/Deal.php +++ b/app/Models/Deal.php @@ -29,6 +29,7 @@ * @property-read int|null $interactions_count * @property-read \Illuminate\Database\Eloquent\Collection $reports * @property-read int|null $reports_count + * * @method static Builder|Deal WithActiveDeals() * @method static Builder|Deal WithCurrentUserInteractions() * @method static Builder|Deal WithLikePerDeal() @@ -50,6 +51,7 @@ * @method static Builder|Deal whereUpdatedAt($value) * @method static Builder|Deal whereUserId($value) * @method static Builder|Deal withViewPerDeal() + * * @mixin \Eloquent */ class Deal extends Model diff --git a/app/Models/DealCategory.php b/app/Models/DealCategory.php index 51f8c20..84ae779 100644 --- a/app/Models/DealCategory.php +++ b/app/Models/DealCategory.php @@ -16,6 +16,7 @@ * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \Illuminate\Database\Eloquent\Collection $deals * @property-read int|null $deals_count + * * @method static \Illuminate\Database\Eloquent\Builder|DealCategory newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|DealCategory newQuery() * @method static \Illuminate\Database\Eloquent\Builder|DealCategory query() @@ -27,10 +28,13 @@ * @method static \Illuminate\Database\Eloquent\Builder|DealCategory whereOrder($value) * @method static \Illuminate\Database\Eloquent\Builder|DealCategory whereSlug($value) * @method static \Illuminate\Database\Eloquent\Builder|DealCategory whereUpdatedAt($value) + * * @mixin \Eloquent */ class DealCategory extends Model { + protected $fillable = ['name', 'description', 'slug', 'active', 'order']; + public function deals(): HasMany { return $this->hasMany(Deal::class); diff --git a/app/Models/Interaction.php b/app/Models/Interaction.php index aa1f556..a6f2761 100644 --- a/app/Models/Interaction.php +++ b/app/Models/Interaction.php @@ -16,6 +16,7 @@ * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \App\Models\Deal|null $deal * @property-read \App\Models\Deal|null $user + * * @method static \Illuminate\Database\Eloquent\Builder|Interaction newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Interaction newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Interaction query() @@ -26,6 +27,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|Interaction whereType($value) * @method static \Illuminate\Database\Eloquent\Builder|Interaction whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Interaction whereUserId($value) + * * @mixin \Eloquent */ class Interaction extends Model diff --git a/app/Models/RecentSearch.php b/app/Models/RecentSearch.php index 52f7c4d..47dd8f6 100644 --- a/app/Models/RecentSearch.php +++ b/app/Models/RecentSearch.php @@ -12,6 +12,7 @@ * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property-read \App\Models\User|null $user + * * @method static \Illuminate\Database\Eloquent\Builder|RecentSearch newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|RecentSearch newQuery() * @method static \Illuminate\Database\Eloquent\Builder|RecentSearch query() @@ -20,6 +21,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|RecentSearch whereQuery($value) * @method static \Illuminate\Database\Eloquent\Builder|RecentSearch whereUpdatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|RecentSearch whereUserId($value) + * * @mixin \Eloquent */ class RecentSearch extends Model diff --git a/app/Models/Report.php b/app/Models/Report.php index 30839f8..da3d57f 100644 --- a/app/Models/Report.php +++ b/app/Models/Report.php @@ -21,6 +21,7 @@ * @property-read \Illuminate\Database\Eloquent\Collection $deals * @property-read int|null $deals_count * @property-read \App\Models\User|null $user + * * @method static Builder|Report newModelQuery() * @method static Builder|Report newQuery() * @method static Builder|Report orderByStatus(array $statusOrder) @@ -32,6 +33,7 @@ * @method static Builder|Report whereType($value) * @method static Builder|Report whereUpdatedAt($value) * @method static Builder|Report whereUserId($value) + * * @mixin \Eloquent */ class Report extends Model diff --git a/app/Models/User.php b/app/Models/User.php index f36505e..814e40c 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -39,6 +39,7 @@ * @property-read \Illuminate\Database\Eloquent\Collection $reports * @property-read int|null $reports_count * @property-read Model|\Eloquent|null $type + * * @method static \Database\Factories\UserFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|User newQuery() @@ -55,6 +56,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|User whereRoleType($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereStatus($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value) + * * @mixin \Eloquent */ class User extends Authenticatable diff --git a/composer.lock b/composer.lock index 7c978c7..cd7dd6e 100644 --- a/composer.lock +++ b/composer.lock @@ -3996,16 +3996,16 @@ }, { "name": "symfony/finder", - "version": "v7.4.4", + "version": "v7.4.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "01b24a145bbeaa7141e75887ec904c34a6728a5f" + "reference": "ad4daa7c38668dcb031e63bc99ea9bd42196a2cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/01b24a145bbeaa7141e75887ec904c34a6728a5f", - "reference": "01b24a145bbeaa7141e75887ec904c34a6728a5f", + "url": "https://api.github.com/repos/symfony/finder/zipball/ad4daa7c38668dcb031e63bc99ea9bd42196a2cb", + "reference": "ad4daa7c38668dcb031e63bc99ea9bd42196a2cb", "shasum": "" }, "require": { @@ -4040,7 +4040,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.4" + "source": "https://github.com/symfony/finder/tree/v7.4.5" }, "funding": [ { @@ -4060,20 +4060,20 @@ "type": "tidelift" } ], - "time": "2026-01-12T12:19:02+00:00" + "time": "2026-01-26T15:07:59+00:00" }, { "name": "symfony/http-foundation", - "version": "v7.4.4", + "version": "v7.4.5", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "977a554a34cf8edc95ca351fbecb1bb1ad05cc94" + "reference": "446d0db2b1f21575f1284b74533e425096abdfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/977a554a34cf8edc95ca351fbecb1bb1ad05cc94", - "reference": "977a554a34cf8edc95ca351fbecb1bb1ad05cc94", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/446d0db2b1f21575f1284b74533e425096abdfb6", + "reference": "446d0db2b1f21575f1284b74533e425096abdfb6", "shasum": "" }, "require": { @@ -4122,7 +4122,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.4" + "source": "https://github.com/symfony/http-foundation/tree/v7.4.5" }, "funding": [ { @@ -4142,20 +4142,20 @@ "type": "tidelift" } ], - "time": "2026-01-09T12:14:21+00:00" + "time": "2026-01-27T16:16:02+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.4.4", + "version": "v7.4.5", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "48b067768859f7b68acf41dfb857a5a4be00acdd" + "reference": "229eda477017f92bd2ce7615d06222ec0c19e82a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/48b067768859f7b68acf41dfb857a5a4be00acdd", - "reference": "48b067768859f7b68acf41dfb857a5a4be00acdd", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/229eda477017f92bd2ce7615d06222ec0c19e82a", + "reference": "229eda477017f92bd2ce7615d06222ec0c19e82a", "shasum": "" }, "require": { @@ -4241,7 +4241,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.4" + "source": "https://github.com/symfony/http-kernel/tree/v7.4.5" }, "funding": [ { @@ -4261,7 +4261,7 @@ "type": "tidelift" } ], - "time": "2026-01-24T22:13:01+00:00" + "time": "2026-01-28T10:33:42+00:00" }, { "name": "symfony/mailer", @@ -4349,16 +4349,16 @@ }, { "name": "symfony/mime", - "version": "v7.4.4", + "version": "v7.4.5", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "40945014c0a9471ccfe19673c54738fa19367a3c" + "reference": "b18c7e6e9eee1e19958138df10412f3c4c316148" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/40945014c0a9471ccfe19673c54738fa19367a3c", - "reference": "40945014c0a9471ccfe19673c54738fa19367a3c", + "url": "https://api.github.com/repos/symfony/mime/zipball/b18c7e6e9eee1e19958138df10412f3c4c316148", + "reference": "b18c7e6e9eee1e19958138df10412f3c4c316148", "shasum": "" }, "require": { @@ -4369,15 +4369,15 @@ }, "conflict": { "egulias/email-validator": "~3.0.0", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", + "phpdocumentor/reflection-docblock": "<5.2|>=6", + "phpdocumentor/type-resolver": "<1.5.1", "symfony/mailer": "<6.4", "symfony/serializer": "<6.4.3|>7.0,<7.0.3" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", "league/html-to-markdown": "^5.0", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "phpdocumentor/reflection-docblock": "^5.2", "symfony/dependency-injection": "^6.4|^7.0|^8.0", "symfony/process": "^6.4|^7.0|^8.0", "symfony/property-access": "^6.4|^7.0|^8.0", @@ -4414,7 +4414,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.4.4" + "source": "https://github.com/symfony/mime/tree/v7.4.5" }, "funding": [ { @@ -4434,7 +4434,7 @@ "type": "tidelift" } ], - "time": "2026-01-08T16:12:55+00:00" + "time": "2026-01-27T08:59:58+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5267,16 +5267,16 @@ }, { "name": "symfony/process", - "version": "v7.4.4", + "version": "v7.4.5", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "626f07a53f4b4e2f00e11824cc29f928d797783b" + "reference": "608476f4604102976d687c483ac63a79ba18cc97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/626f07a53f4b4e2f00e11824cc29f928d797783b", - "reference": "626f07a53f4b4e2f00e11824cc29f928d797783b", + "url": "https://api.github.com/repos/symfony/process/zipball/608476f4604102976d687c483ac63a79ba18cc97", + "reference": "608476f4604102976d687c483ac63a79ba18cc97", "shasum": "" }, "require": { @@ -5308,7 +5308,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.4" + "source": "https://github.com/symfony/process/tree/v7.4.5" }, "funding": [ { @@ -5328,7 +5328,7 @@ "type": "tidelift" } ], - "time": "2026-01-20T09:23:51+00:00" + "time": "2026-01-26T15:07:59+00:00" }, { "name": "symfony/routing", diff --git a/database/seeders/CategorySeeder.php b/database/seeders/CategorySeeder.php new file mode 100644 index 0000000..329d74f --- /dev/null +++ b/database/seeders/CategorySeeder.php @@ -0,0 +1,22 @@ + $categories + */ + $categories = [ + ['name' => 'Food', 'description' => 'Share Food related deals', 'slug' => 'food', 'active' => true, 'order' => 1], + ['name' => 'Real Estate', 'description' => 'Share Real Estate related deals', 'slug' => 'real-estate', 'active' => true, 'order' => 2], + ['name' => 'Sell & Deal', 'description' => 'Sell your services', 'slug' => 'sell-and-deal', 'active' => true, 'order' => 3], + ]; + DealCategory::insert($categories); + } +} diff --git a/resources/js/app.js b/resources/js/app.js index 004619b..fa41793 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,5 +1,4 @@ import './bootstrap'; -import {setSidebarState} from '@/sidebar.js'; import "./alert.js" import "./image-input.js" import "./menu.js" @@ -7,11 +6,13 @@ import "./modal.js" import "./sidebar.js" import "./toast.js" import "./deal-view-modal.js" +import {setSidebarState} from './sidebar.js'; import {favorite, like, redirect} from "./interaction.js"; import {showReportModal} from "./report-deal.js"; import {initTabs} from "./tab.js"; import {loadModalFromQuery} from "./explore-page.js"; import {deleteRecentSearch} from "./deleteRecentSearch.js"; +import {initNavMenu} from "./nav-menu.js"; document.deleteSearch = deleteRecentSearch; document.like = like; @@ -37,7 +38,7 @@ window.addEventListener('load', async () => { setSidebarState(savedState); } + initNavMenu(); initTabs(); - await loadModalFromQuery(); }); diff --git a/resources/js/nav-menu.js b/resources/js/nav-menu.js index c41bc3e..992c13a 100644 --- a/resources/js/nav-menu.js +++ b/resources/js/nav-menu.js @@ -1,20 +1,22 @@ -const openBtn = document.getElementById('openBtn'); -const closeBtn = document.getElementById('closeBtn'); -const mobileMenu = document.getElementById('mobileMenu'); -const body = document.body; +export function initNavMenu() { + const openBtn = document.getElementById('openBtn'); + const closeBtn = document.getElementById('closeBtn'); + const mobileMenu = document.getElementById('mobileMenu'); + const body = document.body; -if (openBtn) { - openBtn.addEventListener('click', () => { - mobileMenu.classList.remove('translate-x-full'); - mobileMenu.classList.add('translate-x-0'); - body.style.overflow = 'hidden'; - }) -} + if (openBtn) { + openBtn.addEventListener('click', () => { + mobileMenu.classList.remove('translate-x-full'); + mobileMenu.classList.add('translate-x-0'); + body.style.overflow = 'hidden'; + }) + } -if (closeBtn) { - closeBtn.addEventListener('click', () => { - mobileMenu.classList.add('translate-x-full'); - mobileMenu.classList.remove('translate-x-0'); - body.style.overflow = 'visible'; - }) + if (closeBtn) { + closeBtn.addEventListener('click', () => { + mobileMenu.classList.add('translate-x-full'); + mobileMenu.classList.remove('translate-x-0'); + body.style.overflow = 'visible'; + }) + } } diff --git a/resources/views/components/dashboard/admin/active-broker.blade.php b/resources/views/components/dashboard/admin/active-broker.blade.php index defa86e..d82f638 100644 --- a/resources/views/components/dashboard/admin/active-broker.blade.php +++ b/resources/views/components/dashboard/admin/active-broker.blade.php @@ -37,7 +37,7 @@ class=" h-full items-center flex justify-center"> @empty - No Broker found + No broker found @endforelse diff --git a/resources/views/components/dashboard/admin/all-deals.blade.php b/resources/views/components/dashboard/admin/all-deals.blade.php new file mode 100644 index 0000000..a6fb9ff --- /dev/null +++ b/resources/views/components/dashboard/admin/all-deals.blade.php @@ -0,0 +1,52 @@ +@props(['deals' => []]) + +

Approved deals

+ + + Title + Description + Link + Category + Broker + + + @forelse($deals as $deal) + + {{ucfirst($deal->title)}} + {{$deal->description}} + {{$deal->link}} + {{$deal->category->name}} + {{$deal->broker->name}} +{{-- --}} +{{--
--}} +{{--
--}} +{{-- @csrf--}} +{{-- --}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{--
--}} +{{-- @csrf--}} +{{-- --}} +{{-- --}} +{{-- --}} +{{--
--}} + +{{-- --}} +{{-- --}} +{{-- --}} +{{--
--}} +{{--
--}} +
+ @empty + + No deals found + + @endforelse +
+
diff --git a/resources/views/components/dashboard/admin/broker-approval.blade.php b/resources/views/components/dashboard/admin/broker-approval.blade.php index 8c571c7..0a154bd 100644 --- a/resources/views/components/dashboard/admin/broker-approval.blade.php +++ b/resources/views/components/dashboard/admin/broker-approval.blade.php @@ -42,7 +42,7 @@ class=" h-full items-center flex justify-center"> @empty - No Broker found + No broker found @endforelse diff --git a/resources/views/components/dashboard/admin/pending-deals.blade.php b/resources/views/components/dashboard/admin/pending-deals.blade.php new file mode 100644 index 0000000..b169b41 --- /dev/null +++ b/resources/views/components/dashboard/admin/pending-deals.blade.php @@ -0,0 +1,52 @@ +@props(['deals' => []]) + +

Pending deals

+ + + Title + Description + Link + Category + Broker + + + @forelse($deals as $deal) + + {{ucfirst($deal->title)}} + {{$deal->description}} + {{$deal->link}} + {{$deal->category->name}} + {{$deal->broker->name}} + +
+
+ @csrf + + + +
+ +
+ @csrf + + + +
+ + + + +
+
+
+ @empty + + No deals found + + @endforelse +
+
diff --git a/resources/views/components/dashboard/admin/sidebar.blade.php b/resources/views/components/dashboard/admin/sidebar.blade.php index 98186d1..0270598 100644 --- a/resources/views/components/dashboard/admin/sidebar.blade.php +++ b/resources/views/components/dashboard/admin/sidebar.blade.php @@ -1,44 +1,45 @@ @props(['activeClass' => 'bg-gray-100 text-gray-900'])
merge([ 'class' => 'border-r border-r-gray-300 transition-all duration-300 ease-in-out w-64 relative'])}}> + id="sidebarWrapper" {{$attributes->merge([ 'class' => 'border-r border-r-gray-300 group transition-all duration-300 ease-in-out w-64 relative'])}}>