diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 497e36a..1e5c764 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -10,10 +10,26 @@ class HomeController extends Controller { public function index() { - $newestFlight = Flight::latest()->take(10)->get(); - $flights=Flight::latest()->paginate(5); - $newestTour = Tour::latest()->take(10)->get(); + $newestFlight = Flight:: + where('departure_date', '>=', now()) + ->orderBy('departure_date', 'asc') + ->take(3) + ->get(); + $newestTour = Tour::latest() + ->take(10) + ->get(); - return view('home.index', compact('newestFlight','flights', 'newestTour')); + $flights = Flight::latest() + ->paginate(5); + + $tours = Tour::latest() + ->paginate(5); + + return view('home.index', compact( + 'newestFlight', + 'newestTour', + 'flights', + 'tours' + )); } } diff --git a/app/Http/Controllers/TourController.php b/app/Http/Controllers/TourController.php index 6b5f337..9a06251 100644 --- a/app/Http/Controllers/TourController.php +++ b/app/Http/Controllers/TourController.php @@ -6,19 +6,24 @@ use App\Models\Tour; class TourController extends Controller { - // صفحه لیست تورها: اسلایدر آخرینها + گرید صفحهبندیشده public function index() { - $newestTour = Tour::latest()->take(10)->get(); - $tours = Tour::latest()->paginate(9); + $newestTour = Tour::with('travelType') + ->latest() + ->take(10) + ->get(); + + $tours = Tour::with('travelType') + ->latest() + ->paginate(5); return view('tours.index', compact('newestTour', 'tours')); } - // جزئیات تور + شمارنده بازدید + public function show(Tour $tour) { - $tour->increment('views'); + $tour->load('travelType'); return view('tours.show', compact('tour')); } diff --git a/app/Models/City.php b/app/Models/City.php index 248cc83..f0cc7fc 100644 --- a/app/Models/City.php +++ b/app/Models/City.php @@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Model; * Class City * * @property int $id - * @property int $provinces + * @property int $province_id * @property string $name * @property Carbon $created_at * @property Carbon $updated_at @@ -33,7 +33,7 @@ class City extends Model ]; protected $fillable = [ - 'provinces', + 'province_id', 'name' ]; diff --git a/app/Models/Province.php b/app/Models/Province.php index 37e8455..3603111 100644 --- a/app/Models/Province.php +++ b/app/Models/Province.php @@ -34,7 +34,7 @@ class Province extends Model } public function cities() { - return $this->hasMany(City::class); + return $this->belongsTo(City::class); } } diff --git a/app/Models/Tour.php b/app/Models/Tour.php index 495f1d9..2e226ea 100644 --- a/app/Models/Tour.php +++ b/app/Models/Tour.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model; /** * Class Tour - * + * * @property int $id * @property string $title * @property string $summary @@ -24,7 +24,7 @@ use Illuminate\Database\Eloquent\Model; * @property int $status * @property Carbon $created_at * @property Carbon $updated_at - * + * * @property Collection|Comment[] $comments * * @package App\Models @@ -56,4 +56,8 @@ class Tour extends Model { return $this->hasMany(Comment::class); } -} + public function travelType() + { + return $this->belongsTo(TravelType::class); + } + } diff --git a/app/Models/TravelType.php b/app/Models/TravelType.php index 2adf351..e5fed5c 100644 --- a/app/Models/TravelType.php +++ b/app/Models/TravelType.php @@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Model; /** * Class TravelType - * + * * @property int $id * @property string $name * @property int $status @@ -33,4 +33,8 @@ class TravelType extends Model 'name', 'status' ]; -} + public function tours() + { + return $this->hasMany(Tour::class, 'travel_type_id'); + } + } diff --git a/composer.json b/composer.json index 91c2788..af831e2 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "license": "MIT", "require": { "php": "^8.2", + "hekmatinasser/verta": "^9.0", "laravel/framework": "^12.0", "laravel/tinker": "^2.10.1", "sadegh19b/laravel-persian-validation": "^2.1" diff --git a/composer.lock b/composer.lock index d7fad92..b341a2a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "32f38eafa73f2600bea6b75e538fc42e", + "content-hash": "d2f9c73ad216c4d120251d41cec0c1ee", "packages": [ { "name": "brick/math", @@ -1058,6 +1058,189 @@ ], "time": "2026-07-17T13:53:03+00:00" }, + { + "name": "hekmatinasser/jalali", + "version": "v8.2.4", + "source": { + "type": "git", + "url": "https://github.com/hekmatinasser/jalali.git", + "reference": "423c848ec32fb36e9ab9610d82f98efa2de0f79d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hekmatinasser/jalali/zipball/423c848ec32fb36e9ab9610d82f98efa2de0f79d", + "reference": "423c848ec32fb36e9ab9610d82f98efa2de0f79d", + "shasum": "" + }, + "require": { + "hekmatinasser/notowo": "^1.0", + "php": "^8.0" + }, + "require-dev": { + "orchestra/testbench": "^4.18|^5.20|^6.24|^7.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Hekmatinasser\\Jalali\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nasser Hekmati", + "email": "hekmati.nasser@gmail.com" + } + ], + "description": "This Package helps developers to work with Jalali Datetime class for PHP", + "keywords": [ + "Jalali", + "date", + "datetime", + "php", + "shamsi" + ], + "support": { + "issues": "https://github.com/hekmatinasser/jalali/issues", + "source": "https://github.com/hekmatinasser/jalali/tree/x8.2.3" + }, + "funding": [ + { + "url": "https://github.com/hekmatinasser", + "type": "github" + } + ], + "time": "2024-04-09T12:43:59+00:00" + }, + { + "name": "hekmatinasser/notowo", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/hekmatinasser/notowo.git", + "reference": "c51ad5dcedac966dd93ce558ac7e6a84e0020d6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hekmatinasser/notowo/zipball/c51ad5dcedac966dd93ce558ac7e6a84e0020d6d", + "reference": "c51ad5dcedac966dd93ce558ac7e6a84e0020d6d", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Hekmatinasser\\Notowo\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nasser Hekmati", + "email": "hekmati.nasser@gmail.com" + } + ], + "description": "This Package helps developers change number to word for all language on Laravel freamwork PHP", + "keywords": [ + "Notowo", + "laravel", + "n2w", + "number", + "word" + ], + "support": { + "issues": "https://github.com/hekmatinasser/notowo/issues", + "source": "https://github.com/hekmatinasser/notowo/tree/v1.0.1" + }, + "time": "2017-09-22T13:41:16+00:00" + }, + { + "name": "hekmatinasser/verta", + "version": "v9.0", + "source": { + "type": "git", + "url": "https://github.com/hekmatinasser/verta.git", + "reference": "f3cff537f07ef302b1ea24f59e9c1d5e3a1c36cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hekmatinasser/verta/zipball/f3cff537f07ef302b1ea24f59e9c1d5e3a1c36cb", + "reference": "f3cff537f07ef302b1ea24f59e9c1d5e3a1c36cb", + "shasum": "" + }, + "require": { + "hekmatinasser/jalali": "^8.2.3", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", + "illuminate/validation": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", + "php": "^8.0" + }, + "require-dev": { + "orchestra/testbench": "^6.23|^7.0|^8.0|^11.0" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "Verta": "Hekmatinasser\\Verta\\Verta" + }, + "providers": [ + "Hekmatinasser\\Verta\\Laravel\\VertaServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Hekmatinasser\\Verta\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nasser Hekmati", + "email": "hekmati.nasser@gmail.com" + } + ], + "description": "This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP", + "keywords": [ + "Jalali", + "Verta", + "date", + "datetime", + "laravel", + "shamsi" + ], + "support": { + "issues": "https://github.com/hekmatinasser/verta/issues", + "source": "https://github.com/hekmatinasser/verta/tree/v9.0" + }, + "funding": [ + { + "url": "https://github.com/hekmatinasser", + "type": "github" + } + ], + "time": "2026-05-08T06:26:09+00:00" + }, { "name": "laravel/framework", "version": "v12.65.0", diff --git a/public/assets/css/styles2.css.php b/public/assets/css/styles2.css.php index 35fbc37..e69de29 100644 --- a/public/assets/css/styles2.css.php +++ b/public/assets/css/styles2.css.php @@ -1,157 +0,0 @@ - diff --git a/resources/views/components/tour.blade.php b/resources/views/components/tour.blade.php index f243280..533b28d 100644 --- a/resources/views/components/tour.blade.php +++ b/resources/views/components/tour.blade.php @@ -1,43 +1,66 @@ -