5
5
use Illuminate \Support \Collection ;
6
6
use Illuminate \Support \Facades \Auth ;
7
7
use Illuminate \Support \Facades \DB ;
8
- use Illuminate \Support \Facades \Log ;
9
8
use Illuminate \Support \Facades \Validator ;
10
9
11
- //use Carbon\Carbon;
12
-
13
10
use App \Enums \StatusType ;
14
11
15
12
use App \Models \Common \Buckets ;
37
34
*/
38
35
class CalendarsPlugin extends UserPluginBase
39
36
{
40
- /* DB migrate
41
- php artisan make:migration create_calendars --create=calendars
42
- php artisan make:migration create_calendar_posts --create=calendar_posts
43
- php artisan make:migration create_calendar_frames --create=calendar_frames
44
- */
45
-
46
37
/* オブジェクト変数 */
47
38
48
39
/**
@@ -65,7 +56,7 @@ public function getPublicFunctions()
65
56
}
66
57
67
58
/**
68
- * 権限定義
59
+ * 権限定義
69
60
*/
70
61
public function declareRole ()
71
62
{
@@ -130,18 +121,20 @@ private function getPluginBucket($bucket_id)
130
121
}
131
122
132
123
/**
133
- * POST一覧取得
124
+ * POST一覧取得
134
125
*/
135
126
private function getPosts ($ from_date , $ to_date )
136
127
{
137
128
// データ取得
138
129
$ posts_query = CalendarPost::select ('calendar_posts.* ' )
139
- ->join ('calendars ' , function ($ join ) {
140
- $ join ->on ('calendars.id ' , '= ' , 'calendar_posts.calendar_id ' )
141
- ->where ('calendars.bucket_id ' , '= ' , $ this ->frame ->bucket_id );
142
- })
143
- ->where ('calendar_posts.start_date ' , '<= ' , $ to_date )
144
- ->where ('calendar_posts.end_date ' , '>= ' , $ from_date );
130
+ ->join ('calendars ' , function ($ join ) {
131
+ $ join ->on ('calendars.id ' , '= ' , 'calendar_posts.calendar_id ' )
132
+ ->where ('calendars.bucket_id ' , '= ' , $ this ->frame ->bucket_id );
133
+ })
134
+ ->where ('calendar_posts.start_date ' , '<= ' , $ to_date )
135
+ ->where ('calendar_posts.end_date ' , '>= ' , $ from_date )
136
+ ->orderBy ('calendar_posts.start_date ' )
137
+ ->orderBy ('calendar_posts.start_time ' );
145
138
146
139
// 権限によって表示する記事を絞る
147
140
$ posts_query = $ this ->appendAuthWhereBase ($ posts_query , 'calendar_posts ' );
@@ -316,7 +309,6 @@ public function index($request, $page_id, $frame_id)
316
309
return $ this ->view ('index ' , [
317
310
'dates ' => $ dates ,
318
311
'posts ' => $ posts ,
319
- // 'current_ym_first' => strtotime(session('calendar_year') . "/" . session('calendar_month') . "/01"),
320
312
'current_ym_first ' => strtotime (session ($ session_year_name ) . "/ " . session ($ session_month_name ) . "/ " . session ($ session_day_name )),
321
313
'current_month ' => session ($ session_month_name ),
322
314
'plugin_frame ' => $ plugin_frame ,
0 commit comments