Skip to content

Commit

Permalink
座席予約の引数の問題未解決
Browse files Browse the repository at this point in the history
  • Loading branch information
sotyan committed Jun 30, 2024
1 parent 1c6ac57 commit 2a4e332
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 2 deletions.
Binary file modified .DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions app/Http/Controllers/MovieController.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,23 @@ public function detail($id) {
return view('detail', compact('movie','schedules'));
}

public function movieSheet($movie_id, $schedule_id){
//dd($movie_id, $schedule_id);
$movie = Movie::find($movie_id);
$schedule = Schedule::find($schedule_id);
$sheets = Sheet::all();
return view('movieSheet',compact('movie','schedule','sheets'));
}

public function sheetReserve($movie_id, $schedule_id, $sheet_id){

$movie = Movie::find($movie_id);
$schedule = Schedule::find($schedule_id);
$sheet = Sheet::find($sheet_id);
//return view('sheetReserve',compact('movie','schedule','sheet'));
return view('sheetReserve');
}

public function sheets() {
$sheets = Sheet::all();
//dd($seets);
Expand Down
4 changes: 4 additions & 0 deletions resources/views/detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

@foreach ($schedules as $schedule)
<p>{{ $schedule->start_time}} ~ {{ $schedule->end_time }}</p>
<a href="{{ route('movieSheet', ['movie_id' => $movie->id , 'schedule_id' => $schedule->id ]). '?date=' . $schedule->start_time->format('Y-m-d') }}">座席を予約する</a>
</p>
@endforeach


</body>
</html>
1 change: 1 addition & 0 deletions resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
@foreach($movies as $movie)
<li>映画タイトル:{{ $movie->title }}</li>
<li>画像URL:{{ $movie->image_url }}</li>
<li><a href="{{route('detail',['id' => $movie->id])}}">詳細</a></li>
@endforeach
</ul>
<div class="pagination">
Expand Down
22 changes: 22 additions & 0 deletions resources/views/movieSheet.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Practice</title>
<link rel="stylesheet" href="/css/index.css" type="text/css">
</head>
<body>
<h1>座席表</h1>
<table border="1">
<tbody>
@foreach($sheets as $sheet)
<tr>
<td>{{ $sheet->id }}</td>
<td><a href="{{ route('sheetReserve', ['movie_id' => $movie->id , 'schedule_id' => $schedule->id , 'sheet_id' => $sheet->id])}}">{{ $sheet->row }}-{{ $sheet->column }}</a></td>
</tr>
@endforeach
</tbody>
</table>
</body>
12 changes: 12 additions & 0 deletions resources/views/sheetReserve.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Practice</title>
</head>

<body>
座席予約
</body>
7 changes: 5 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
Route::get('/movies', [MovieController::class, 'index']);
Route::get('/movies/search', [MovieController::class, 'search']);
Route::get('/movies/{id}', [MovieController::class, 'detail'])->name('detail');
Route::get('/sheets', [MovieController::class, 'sheets'])->name('sheets');
Route::get('/movies/{movie_id}/schedules/{schedule_id}/sheets', [MovieController::class, 'movieSheet'])->name('movieSheet');
Route::get('/movies/{movie_id}/schedules/{schedule_id}/reservations/create', [MovieController::class, 'sheetReserve'])->name('sheetReserve');

Route::get('/admin/movies', [MovieController::class, 'adminIndex']);
Route::get('/admin/movies/create', [MovieController::class, 'adminCreate'])->name('create');
Expand All @@ -46,4 +47,6 @@
Route::patch('/admin/schedules/{id}/update',[MovieController::class, 'adminUpdateSchedules'])->name('adminUpdateSchedules');
// Route::post('/admin/movies/{id}/schedules/store',[MovieController::class, 'adminStoreSchedules'])->name('adminStoreSchedules');
Route::post('/admin/movies/{id}/schedules/store',[MovieController::class, 'adminStoreSchedules']);
Route::delete('/admin/schedules/{id}/destroy',[MovieController::class, 'adminDestroySchedules'])->name('destroySchedules');
Route::delete('/admin/schedules/{id}/destroy',[MovieController::class, 'adminDestroySchedules'])->name('destroySchedules');

Route::get('/sheets', [MovieController::class, 'sheets'])->name('sheets');

0 comments on commit 2a4e332

Please sign in to comment.