質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -204,53 +204,111 @@
|
|
204
204
|
|
205
205
|
$reservation = \App\Models\Reservation::all();
|
206
206
|
|
207
|
-
$calendar = $reservation->pluck('calendar');
|
207
|
+
$calendars = $reservation->pluck('calendar');
|
208
|
+
|
208
|
-
|
209
|
+
// $todayReservations1 = \App\Models\Reservation::where("calendar","2021-03-25")->count();
|
210
|
+
|
209
|
-
// dd($
|
211
|
+
// dd($todayReservations1);
|
210
|
-
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
211
|
-
|
217
|
+
$color = "green";
|
212
|
-
|
213
|
-
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
214
222
|
|
215
223
|
for($day = 1; $day <= $day_count; $day++,$youbi++){
|
216
224
|
|
217
225
|
$date = $ym . '-' . $day; //日にちを1日ずつ足していく
|
218
226
|
|
227
|
+
|
228
|
+
|
219
229
|
// dd($day);→1
|
220
230
|
|
221
|
-
// dd($date);→2021-03-1
|
222
|
-
|
223
|
-
|
224
|
-
|
225
231
|
//もし今日の日付だったらクラスをつける
|
226
232
|
|
227
233
|
if($today == $date){
|
228
234
|
|
229
|
-
|
235
|
+
$todayReservations1 = \App\Models\Reservation::where("calendar",$ym . '-' . $day)->count();
|
236
|
+
|
230
|
-
|
237
|
+
$todayReservations2 = \App\Models\Reservation::where("calendar",$ym . '-0' . $day)->count();
|
238
|
+
|
239
|
+
dd($todayReservations2);
|
240
|
+
|
241
|
+
echo $todayReservations1;
|
242
|
+
|
243
|
+
// $todayReservations1 = \App\Models\Reservation::where("calendar",$today)->count();
|
244
|
+
|
245
|
+
// $todayReservations2 = \App\Models\Reservation::where("calendar","2021-3-25")->count();
|
246
|
+
|
247
|
+
|
248
|
+
|
231
|
-
$ym1 = "{{ $ym}} ";
|
249
|
+
// $ym1 = "{{ $ym}} ";
|
250
|
+
|
251
|
+
|
232
252
|
|
233
253
|
if($day < 10){
|
234
254
|
|
255
|
+
// $reservation = \App\Models\Reservation::all();
|
256
|
+
|
257
|
+
// $calendars = $reservation->pluck('calendar');
|
258
|
+
|
235
|
-
$todayReservations = \App\Models\Reservation::where("calendar",
|
259
|
+
// $todayReservations1 = \App\Models\Reservation::where("calendar",$date)->count();
|
260
|
+
|
236
|
-
|
261
|
+
// dd($todayReservations1);
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
// 二次元配列 オブジェクトのインスタンス レコードごと撮ってくるforeach 文字列型なら変える必要がある
|
266
|
+
|
237
|
-
|
267
|
+
if( $todayReservations1 < 1){
|
268
|
+
|
238
|
-
|
269
|
+
echo 'これは'.$color.'です①';
|
270
|
+
|
271
|
+
|
272
|
+
|
239
|
-
|
273
|
+
}else{
|
274
|
+
|
275
|
+
echo "不合格";
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
|
240
282
|
|
241
283
|
$week .= '<td class="today">'.'<a href="dayDetail/' .$ym. '-0'. $day.'">' . $day.'</a>';
|
242
284
|
|
243
|
-
|
285
|
+
}else {
|
286
|
+
|
244
|
-
|
287
|
+
if( $todayReservations1 < 1){
|
288
|
+
|
289
|
+
echo 'これは'.$color.'です②';
|
290
|
+
|
291
|
+
|
292
|
+
|
245
|
-
}else{
|
293
|
+
}else{
|
246
|
-
|
294
|
+
|
247
|
-
|
295
|
+
echo "不合格";
|
296
|
+
|
297
|
+
|
298
|
+
|
248
|
-
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
249
|
-
dd($todayReservations);
|
303
|
+
// dd($todayReservations1);
|
304
|
+
|
250
|
-
|
305
|
+
// foreach($calendars as $calendar){
|
306
|
+
|
251
|
-
|
307
|
+
// if($calendar == $ym. '-'. $day){
|
308
|
+
|
252
|
-
|
309
|
+
// }
|
310
|
+
|
253
|
-
|
311
|
+
// }
|
254
312
|
|
255
313
|
$week .= '<td class="today">'.'<a href="dayDetail/' .$ym. '-'. $day.'">' . $day.'</a>';
|
256
314
|
|
@@ -260,63 +318,111 @@
|
|
260
318
|
|
261
319
|
} else{
|
262
320
|
|
263
|
-
//今日以外の日付は普通に出力する
|
321
|
+
//今日以外の日付は普通に出力する
|
322
|
+
|
264
|
-
|
323
|
+
// $todayReservations1 = \App\Models\Reservation::where("calendar",$date)->get();
|
324
|
+
|
325
|
+
// $todayReservations2 = \App\Models\Reservation::where("calendar",$date2)->get();
|
326
|
+
|
327
|
+
// dd($todayReservations1);
|
328
|
+
|
329
|
+
|
330
|
+
|
265
|
-
if($day < 10){
|
331
|
+
if($day < 10){
|
266
|
-
|
267
|
-
|
332
|
+
|
268
|
-
|
269
|
-
|
333
|
+
if( $todayReservations2 < 1){
|
334
|
+
|
270
|
-
|
335
|
+
echo 'これは'.$color.'です③';
|
336
|
+
|
337
|
+
|
338
|
+
|
271
|
-
|
339
|
+
}else{
|
340
|
+
|
272
|
-
|
341
|
+
echo "不合格";
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
}
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
// foreach($calendars as $calendar){
|
350
|
+
|
351
|
+
// if($calendar == $ym. '-0'. $day){
|
352
|
+
|
353
|
+
// $color = "green";
|
354
|
+
|
273
|
-
//
|
355
|
+
// }
|
356
|
+
|
274
|
-
|
357
|
+
// }
|
358
|
+
|
275
|
-
$week .= '<td class="dayNumber">'. '<a href="dayDetail/' .$ym.'-0'. $day.'">'. $day.'</a>';
|
359
|
+
$week .= '<td class="dayNumber">'. '<a href="dayDetail/' .$ym.'-0'. $day.'">'. $day.'</a>';
|
360
|
+
|
276
|
-
|
361
|
+
}else {
|
362
|
+
|
363
|
+
if( $todayReservations1 < 1){
|
364
|
+
|
365
|
+
echo 'これは'.$color.'です④';
|
366
|
+
|
367
|
+
|
368
|
+
|
277
|
-
}else{
|
369
|
+
}else{
|
278
|
-
|
370
|
+
|
279
|
-
|
371
|
+
echo "不合格";
|
372
|
+
|
373
|
+
|
374
|
+
|
280
|
-
|
375
|
+
}
|
376
|
+
|
377
|
+
|
378
|
+
|
281
|
-
dd($todayReservations);
|
379
|
+
// dd($todayReservations);
|
380
|
+
|
381
|
+
|
382
|
+
|
282
|
-
|
383
|
+
// foreach($calendars as $calendar){
|
384
|
+
|
283
|
-
|
385
|
+
// if($calendar == $ym. '-'. $day){
|
386
|
+
|
284
|
-
|
387
|
+
// $color = "green";
|
388
|
+
|
285
|
-
|
389
|
+
// }
|
390
|
+
|
286
|
-
|
391
|
+
// }
|
392
|
+
|
287
|
-
$week .= '<td class="day
|
393
|
+
$week .= '<td class="today">'.'<a href="dayDetail/' .$ym. '-'. $day.'">' . $day.'</a>';
|
394
|
+
|
395
|
+
}
|
288
396
|
|
289
397
|
}
|
290
398
|
|
399
|
+
$week .= '</td>';
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
//週終わり・月終わりの処理(もし今日の日付が月の日数の最後の日付だったら)
|
404
|
+
|
405
|
+
if ($youbi % 7 == 6 || $day == $day_count) {
|
406
|
+
|
407
|
+
if ($day == $day_count) {
|
408
|
+
|
409
|
+
$week .= str_repeat('<td></td>', 6 - ($youbi % 7));
|
410
|
+
|
411
|
+
}
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
//$weeks(配列)の中に一週間分格納する
|
416
|
+
|
417
|
+
$weeks[]='<tr>' . $week . '</tr>';
|
418
|
+
|
419
|
+
$week = '';
|
420
|
+
|
291
421
|
}
|
292
422
|
|
293
|
-
$week .= '</td>';
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
//週終わり・月終わりの処理(もし今日の日付が月の日数の最後の日付だったら)
|
298
|
-
|
299
|
-
if ($youbi % 7 == 6 || $day == $day_count) {
|
300
|
-
|
301
|
-
if ($day == $day_count) {
|
302
|
-
|
303
|
-
$week .= str_repeat('<td></td>', 6 - ($youbi % 7));
|
304
|
-
|
305
|
-
}
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
//$weeks(配列)の中に一週間分格納する
|
310
|
-
|
311
|
-
$weeks[]='<tr>' . $week . '</tr>';
|
312
|
-
|
313
|
-
$week = '';
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
423
|
}
|
318
424
|
|
319
|
-
return view('calendar',compact('prev','title','next','weeks','day'));
|
425
|
+
return view('calendar',compact('prev','title','next','weeks','day','color','todayReservations1'));
|
320
426
|
|
321
427
|
}
|
322
428
|
|