๐ธ ๋ก์ปฌ ๊ณต์ฐ์ฅ ์๊ฐ ๋ผ์ธ์ ์บ๋ฆฐ๋ - ๊ณต์ฐ ์ผ์ & ํฐ์ผ ์ ๋ณด ํ๋์
local-venue-monthly-lineup
๋ฌธ์ ์ค๋ช
๐ฏ ํ๋ก์ ํธ ๊ฐ์
์๊ท๋ชจ ๋ผ์ด๋ธ ๊ณต์ฐ์ฅ, ์ฌ์ฆ๋ฐ, ์ธ๋ ํด๋ฝ์ ์ํ ์๊ฐ ๊ณต์ฐ ๋ผ์ธ์ ์บ๋ฆฐ๋๋ฅผ ๋ง๋ญ๋๋ค. ๋ฐฉ๋ฌธ์๋ค์ด ์ด๋ฒ ๋ฌ ์ด๋ค ๊ณต์ฐ์ด ์ด๋ฆฌ๋์ง ํ๋์ ํ์ธํ๊ณ , ๊ฐ ๊ณต์ฐ์ ์์ธ ์ ๋ณด(์ํฐ์คํธ, ์ฅ๋ฅด, ํฐ์ผ ๊ฐ๊ฒฉ, ์๋งค ๋งํฌ)๋ฅผ ๋ณผ ์ ์์ต๋๋ค.
๊ด๋ฆฌ์๋ ๊ฐ๋จํ ํผ์ผ๋ก ๊ณต์ฐ ์ ๋ณด๋ฅผ ๋ฑ๋กํ๊ณ , ๋ฌ๋ ฅ ํํ๋ก ์๋ ๋ฐฐ์น๋ฉ๋๋ค. ๋ฐฉ๋ฌธ์๋ ๋ ์ง๋ณ๋ก ๊ณต์ฐ์ ํ์ํ๊ณ , ๊ด์ฌ ๊ณต์ฐ์ ํด๋ฆญํ๋ฉด ์์ธ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
โ ํ์ ๊ธฐ๋ฅ
- ์๊ฐ ๋ฌ๋ ฅ ๋ทฐ: ์ด๋ฒ ๋ฌ ๊ณต์ฐ ์ผ์ ์ ๋ฌ๋ ฅ ํํ๋ก ํ์ (๋ ์ง๋ณ ๊ณต์ฐ ์นด๋)
- ๊ณต์ฐ ๋ฑ๋ก ํผ: ๊ณต์ฐ๋ช , ์ํฐ์คํธ๋ช , ์ฅ๋ฅด, ๋ ์ง, ์๊ฐ, ํฐ์ผ ๊ฐ๊ฒฉ, ์๋งค ๋งํฌ ์ ๋ ฅ
- ๊ณต์ฐ ์์ธ ํ์ด์ง: ํด๋ฆญ ์ ๊ณต์ฐ ์ ๋ณด ์์ธ ๋ณด๊ธฐ (์ํฐ์คํธ ์๊ฐ, ํฐ์ผ ์ ๋ณด)
- ์ฅ๋ฅด๋ณ ํํฐ๋ง: ์ฌ์ฆ/๋ก/์ธ๋/์ผ๋ ํธ๋ก๋ ๋ฑ ์ฅ๋ฅด ์ ํ ์ ํด๋น ๊ณต์ฐ๋ง ํ์
- ๋ฐ์ํ ๋์์ธ: ๋ชจ๋ฐ์ผ์์๋ ๋ฌ๋ ฅ์ด ๊น๋ํ๊ฒ ๋ณด์ด๋๋ก
๐ ๋ณด๋์ค ๊ธฐ๋ฅ
- ์ง๋ ๊ณต์ฐ์ ํ์ ์ฒ๋ฆฌ (๊ณผ๊ฑฐ ๋ ์ง ๊ตฌ๋ถ)
- ๊ณต์ฐ ํฌ์คํฐ ์ด๋ฏธ์ง ์ ๋ก๋ (์ต์ )
- "์ค๋์ ๊ณต์ฐ" ๋ฐฐ์ง ํ์
- ๋ค์ ๋ฌ/์ด์ ๋ฌ ๋ค๋น๊ฒ์ด์
- ๊ณต์ฐ๋ณ "๊ด์ฌ ์์ด์" ์นด์ดํฐ (์ข์์ ๊ธฐ๋ฅ)
๐จ ๋์์ธ ํฌ์ธํธ
- Tailwind CSS๋ก ๋คํฌ ๋ชจ๋ ์์ ํด๋ฝ ๋ถ์๊ธฐ ์ฐ์ถ
- ๋ฌ๋ ฅ ๊ทธ๋ฆฌ๋๋ 7์ด(์์ผ) x 5~6ํ(์ฃผ์ฐจ)
- ๊ณต์ฐ ์นด๋๋ hover ์ ํ๋ ์ ๋๋ฉ์ด์
- ์ฅ๋ฅด๋ณ ์์ ์ฝ๋ฉ (์ฌ์ฆ=ํ๋์, ๋ก=๋นจ๊ฐ์ ๋ฑ)
๐ ๏ธ ๊ธฐ์ ์คํ
- Laravel 13.x (Blade ํ ํ๋ฆฟ)
- SQLite ๋ฐ์ดํฐ๋ฒ ์ด์ค
- Tailwind CSS
- Alpine.js (๊ฐ๋จํ ์ธํฐ๋์ ์ฉ, ์ต์ )
์ ์ฝ ์กฐ๊ฑด
- โข Laravel 13.x + Blade ํ ํ๋ฆฟ ์ฌ์ฉ (React/Vue ๊ธ์ง)
- โข SQLite ๋ฐ์ดํฐ๋ฒ ์ด์ค ์ฌ์ฉ (๊ฐ๋จํ ์ค์ )
- โข Tailwind CSS๋ก ์คํ์ผ๋ง
- โข ๊ณต์ฐ CRUD ๊ธฐ๋ฅ ๊ตฌํ (Create, Read, Update, Delete)
- โข ๋ฌ๋ ฅ ๋ทฐ๋ PHP Carbon ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ๋ ์ง ๊ณ์ฐ
- โข ์ ๋ฌธ์๋ ๋ฐ๋ผํ ์ ์๋๋ก ๋จ๊ณ๋ณ ๋ช ํํ ํ๋กฌํํธ ์ ๊ณต
- โข ํ์ผ ์ ๋ก๋๋ ์ ํ์ฌํญ (๊ธฐ๋ณธ์ ํ ์คํธ ์ ๋ณด๋ง)
- โข ์ต์ 3๊ฐ ์ด์์ ๊ณต์ฐ ์ํ ๋ฐ์ดํฐ ์๋ฉ
ํ๋กฌํํธ ๋ ์ํผ
์๋ ํ๋กฌํํธ๋ฅผ ์์๋๋ก AI์๊ฒ ๋ณด๋ด๋ฉด ๋ฉ๋๋ค. ๋ณต์ฌ ๋ฒํผ์ ๋๋ฌ ๋ฐ๋ก ์ฌ์ฉํ์ธ์.
mkdir local-venue-monthly-lineup && cd local-venue-monthly-lineup ์ด ํด๋์์ Laravel 13.x ํ๋ก์ ํธ๋ฅผ ์์ํฉ๋๋ค. # ํ๋ก์ ํธ ์ด๊ธฐ ์ค์ 1. Laravel 13.x ํ๋ก์ ํธ ์์ฑ: ```bash composer create-project laravel/laravel . ``` 2. `.env` ํ์ผ ์ค์ : - `DB_CONNECTION=sqlite` ๋ก ๋ณ๊ฒฝ - `DB_DATABASE=database/database.sqlite` ์ค์ - `APP_NAME="Local Venue Lineup"` ์ค์ 3. SQLite ๋ฐ์ดํฐ๋ฒ ์ด์ค ํ์ผ ์์ฑ: ```bash touch database/database.sqlite ``` 4. Tailwind CSS ์ค์น ๋ฐ ์ค์ : ```bash npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p ``` 5. `tailwind.config.js` ์์ : ```js content: [ "./resources/**/*.blade.php", "./resources/**/*.js", ], ``` 6. `resources/css/app.css`์ Tailwind ๋๋ ํฐ๋ธ ์ถ๊ฐ: ```css @tailwind base; @tailwind components; @tailwind utilities; ``` 7. `vite.config.js` ํ์ธ (Laravel 13 ๊ธฐ๋ณธ ์ค์ ์ ์ง) 8. ๊ฐ๋ฐ ์๋ฒ ์คํ: ```bash npm install npm run dev # ์ ํฐ๋ฏธ๋์์ php artisan serve ``` ์๋ฃ ํ `http://localhost:8000` ์ ์ํ์ฌ Laravel ๊ธฐ๋ณธ ํ์ด์ง ํ์ธ.
๊ธฐ๋ ๊ฒฐ๊ณผ: Laravel 13.x ํ๋ก์ ํธ๊ฐ ์์ฑ๋๊ณ , SQLite ๋ฐ์ดํฐ๋ฒ ์ด์ค์ Tailwind CSS๊ฐ ์ค์ ๋ฉ๋๋ค. ๊ฐ๋ฐ ์๋ฒ๊ฐ ์ ์ ์๋ํ๋ฉฐ ๊ธฐ๋ณธ Laravel ํ๋ฉด์ด ๋ณด์ ๋๋ค.
# ๊ณต์ฐ(Show) ๋ชจ๋ธ ๋ฐ ๋ง์ด๊ทธ๋ ์ด์
์์ฑ
1. ๊ณต์ฐ ๋ชจ๋ธ๊ณผ ๋ง์ด๊ทธ๋ ์ด์
ํ์ผ ์์ฑ:
```bash
php artisan make:model Show -m
```
2. `database/migrations/xxxx_create_shows_table.php` ํ์ผ ์์ :
```php
public function up()
{
Schema::create('shows', function (Blueprint $table) {
$table->id();
$table->string('title'); // ๊ณต์ฐ๋ช
$table->string('artist'); // ์ํฐ์คํธ๋ช
$table->string('genre'); // ์ฅ๋ฅด (jazz, rock, indie, electronic ๋ฑ)
$table->date('show_date'); // ๊ณต์ฐ ๋ ์ง
$table->time('show_time'); // ๊ณต์ฐ ์๊ฐ
$table->integer('ticket_price'); // ํฐ์ผ ๊ฐ๊ฒฉ (์)
$table->string('ticket_link')->nullable(); // ์๋งค ๋งํฌ (์ ํ)
$table->text('description')->nullable(); // ๊ณต์ฐ ์ค๋ช
(์ ํ)
$table->string('poster_image')->nullable(); // ํฌ์คํฐ ์ด๋ฏธ์ง ๊ฒฝ๋ก (์ ํ)
$table->integer('likes')->default(0); // ์ข์์ ์นด์ดํฐ
$table->timestamps();
});
}
```
3. ๋ง์ด๊ทธ๋ ์ด์
์คํ:
```bash
php artisan migrate
```
4. `app/Models/Show.php` ํ์ผ์ fillable ์์ฑ ์ถ๊ฐ:
```php
protected $fillable = [
'title',
'artist',
'genre',
'show_date',
'show_time',
'ticket_price',
'ticket_link',
'description',
'poster_image',
'likes',
];
protected $casts = [
'show_date' => 'date',
'show_time' => 'datetime',
];
```
์๋ฃ ํ `php artisan migrate:status`๋ก ๋ง์ด๊ทธ๋ ์ด์
ํ์ธ.
๊ธฐ๋ ๊ฒฐ๊ณผ: shows ํ ์ด๋ธ์ด ์์ฑ๋๊ณ , Show ๋ชจ๋ธ์ ํ์ํ ํ๋๊ฐ ์ ์๋ฉ๋๋ค. ๋ฐ์ดํฐ๋ฒ ์ด์ค ์คํค๋ง๊ฐ ์ค๋น๋ฉ๋๋ค.
# ์ํ ๋ฐ์ดํฐ ์๋ฉ ๋ฐ ์ปจํธ๋กค๋ฌ ์์ฑ
1. Seeder ํ์ผ ์์ฑ:
```bash
php artisan make:seeder ShowSeeder
```
2. `database/seeders/ShowSeeder.php` ํ์ผ ์์ :
```php
use App\Models\Show;
use Carbon\Carbon;
public function run()
{
$shows = [
[
'title' => '์ฌ์ฆ ๋์ดํธ with ๋ธ๋ฃจ๋ฌธ ํธ๋ฆฌ์ค',
'artist' => 'Blue Moon Trio',
'genre' => 'jazz',
'show_date' => Carbon::now()->addDays(5)->toDateString(),
'show_time' => '20:00:00',
'ticket_price' => 25000,
'ticket_link' => 'https://example.com/ticket/1',
'description' => '๋ถ๋๋ฌ์ด ์ฌ์ฆ ์ ์จ๊ณผ ํจ๊ปํ๋ ๊ธ์์ผ ๋ฐค',
'likes' => 12,
],
[
'title' => '์ธ๋ ๋ก ํ์คํฐ๋ฒ',
'artist' => 'The Wildcats',
'genre' => 'rock',
'show_date' => Carbon::now()->addDays(10)->toDateString(),
'show_time' => '19:30:00',
'ticket_price' => 30000,
'ticket_link' => 'https://example.com/ticket/2',
'description' => '์ด์ ์ ์ธ ๋ก ๋ฐด๋์ ๋ผ์ด๋ธ ๋ฌด๋',
'likes' => 8,
],
[
'title' => '์ผ๋ ํธ๋ก๋ ๋นํธ ํํฐ',
'artist' => 'DJ Neon',
'genre' => 'electronic',
'show_date' => Carbon::now()->addDays(15)->toDateString(),
'show_time' => '22:00:00',
'ticket_price' => 20000,
'ticket_link' => null,
'description' => '๋์ค ํ๋ก์ด๋ฅผ ๊ฐ๋ ์ฑ์ธ ์ผ๋ ํธ๋ก๋ ์ฌ์ด๋',
'likes' => 15,
],
[
'title' => '์ด์ฟ ์คํฑ ์ฑ์ด์ก๋ผ์ดํฐ ์ผ์ผ์ด์ค',
'artist' => 'Luna Park',
'genre' => 'indie',
'show_date' => Carbon::now()->addDays(20)->toDateString(),
'show_time' => '18:00:00',
'ticket_price' => 15000,
'ticket_link' => 'https://example.com/ticket/4',
'description' => '๊ฐ์ฑ์ ์ธ ์ด์ฟ ์คํฑ ๊ณต์ฐ',
'likes' => 20,
],
];
foreach ($shows as $show) {
Show::create($show);
}
}
```
3. `database/seeders/DatabaseSeeder.php`์์ ํธ์ถ:
```php
public function run()
{
$this->call(ShowSeeder::class);
}
```
4. ์๋ฉ ์คํ:
```bash
php artisan db:seed
```
5. ShowController ์์ฑ:
```bash
php artisan make:controller ShowController
```
์๋ฃ ํ `php artisan tinker`๋ก `Show::count()` ์คํํ์ฌ 4๊ฐ ๋ฐ์ดํฐ ํ์ธ.
๊ธฐ๋ ๊ฒฐ๊ณผ: ์ํ ๊ณต์ฐ ๋ฐ์ดํฐ 4๊ฐ๊ฐ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ ์ฅ๋๊ณ , ShowController๊ฐ ์์ฑ๋ฉ๋๋ค.
# ์๊ฐ ๋ฌ๋ ฅ ๋ทฐ ๋ฐ ๋ผ์ฐํธ ๊ตฌํ
1. `app/Http/Controllers/ShowController.php`์ index ๋ฉ์๋ ์ถ๊ฐ:
```php
use App\Models\Show;
use Carbon\Carbon;
public function index()
{
// ํ์ฌ ์์ ๋ชจ๋ ๊ณต์ฐ ๊ฐ์ ธ์ค๊ธฐ
$currentMonth = Carbon::now();
$shows = Show::whereYear('show_date', $currentMonth->year)
->whereMonth('show_date', $currentMonth->month)
->orderBy('show_date')
->get();
// ๋ฌ๋ ฅ ์์ฑ์ ์ํ ๋ฐ์ดํฐ
$startOfMonth = $currentMonth->copy()->startOfMonth();
$endOfMonth = $currentMonth->copy()->endOfMonth();
$startDay = $startOfMonth->copy()->startOfWeek(); // ์์์ผ๋ถํฐ ์์
$endDay = $endOfMonth->copy()->endOfWeek();
$calendar = [];
$day = $startDay->copy();
while ($day <= $endDay) {
$week = [];
for ($i = 0; $i < 7; $i++) {
$week[] = [
'date' => $day->copy(),
'is_current_month' => $day->month === $currentMonth->month,
'shows' => $shows->filter(function($show) use ($day) {
return $show->show_date->isSameDay($day);
}),
];
$day->addDay();
}
$calendar[] = $week;
}
return view('shows.index', compact('calendar', 'currentMonth'));
}
```
2. `routes/web.php`์ ๋ผ์ฐํธ ์ถ๊ฐ:
```php
use App\Http\Controllers\ShowController;
Route::get('/', [ShowController::class, 'index'])->name('shows.index');
```
3. `resources/views/shows/index.blade.php` ์์ฑ:
```blade
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ config('app.name') }}</title>
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-gray-900 text-white">
<div class="container mx-auto px-4 py-8">
<!-- ํค๋ -->
<div class="text-center mb-8">
<h1 class="text-4xl font-bold mb-2">๐ธ Local Venue Lineup</h1>
<p class="text-gray-400">{{ $currentMonth->format('Y๋
m์') }} ๊ณต์ฐ ์ผ์ </p>
</div>
<!-- ๋ฌ๋ ฅ -->
<div class="bg-gray-800 rounded-lg shadow-xl p-6">
<!-- ์์ผ ํค๋ -->
<div class="grid grid-cols-7 gap-2 mb-4">
@foreach(['์', 'ํ', '์', '๋ชฉ', '๊ธ', 'ํ ', '์ผ'] as $day)
<div class="text-center font-semibold text-gray-400">{{ $day }}</div>
@endforeach
</div>
<!-- ๋ ์ง ๊ทธ๋ฆฌ๋ -->
@foreach($calendar as $week)
<div class="grid grid-cols-7 gap-2 mb-2">
@foreach($week as $day)
<div class="min-h-[120px] p-2 rounded {{ $day['is_current_month'] ? 'bg-gray-700' : 'bg-gray-800 opacity-50' }}">
<div class="text-sm {{ $day['date']->isToday() ? 'text-blue-400 font-bold' : 'text-gray-300' }}">
{{ $day['date']->format('d') }}
</div>
@foreach($day['shows'] as $show)
<div class="mt-2 p-2 bg-gradient-to-r from-purple-600 to-pink-600 rounded text-xs hover:scale-105 transition cursor-pointer">
<div class="font-semibold truncate">{{ $show->title }}</div>
<div class="text-gray-200 truncate">{{ $show->artist }}</div>
<div class="text-gray-300">{{ $show->show_time->format('H:i') }}</div>
</div>
@endforeach
</div>
@endforeach
</div>
@endforeach
</div>
</div>
</body>
</html>
```
์๋ฃ ํ ๋ธ๋ผ์ฐ์ ์์ `http://localhost:8000` ์ ์ํ์ฌ ๋ฌ๋ ฅ ๋ทฐ ํ์ธ.
๊ธฐ๋ ๊ฒฐ๊ณผ: ์๊ฐ ๋ฌ๋ ฅ ํํ๋ก ๊ณต์ฐ ์ผ์ ์ด ํ์๋ฉ๋๋ค. ๊ฐ ๋ ์ง ์ ์ ํด๋น ๋ ์ง์ ๊ณต์ฐ์ด ์นด๋ ํํ๋ก ๋ณด์ด๋ฉฐ, ์ค๋ ๋ ์ง๋ ํ๋์์ผ๋ก ๊ฐ์กฐ๋ฉ๋๋ค.
# ๊ณต์ฐ ์์ธ ํ์ด์ง ๋ฐ ์ฅ๋ฅด๋ณ ํํฐ๋ง ๊ตฌํ
1. `app/Http/Controllers/ShowController.php`์ show ๋ฉ์๋ ์ถ๊ฐ:
```php
public function show(Show $show)
{
return view('shows.show', compact('show'));
}
```
2. `routes/web.php`์ ๋ผ์ฐํธ ์ถ๊ฐ:
```php
Route::get('/shows/{show}', [ShowController::class, 'show'])->name('shows.show');
```
3. `resources/views/shows/show.blade.php` ์์ฑ:
```blade
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $show->title }} - {{ config('app.name') }}</title>
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-gray-900 text-white">
<div class="container mx-auto px-4 py-8 max-w-3xl">
<a href="{{ route('shows.index') }}" class="text-blue-400 hover:underline mb-4 inline-block">โ ๋ฌ๋ ฅ์ผ๋ก ๋์๊ฐ๊ธฐ</a>
<div class="bg-gray-800 rounded-lg shadow-xl p-8">
<div class="mb-6">
<span class="px-3 py-1 rounded-full text-sm font-semibold
{{ $show->genre === 'jazz' ? 'bg-blue-600' : '' }}
{{ $show->genre === 'rock' ? 'bg-red-600' : '' }}
{{ $show->genre === 'indie' ? 'bg-green-600' : '' }}
{{ $show->genre === 'electronic' ? 'bg-purple-600' : '' }}
">
{{ strtoupper($show->genre) }}
</span>
</div>
<h1 class="text-4xl font-bold mb-4">{{ $show->title }}</h1>
<p class="text-2xl text-gray-300 mb-6">{{ $show->artist }}</p>
<div class="grid grid-cols-2 gap-4 mb-6">
<div>
<p class="text-gray-400 text-sm">๊ณต์ฐ ๋ ์ง</p>
<p class="text-xl font-semibold">{{ $show->show_date->format('Y๋
m์ d์ผ') }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">๊ณต์ฐ ์๊ฐ</p>
<p class="text-xl font-semibold">{{ $show->show_time->format('H:i') }}</p>
</div>
<div>
<p class="text-gray-400 text-sm">ํฐ์ผ ๊ฐ๊ฒฉ</p>
<p class="text-xl font-semibold">{{ number_format($show->ticket_price) }}์</p>
</div>
<div>
<p class="text-gray-400 text-sm">๊ด์ฌ๋</p>
<p class="text-xl font-semibold">โค๏ธ {{ $show->likes }}</p>
</div>
</div>
@if($show->description)
<div class="mb-6">
<h2 class="text-xl font-semibold mb-2">๊ณต์ฐ ์๊ฐ</h2>
<p class="text-gray-300">{{ $show->description }}</p>
</div>
@endif
@if($show->ticket_link)
<a href="{{ $show->ticket_link }}" target="_blank" class="block w-full bg-gradient-to-r from-purple-600 to-pink-600 text-center py-3 rounded-lg font-semibold hover:scale-105 transition">
ํฐ์ผ ์๋งคํ๊ธฐ โ
</a>
@endif
</div>
</div>
</body>
</html>
```
4. `resources/views/shows/index.blade.php` ์์ (๊ณต์ฐ ์นด๋ ํด๋ฆญ ์ ์์ธ ํ์ด์ง ์ด๋):
```blade
<!-- ๊ณต์ฐ ์นด๋ ๋ถ๋ถ์ ๋ค์๊ณผ ๊ฐ์ด ์์ -->
@foreach($day['shows'] as $show)
<a href="{{ route('shows.show', $show) }}" class="block mt-2 p-2 bg-gradient-to-r from-purple-600 to-pink-600 rounded text-xs hover:scale-105 transition">
<div class="font-semibold truncate">{{ $show->title }}</div>
<div class="text-gray-200 truncate">{{ $show->artist }}</div>
<div class="text-gray-300">{{ $show->show_time->format('H:i') }}</div>
</a>
@endforeach
```
5. ์ฅ๋ฅด ํํฐ๋ง ์ถ๊ฐ - `resources/views/shows/index.blade.php` ํค๋ ์๋์ ์ถ๊ฐ:
```blade
<!-- ์ฅ๋ฅด ํํฐ ๋ฒํผ -->
<div class="flex justify-center gap-2 mb-6 flex-wrap">
<a href="{{ route('shows.index') }}" class="px-4 py-2 rounded-full bg-gray-700 hover:bg-gray-600 transition">์ ์ฒด</a>
<a href="{{ route('shows.index', ['genre' => 'jazz']) }}" class="px-4 py-2 rounded-full bg-blue-600 hover:bg-blue-500 transition">์ฌ์ฆ</a>
<a href="{{ route('shows.index', ['genre' => 'rock']) }}" class="px-4 py-2 rounded-full bg-red-600 hover:bg-red-500 transition">๋ก</a>
<a href="{{ route('shows.index', ['genre' => 'indie']) }}" class="px-4 py-2 rounded-full bg-green-600 hover:bg-green-500 transition">์ธ๋</a>
<a href="{{ route('shows.index', ['genre' => 'electronic']) }}" class="px-4 py-2 rounded-full bg-purple-600 hover:bg-purple-500 transition">์ผ๋ ํธ๋ก๋</a>
</div>
```
6. ShowController์ index ๋ฉ์๋ ์์ (ํํฐ๋ง ๋ก์ง):
```php
public function index(Request $request)
{
$currentMonth = Carbon::now();
$query = Show::whereYear('show_date', $currentMonth->year)
->whereMonth('show_date', $currentMonth->month);
// ์ฅ๋ฅด ํํฐ๋ง
if ($request->has('genre')) {
$query->where('genre', $request->genre);
}
$shows = $query->orderBy('show_date')->get();
// ... ๋๋จธ์ง ๋ฌ๋ ฅ ์์ฑ ์ฝ๋ ๋์ผ
}
```
์๋ฃ ํ ๊ณต์ฐ ์นด๋ ํด๋ฆญ ์ ์์ธ ํ์ด์ง๋ก ์ด๋ํ๋์ง ํ์ธํ๊ณ , ์ฅ๋ฅด ํํฐ ๋ฒํผ์ผ๋ก ๊ณต์ฐ ํํฐ๋ง ํ
์คํธ.
๊ธฐ๋ ๊ฒฐ๊ณผ: ๊ณต์ฐ ์นด๋๋ฅผ ํด๋ฆญํ๋ฉด ์์ธ ํ์ด์ง๋ก ์ด๋ํ๋ฉฐ, ์ฅ๋ฅด/๋ ์ง/๊ฐ๊ฒฉ/์ค๋ช ๋ฑ์ด ํ์๋ฉ๋๋ค. ์ฅ๋ฅด ํํฐ ๋ฒํผ์ ํด๋ฆญํ๋ฉด ํด๋น ์ฅ๋ฅด์ ๊ณต์ฐ๋ง ๋ฌ๋ ฅ์ ํ์๋ฉ๋๋ค.
์ ์ถ๋ ์ํ (0)
๋ก๊ทธ์ธ ํ ์ ์ถ์์ง ์ ์ถ๋ ์ํ์ด ์์ต๋๋ค. ์ฒซ ๋ฒ์งธ ๋์ ์๊ฐ ๋์ด๋ณด์ธ์!