diff --git a/app/Http/Controllers/CityController.php b/app/Http/Controllers/CityController.php index 67d37b5..339995a 100644 --- a/app/Http/Controllers/CityController.php +++ b/app/Http/Controllers/CityController.php @@ -3,11 +3,14 @@ namespace App\Http\Controllers; use App\Models\City; +use App\Models\Province; class CityController extends Controller { - public function byProvince($province) + public function byProvince( Province $province) { - return City::where('province_id', $province)->get(); + return response()->json( + $province->cities()->select('id', 'name')->get() + ); } } diff --git a/app/Models/Province.php b/app/Models/Province.php index 3603111..37e8455 100644 --- a/app/Models/Province.php +++ b/app/Models/Province.php @@ -34,7 +34,7 @@ class Province extends Model } public function cities() { - return $this->belongsTo(City::class); + return $this->hasMany(City::class); } } diff --git a/public/uploads/users/1787310773.jpg b/public/uploads/users/1787310773.jpg new file mode 100644 index 0000000..1c2daa2 Binary files /dev/null and b/public/uploads/users/1787310773.jpg differ diff --git a/public/uploads/users/1787372754.webp b/public/uploads/users/1787372754.webp new file mode 100644 index 0000000..53550ea Binary files /dev/null and b/public/uploads/users/1787372754.webp differ diff --git a/public/uploads/users/1787373663.webp b/public/uploads/users/1787373663.webp new file mode 100644 index 0000000..3789d37 Binary files /dev/null and b/public/uploads/users/1787373663.webp differ diff --git a/public/uploads/users/1787375691.jpg b/public/uploads/users/1787375691.jpg new file mode 100644 index 0000000..1c2daa2 Binary files /dev/null and b/public/uploads/users/1787375691.jpg differ diff --git a/resources/views/account/layout/app.blade.php b/resources/views/account/layout/app.blade.php index b83ab3c..573c749 100644 --- a/resources/views/account/layout/app.blade.php +++ b/resources/views/account/layout/app.blade.php @@ -20,7 +20,7 @@

-

+ {{Auth::user()->email}} diff --git a/resources/views/account/users/comments/index.blade.php b/resources/views/account/users/comments/index.blade.php index 031976b..46c27b9 100644 --- a/resources/views/account/users/comments/index.blade.php +++ b/resources/views/account/users/comments/index.blade.php @@ -34,7 +34,13 @@

- {{ $comment->tour->title ?? 'مورد حذف شده' }} + @if($comment->tour_id) + {{ $comment->tour->title ?? 'مورد حذف شده' }} + @elseif($comment->flight_id) + {{ $comment->flight->airline ?? 'مورد حذف شده' }} + @else + مورد حذف شده + @endif

{{ $comment->created_at->format('Y/m/d') }} diff --git a/resources/views/account/users/favorite/index.blade.php b/resources/views/account/users/favorite/index.blade.php index a4b6003..dbd65db 100644 --- a/resources/views/account/users/favorite/index.blade.php +++ b/resources/views/account/users/favorite/index.blade.php @@ -35,7 +35,11 @@ @if($favorite->favoritable_type == 'App\Models\Tour')

- {{ $favorite->favoritable?->title ?? 'مورد حذف شده' }}

+ {{ $favorite->favoritable?->title ?? 'مورد حذف شده' }} + +

+ {{ $favorite->favoritable?->summary ?? 'مورد حذف شده' }} +

تور @@ -44,7 +48,10 @@ @elseif($favorite->favoritable_type == 'App\Models\Flight')

- {{ $favorite->favoritable->name }} + {{ $favorite->favoritable->airline }} +

+

+ {{ $favorite->favoritable->flight_number }}

diff --git a/resources/views/account/users/profile/edit.blade.php b/resources/views/account/users/profile/edit.blade.php index 5035567..5230895 100644 --- a/resources/views/account/users/profile/edit.blade.php +++ b/resources/views/account/users/profile/edit.blade.php @@ -632,9 +632,8 @@ .append(''); $.ajax({ - url: "{{ route('users.cities.province', ':province') }}" + url: "{{ route('cities.province', ':province') }}" .replace(':province', provinceId), - type: 'GET', success: function (cities) { @@ -660,13 +659,9 @@ }, error: function () { - citySelect.empty(); - - citySelect.append( - '' - ); - + citySelect.append(''); + citySelect.prop('disabled', false); } }); diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 9044ec7..8478520 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -570,5 +570,42 @@

+ @endsection diff --git a/resources/views/flights/show.blade.php b/resources/views/flights/show.blade.php index 3e1cad0..092773f 100644 --- a/resources/views/flights/show.blade.php +++ b/resources/views/flights/show.blade.php @@ -166,7 +166,7 @@
- {{ $comment->user->name }} + {{ $comment->user ? $comment->user->first_name . ' ' . $comment->user->last_name : 'کاربر مهمان' }} diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 5e1822c..9563a33 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -15,31 +15,35 @@ - -@includeUnless(isset($withoutHeader),'layouts.header') -@includeUnless(isset($withoutHero),'layouts.hero') + + @includeUnless(isset($withoutHeader),'layouts.header') + @includeUnless(isset($withoutHero),'layouts.hero') @yield('content') -@includeUnless(isset($withoutFooter),'layouts.footer') - - - - - - - - - - - - - - - - - - - - + @includeUnless(isset($withoutFooter),'layouts.footer') - - + + + + + + + + + + + + + + + + + + + + + + + @stack('scripts') + + + diff --git a/resources/views/tours/index.blade.php b/resources/views/tours/index.blade.php index b631273..014ed85 100644 --- a/resources/views/tours/index.blade.php +++ b/resources/views/tours/index.blade.php @@ -1,4 +1,4 @@ - @extends('layouts.app') +@extends('layouts.app') @section('content') @@ -21,7 +21,7 @@
-
+
- تور - + تور +
-
+
{{ $tour->title }} @@ -61,14 +61,6 @@ - - - برگشت - -
@@ -81,10 +73,18 @@
+ -
+
- {{ $tours->links() }} + {{$tours->links()}}
diff --git a/resources/views/tours/show.blade.php b/resources/views/tours/show.blade.php index 0a5fd45..1cf4d3d 100644 --- a/resources/views/tours/show.blade.php +++ b/resources/views/tours/show.blade.php @@ -199,9 +199,9 @@
- - {{ $comment->user?->name ?? 'کاربر مهمان' }} - + + {{ $comment->user ? $comment->user->first_name . ' ' . $comment->user->last_name : 'کاربر مهمان' }} + diff --git a/routes/web.php b/routes/web.php index a462f2d..412630d 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,6 +23,8 @@ Route::get('/tours/{tour}', [TourController::class, 'show'])->name('tours.show') Route::get('/comments',[CommentController::class,'index'])->name('comments.index'); Route::post('/comments',[CommentController::class,'store'])->name('comments.store'); +Route::get('/cities/{province}', [CityController::class, 'byProvince'])->name('cities.province'); + Route::prefix('users')->name('users.')->middleware('auth:web')->group(function (){ Route::get('/',[DashboardController::class,'index'])->name('dashboard'); @@ -37,9 +39,6 @@ Route::prefix('users')->name('users.')->middleware('auth:web')->group(function ( Route::delete('/favorite/{favorite}',[FavoriteController::class,'destroy'])->name('favorite.destroy'); - Route::get('/cities/{province}', [CityController::class, 'byProvince'])->name('cities.province'); - - Route::get('/reservations', [ReservationController::class, 'index'])->name('reservations.index'); Route::post('/reservations', [ReservationController::class, 'store'])->name('reservations.store');