94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/Http/Controllers/MultiMessageController.php:
--------------------------------------------------------------------------------
1 | country = $country;
13 | $this->code = $code;
14 |
15 | if ($school == 'high') $this->school = 4;
16 | elseif ($school == 'middle') $this->school = 3;
17 | else throw new \LogicException('존재하지 않는 학교 종류입니다.');
18 | }
19 |
20 | public function meal($date) {
21 | $url = 'https://' . $this->country . '/sts_sci_md00_001.do?schulCode=' . $this->code . '&schulCrseScCode=' . $this->school . '&schMmealScCode=2';
22 |
23 | $crawler = Goutte::request('GET', $url);
24 | $result = $crawler->filter('tbody tr td div')->each(function ($content){
25 | $text = $content->text();
26 | /**
27 | * 급식 앞에 [중식] 단어를 제거하고 싶을때 아래의 주석 해제
28 | */
29 |
30 | // $text = preg_replace('/\[[^\]]*\]/','',$text);
31 |
32 | $text = preg_replace('/\( \)/','',$text);
33 |
34 | if (strstr($text, '밥')) {
35 | $search = strpos($text, '밥');
36 | $back = strstr($text, '밥', 0);
37 |
38 | return trim(substr($text, 0, $search+3) . ' ' . substr($back, 3));
39 | } else {
40 | return trim($text);
41 | }
42 | });
43 |
44 |
45 | $result = array_values(array_filter($result));
46 | $result = preg_replace('/[\d]|\./',' ', $result);
47 | $result = preg_replace('/([\s])\1+/', ' ', $result);
48 |
49 | switch($date) {
50 | case '오늘 급식':
51 | $content = trim($result[Carbon::today()->format('j')-1]);
52 | return empty($content) ? '오늘 급식이 없습니다.' : $content;
53 |
54 | case '내일 급식':
55 | $content = trim($result[Carbon::tomorrow()->format('j')-1]);
56 | return empty($content) ? '내일 급식이 없습니다.' : $content;
57 | }
58 | }
59 |
60 | public function schedule($month) {
61 | if(isset($month)) {
62 | $argv = explode('-', $month);
63 | }
64 |
65 | $url = 'https://' . $this->country . '/sts_sci_sf01_001.do?schulCode=' . $this->code . '&schulCrseScCode=' . $this->school . '&schulKndScCode=4&ay=' . $argv[0] . '&mm=' . $argv[1];
66 |
67 | $crawler = Goutte::request('GET', $url);
68 | $result = $crawler->filter('tbody tr td .textL')->each(function ($content){
69 | return preg_replace('/\s+/', ' ', trim($content->text()));
70 | });
71 | return implode("\n",$result);
72 | }
73 |
74 | public function animalLuck($cases, $animal) {
75 | $key = array_keys($cases, $animal);
76 |
77 | $url = 'https://fortune.nate.com/contents/freeunse/weekjiji.nate?jijiPage=0&jijiparam=' . sprintf('%02d', implode('', $key));
78 |
79 | $crawler = Goutte::request('GET', $url);
80 |
81 | $result = $crawler->filter('#con_box')->each(function ($content){
82 | $text = trim(preg_replace('/[\r\n]/', "\n", $content->text()));
83 | $text = str_replace(' ', '', $text);
84 | $text = str_replace("\n\n\n\n\n\n", '', $text);
85 |
86 | return $text;
87 | });
88 |
89 | return implode('', $result);
90 | }
91 |
92 | public function intLuck() {
93 | $num = rand(1, 100);
94 |
95 | return $num;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => 'web',
18 | 'passwords' => 'users',
19 | ],
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Authentication Guards
24 | |--------------------------------------------------------------------------
25 | |
26 | | Next, you may define every authentication guard for your application.
27 | | Of course, a great default configuration has been defined for you
28 | | here which uses session storage and the Eloquent user provider.
29 | |
30 | | All authentication drivers have a user provider. This defines how the
31 | | users are actually retrieved out of your database or other storage
32 | | mechanisms used by this application to persist your user's data.
33 | |
34 | | Supported: "session", "token"
35 | |
36 | */
37 |
38 | 'guards' => [
39 | 'web' => [
40 | 'driver' => 'session',
41 | 'provider' => 'users',
42 | ],
43 |
44 | 'api' => [
45 | 'driver' => 'token',
46 | 'provider' => 'users',
47 | ],
48 | ],
49 |
50 | /*
51 | |--------------------------------------------------------------------------
52 | | User Providers
53 | |--------------------------------------------------------------------------
54 | |
55 | | All authentication drivers have a user provider. This defines how the
56 | | users are actually retrieved out of your database or other storage
57 | | mechanisms used by this application to persist your user's data.
58 | |
59 | | If you have multiple user tables or models you may configure multiple
60 | | sources which represent each model / table. These sources may then
61 | | be assigned to any extra authentication guards you have defined.
62 | |
63 | | Supported: "database", "eloquent"
64 | |
65 | */
66 |
67 | 'providers' => [
68 | 'users' => [
69 | 'driver' => 'eloquent',
70 | 'model' => App\User::class,
71 | ],
72 |
73 | // 'users' => [
74 | // 'driver' => 'database',
75 | // 'table' => 'users',
76 | // ],
77 | ],
78 |
79 | /*
80 | |--------------------------------------------------------------------------
81 | | Resetting Passwords
82 | |--------------------------------------------------------------------------
83 | |
84 | | You may specify multiple password reset configurations if you have more
85 | | than one user table or model in the application and you want to have
86 | | separate password reset settings based on the specific user types.
87 | |
88 | | The expire time is the number of minutes that the reset token should be
89 | | considered valid. This security feature keeps tokens short-lived so
90 | | they have less time to be guessed. You may change this as needed.
91 | |
92 | */
93 |
94 | 'passwords' => [
95 | 'users' => [
96 | 'provider' => 'users',
97 | 'table' => 'password_resets',
98 | 'expire' => 60,
99 | ],
100 | ],
101 |
102 | ];
103 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'sqlite'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Database Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here are each of the database connections setup for your application.
24 | | Of course, examples of configuring each database platform that is
25 | | supported by Laravel is shown below to make development simple.
26 | |
27 | |
28 | | All database work in Laravel is done through the PHP PDO facilities
29 | | so make sure you have the driver for your particular database of
30 | | choice installed on your machine before you begin development.
31 | |
32 | */
33 |
34 | 'connections' => [
35 |
36 | 'sqlite' => [
37 | 'driver' => 'sqlite',
38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
39 | 'prefix' => '',
40 | ],
41 |
42 | 'mysql' => [
43 | 'driver' => 'mysql',
44 | 'host' => env('DB_HOST', '127.0.0.1'),
45 | 'port' => env('DB_PORT', '3306'),
46 | 'database' => env('DB_DATABASE', 'forge'),
47 | 'username' => env('DB_USERNAME', 'forge'),
48 | 'password' => env('DB_PASSWORD', ''),
49 | 'unix_socket' => env('DB_SOCKET', ''),
50 | 'charset' => 'utf8mb4',
51 | 'collation' => 'utf8mb4_unicode_ci',
52 | 'prefix' => '',
53 | 'strict' => true,
54 | 'engine' => null,
55 | ],
56 |
57 | 'pgsql' => [
58 | 'driver' => 'pgsql',
59 | 'host' => env('DB_HOST', '127.0.0.1'),
60 | 'port' => env('DB_PORT', '5432'),
61 | 'database' => env('DB_DATABASE', 'forge'),
62 | 'username' => env('DB_USERNAME', 'forge'),
63 | 'password' => env('DB_PASSWORD', ''),
64 | 'charset' => 'utf8',
65 | 'prefix' => '',
66 | 'schema' => 'public',
67 | 'sslmode' => 'prefer',
68 | ],
69 |
70 | 'sqlsrv' => [
71 | 'driver' => 'sqlsrv',
72 | 'host' => env('DB_HOST', 'localhost'),
73 | 'port' => env('DB_PORT', '1433'),
74 | 'database' => env('DB_DATABASE', 'forge'),
75 | 'username' => env('DB_USERNAME', 'forge'),
76 | 'password' => env('DB_PASSWORD', ''),
77 | 'charset' => 'utf8',
78 | 'prefix' => '',
79 | ],
80 |
81 | ],
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Migration Repository Table
86 | |--------------------------------------------------------------------------
87 | |
88 | | This table keeps track of all the migrations that have already run for
89 | | your application. Using this information, we can determine which of
90 | | the migrations on disk haven't actually been run in the database.
91 | |
92 | */
93 |
94 | 'migrations' => 'migrations',
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Redis Databases
99 | |--------------------------------------------------------------------------
100 | |
101 | | Redis is an open source, fast, and advanced key-value store that also
102 | | provides a richer set of commands than a typical key-value systems
103 | | such as APC or Memcached. Laravel makes it easy to dig right in.
104 | |
105 | */
106 |
107 | 'redis' => [
108 |
109 | 'client' => 'predis',
110 |
111 | 'default' => [
112 | 'host' => env('REDIS_HOST', '127.0.0.1'),
113 | 'password' => env('REDIS_PASSWORD', null),
114 | 'port' => env('REDIS_PORT', 6379),
115 | 'database' => 0,
116 | ],
117 |
118 | ],
119 |
120 | ];
121 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_DRIVER', 'smtp'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | SMTP Host Address
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may provide the host address of the SMTP server used by your
27 | | applications. A default option is provided that is compatible with
28 | | the Mailgun mail service which will provide reliable deliveries.
29 | |
30 | */
31 |
32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | SMTP Host Port
37 | |--------------------------------------------------------------------------
38 | |
39 | | This is the SMTP port used by your application to deliver e-mails to
40 | | users of the application. Like the host we have set this value to
41 | | stay compatible with the Mailgun e-mail application by default.
42 | |
43 | */
44 |
45 | 'port' => env('MAIL_PORT', 587),
46 |
47 | /*
48 | |--------------------------------------------------------------------------
49 | | Global "From" Address
50 | |--------------------------------------------------------------------------
51 | |
52 | | You may wish for all e-mails sent by your application to be sent from
53 | | the same address. Here, you may specify a name and address that is
54 | | used globally for all e-mails that are sent by your application.
55 | |
56 | */
57 |
58 | 'from' => [
59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
60 | 'name' => env('MAIL_FROM_NAME', 'Example'),
61 | ],
62 |
63 | /*
64 | |--------------------------------------------------------------------------
65 | | E-Mail Encryption Protocol
66 | |--------------------------------------------------------------------------
67 | |
68 | | Here you may specify the encryption protocol that should be used when
69 | | the application send e-mail messages. A sensible default using the
70 | | transport layer security protocol should provide great security.
71 | |
72 | */
73 |
74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
75 |
76 | /*
77 | |--------------------------------------------------------------------------
78 | | SMTP Server Username
79 | |--------------------------------------------------------------------------
80 | |
81 | | If your SMTP server requires a username for authentication, you should
82 | | set it here. This will get used to authenticate with your server on
83 | | connection. You may also set the "password" value below this one.
84 | |
85 | */
86 |
87 | 'username' => env('MAIL_USERNAME'),
88 |
89 | 'password' => env('MAIL_PASSWORD'),
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Sendmail System Path
94 | |--------------------------------------------------------------------------
95 | |
96 | | When using the "sendmail" driver to send e-mails, we will need to know
97 | | the path to where Sendmail lives on this server. A default path has
98 | | been provided here, which will work well on most of your systems.
99 | |
100 | */
101 |
102 | 'sendmail' => '/usr/sbin/sendmail -bs',
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Markdown Mail Settings
107 | |--------------------------------------------------------------------------
108 | |
109 | | If you are using Markdown based email rendering, you may configure your
110 | | theme and component paths here, allowing you to customize the design
111 | | of the emails. Or, you may simply stick with the Laravel defaults!
112 | |
113 | */
114 |
115 | 'markdown' => [
116 | 'theme' => 'default',
117 |
118 | 'paths' => [
119 | resource_path('views/vendor/mail'),
120 | ],
121 | ],
122 |
123 | ];
124 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => env('SESSION_LIFETIME', 120),
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path('framework/sessions'),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Cache Store
91 | |--------------------------------------------------------------------------
92 | |
93 | | When using the "apc" or "memcached" session drivers, you may specify a
94 | | cache store that should be used for these sessions. This value must
95 | | correspond with one of the application's configured cache stores.
96 | |
97 | */
98 |
99 | 'store' => null,
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Sweeping Lottery
104 | |--------------------------------------------------------------------------
105 | |
106 | | Some session drivers must manually sweep their storage location to get
107 | | rid of old sessions from storage. Here are the chances that it will
108 | | happen on a given request. By default, the odds are 2 out of 100.
109 | |
110 | */
111 |
112 | 'lottery' => [2, 100],
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Name
117 | |--------------------------------------------------------------------------
118 | |
119 | | Here you may change the name of the cookie used to identify a session
120 | | instance by ID. The name specified here will get used every time a
121 | | new session cookie is created by the framework for every driver.
122 | |
123 | */
124 |
125 | 'cookie' => env(
126 | 'SESSION_COOKIE',
127 | str_slug(env('APP_NAME', 'laravel'), '_').'_session'
128 | ),
129 |
130 | /*
131 | |--------------------------------------------------------------------------
132 | | Session Cookie Path
133 | |--------------------------------------------------------------------------
134 | |
135 | | The session cookie path determines the path for which the cookie will
136 | | be regarded as available. Typically, this will be the root path of
137 | | your application but you are free to change this when necessary.
138 | |
139 | */
140 |
141 | 'path' => '/',
142 |
143 | /*
144 | |--------------------------------------------------------------------------
145 | | Session Cookie Domain
146 | |--------------------------------------------------------------------------
147 | |
148 | | Here you may change the domain of the cookie used to identify a session
149 | | in your application. This will determine which domains the cookie is
150 | | available to in your application. A sensible default has been set.
151 | |
152 | */
153 |
154 | 'domain' => env('SESSION_DOMAIN', null),
155 |
156 | /*
157 | |--------------------------------------------------------------------------
158 | | HTTPS Only Cookies
159 | |--------------------------------------------------------------------------
160 | |
161 | | By setting this option to true, session cookies will only be sent back
162 | | to the server if the browser has a HTTPS connection. This will keep
163 | | the cookie from being sent to you if it can not be done securely.
164 | |
165 | */
166 |
167 | 'secure' => env('SESSION_SECURE_COOKIE', false),
168 |
169 | /*
170 | |--------------------------------------------------------------------------
171 | | HTTP Access Only
172 | |--------------------------------------------------------------------------
173 | |
174 | | Setting this value to true will prevent JavaScript from accessing the
175 | | value of the cookie and the cookie will only be accessible through
176 | | the HTTP protocol. You are free to modify this option if needed.
177 | |
178 | */
179 |
180 | 'http_only' => true,
181 |
182 | /*
183 | |--------------------------------------------------------------------------
184 | | Same-Site Cookies
185 | |--------------------------------------------------------------------------
186 | |
187 | | This option determines how your cookies behave when cross-site requests
188 | | take place, and can be used to mitigate CSRF attacks. By default, we
189 | | do not enable this as other CSRF protection services are in place.
190 | |
191 | | Supported: "lax", "strict"
192 | |
193 | */
194 |
195 | 'same_site' => null,
196 |
197 | ];
198 |
--------------------------------------------------------------------------------
/app/Http/Controllers/MessageController.php:
--------------------------------------------------------------------------------
1 | multiMessage = $multiMessage;
17 | }
18 |
19 | public function getContent($asResource = false) {
20 | if (false === $this->content || (true === $asResource && null !== $this->content))
21 | throw new \LogicException('호출은 한번만 가능합니다.');
22 |
23 | if (true === $asResource) {
24 | $this->content = false;
25 | return fopen('php://input', 'rb');
26 | }
27 | if (null === $this->content)
28 | $this->content = file_get_contents('php://input');
29 |
30 | return $this->content;
31 | }
32 |
33 | public function keyboard() {
34 | return response()->json([
35 | 'type' => 'buttons',
36 | 'buttons' => self::BUTTON
37 | ]);
38 | }
39 |
40 | public function index(Request $request) {
41 | $carbon = Carbon::now();
42 | $data = json_decode($request->getContent(), true);
43 | $content = $data['content'];
44 |
45 | // 버튼 리스트
46 | $mealCase = ['오늘 급식', '내일 급식', '돌아가기'];
47 | $scheduleCase = [Carbon::now()->addMonth(-1)->format('Y-m'), $carbon->now()->format('Y-m'), $carbon->addMonth()->format('Y-m'), $carbon->addMonth()->format('Y-m'), $carbon->addMonth()->format('Y-m'), $carbon->addMonth()->format('Y-m'), '돌아가기'];
48 | $luckCase = ['숫자 운세', '오늘 운세'];
49 | $luckAnimalsCase = ['쥐띠', '소띠', '호랑이띠','토끼띠', '용띠', '뱀띠', '말띠', '양띠', '원숭이띠', '닭띠', '개띠', '돼지띠'];
50 |
51 | // $content = '내일 급식';
52 |
53 | switch($content) {
54 | case '돌아가기': {
55 | $data = [
56 | 'message' => [
57 | 'text' => '초기 화면입니다.',
58 | ],
59 | 'keyboard' => [
60 | 'type' => 'buttons',
61 | 'buttons' => self::BUTTON
62 | ]
63 | ];
64 | return response()->json($data);
65 | break;
66 | }
67 |
68 | /**
69 | * 급식 시작
70 | * ['오늘 급식', '내일 급식', '돌아가기']
71 | */
72 |
73 | case '급식': {
74 | $data = [
75 | 'message' => [
76 | 'text' => '언제 급식을 알고 싶으세요 ?',
77 | ],
78 | 'keyboard' => [
79 | 'type' => 'buttons',
80 | 'buttons' => $mealCase
81 | ]
82 | ];
83 | return response()->json($data);
84 | break;
85 | }
86 | case in_array($content, $mealCase): {
87 | $meal = $this->multiMessage->meal($content);
88 |
89 | $data = [
90 | 'message' => [
91 | 'text' => $meal,
92 | ],
93 | 'keyboard' => [
94 | 'type' => 'buttons',
95 | 'buttons' => $mealCase
96 | ]
97 | ];
98 | return response()->json($data);
99 | break;
100 | }
101 |
102 | /**
103 | * 급식 끝
104 | *
105 | * 학교 일정
106 | * ['한달전', '이번달', '다음달', '다다음달', '다다다음달', '돌아가기']
107 | */
108 |
109 | case '학교 일정': {
110 | $data = [
111 | 'message' => [
112 | 'text' => '일정을 선택해주세요.',
113 | ],
114 | 'keyboard' => [
115 | 'type' => 'buttons',
116 | 'buttons' => $scheduleCase
117 | ]
118 | ];
119 | return response()->json($data);
120 | break;
121 | }
122 | case in_array($content, $scheduleCase): {
123 | $schedule = $this->multiMessage->schedule($content);
124 |
125 | $data = [
126 | 'message' => [
127 | 'text' => $schedule,
128 | ],
129 | 'keyboard' => [
130 | 'type' => 'buttons',
131 | 'buttons' => $scheduleCase
132 | ]
133 | ];
134 | return response()->json($data);
135 | break;
136 | }
137 |
138 | /**
139 | * 학교 일정 끝
140 | * 운세 추가
141 | */
142 |
143 | case '운세': {
144 | $data = [
145 | 'message' => [
146 | 'text' => '종류를 선택해주세요.',
147 | ],
148 | 'keyboard' => [
149 | 'type' => 'buttons',
150 | 'buttons' => $luckCase
151 | ]
152 | ];
153 | return response()->json($data);
154 | break;
155 | }
156 | case in_array($content, $luckCase): {
157 | switch($content) {
158 | case '숫자 운세':
159 | $luck = $this->multiMessage->intLuck();
160 | $data = [
161 | 'message' => [
162 | 'text' => '행운점수는: ' . $luck . "점\n\n위 숫자는 1부터 100까지 랜덤으로 추출된 정수입니다. 점수가 100점에 근접할수록 운이 좋습니다.",
163 | ],
164 | 'keyboard' => [
165 | 'type' => 'buttons',
166 | 'buttons' => self::BUTTON
167 | ]
168 | ];
169 | return response()->json($data);
170 | break;
171 |
172 | case '오늘 운세':
173 | $data = [
174 | 'message' => [
175 | 'text' => '띠를 선택해주세요.',
176 | ],
177 | 'keyboard' => [
178 | 'type' => 'buttons',
179 | 'buttons' => $luckAnimalsCase
180 | ]
181 | ];
182 | break;
183 | }
184 | return response()->json($data);
185 | break;
186 | }
187 | case in_array($content, $luckAnimalsCase): {
188 | $luck = $this->multiMessage->animalLuck($luckAnimalsCase, $content);
189 | $data = [
190 | 'message' => [
191 | 'text' => $luck,
192 | ],
193 | 'keyboard' => [
194 | 'type' => 'buttons',
195 | 'buttons' => self::BUTTON
196 | ]
197 | ];
198 | return response()->json($data);
199 | break;
200 | }
201 |
202 | /**
203 | * 운세 끝
204 | */
205 |
206 | /**
207 | * 예외처리 추가
208 | */
209 |
210 | default: {
211 | $data = [
212 | 'message' => [
213 | 'text' => '초기화면 입니다.'
214 | ],
215 | 'keyboard' => [
216 | 'type' => 'buttons',
217 | 'buttons' => self::BUTTON
218 | ]
219 | ];
220 | return response()->json($data);
221 | break;
222 | }
223 | }
224 | }
225 | }
226 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20 | 'alpha' => 'The :attribute may only contain letters.',
21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
23 | 'array' => 'The :attribute must be an array.',
24 | 'before' => 'The :attribute must be a date before :date.',
25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
26 | 'between' => [
27 | 'numeric' => 'The :attribute must be between :min and :max.',
28 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
29 | 'string' => 'The :attribute must be between :min and :max characters.',
30 | 'array' => 'The :attribute must have between :min and :max items.',
31 | ],
32 | 'boolean' => 'The :attribute field must be true or false.',
33 | 'confirmed' => 'The :attribute confirmation does not match.',
34 | 'date' => 'The :attribute is not a valid date.',
35 | 'date_format' => 'The :attribute does not match the format :format.',
36 | 'different' => 'The :attribute and :other must be different.',
37 | 'digits' => 'The :attribute must be :digits digits.',
38 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
39 | 'dimensions' => 'The :attribute has invalid image dimensions.',
40 | 'distinct' => 'The :attribute field has a duplicate value.',
41 | 'email' => 'The :attribute must be a valid email address.',
42 | 'exists' => 'The selected :attribute is invalid.',
43 | 'file' => 'The :attribute must be a file.',
44 | 'filled' => 'The :attribute field must have a value.',
45 | 'gt' => [
46 | 'numeric' => 'The :attribute must be greater than :value.',
47 | 'file' => 'The :attribute must be greater than :value kilobytes.',
48 | 'string' => 'The :attribute must be greater than :value characters.',
49 | 'array' => 'The :attribute must have more than :value items.',
50 | ],
51 | 'gte' => [
52 | 'numeric' => 'The :attribute must be greater than or equal :value.',
53 | 'file' => 'The :attribute must be greater than or equal :value kilobytes.',
54 | 'string' => 'The :attribute must be greater than or equal :value characters.',
55 | 'array' => 'The :attribute must have :value items or more.',
56 | ],
57 | 'image' => 'The :attribute must be an image.',
58 | 'in' => 'The selected :attribute is invalid.',
59 | 'in_array' => 'The :attribute field does not exist in :other.',
60 | 'integer' => 'The :attribute must be an integer.',
61 | 'ip' => 'The :attribute must be a valid IP address.',
62 | 'ipv4' => 'The :attribute must be a valid IPv4 address.',
63 | 'ipv6' => 'The :attribute must be a valid IPv6 address.',
64 | 'json' => 'The :attribute must be a valid JSON string.',
65 | 'lt' => [
66 | 'numeric' => 'The :attribute must be less than :value.',
67 | 'file' => 'The :attribute must be less than :value kilobytes.',
68 | 'string' => 'The :attribute must be less than :value characters.',
69 | 'array' => 'The :attribute must have less than :value items.',
70 | ],
71 | 'lte' => [
72 | 'numeric' => 'The :attribute must be less than or equal :value.',
73 | 'file' => 'The :attribute must be less than or equal :value kilobytes.',
74 | 'string' => 'The :attribute must be less than or equal :value characters.',
75 | 'array' => 'The :attribute must not have more than :value items.',
76 | ],
77 | 'max' => [
78 | 'numeric' => 'The :attribute may not be greater than :max.',
79 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
80 | 'string' => 'The :attribute may not be greater than :max characters.',
81 | 'array' => 'The :attribute may not have more than :max items.',
82 | ],
83 | 'mimes' => 'The :attribute must be a file of type: :values.',
84 | 'mimetypes' => 'The :attribute must be a file of type: :values.',
85 | 'min' => [
86 | 'numeric' => 'The :attribute must be at least :min.',
87 | 'file' => 'The :attribute must be at least :min kilobytes.',
88 | 'string' => 'The :attribute must be at least :min characters.',
89 | 'array' => 'The :attribute must have at least :min items.',
90 | ],
91 | 'not_in' => 'The selected :attribute is invalid.',
92 | 'not_regex' => 'The :attribute format is invalid.',
93 | 'numeric' => 'The :attribute must be a number.',
94 | 'present' => 'The :attribute field must be present.',
95 | 'regex' => 'The :attribute format is invalid.',
96 | 'required' => 'The :attribute field is required.',
97 | 'required_if' => 'The :attribute field is required when :other is :value.',
98 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
99 | 'required_with' => 'The :attribute field is required when :values is present.',
100 | 'required_with_all' => 'The :attribute field is required when :values is present.',
101 | 'required_without' => 'The :attribute field is required when :values is not present.',
102 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
103 | 'same' => 'The :attribute and :other must match.',
104 | 'size' => [
105 | 'numeric' => 'The :attribute must be :size.',
106 | 'file' => 'The :attribute must be :size kilobytes.',
107 | 'string' => 'The :attribute must be :size characters.',
108 | 'array' => 'The :attribute must contain :size items.',
109 | ],
110 | 'string' => 'The :attribute must be a string.',
111 | 'timezone' => 'The :attribute must be a valid zone.',
112 | 'unique' => 'The :attribute has already been taken.',
113 | 'uploaded' => 'The :attribute failed to upload.',
114 | 'url' => 'The :attribute format is invalid.',
115 |
116 | /*
117 | |--------------------------------------------------------------------------
118 | | Custom Validation Language Lines
119 | |--------------------------------------------------------------------------
120 | |
121 | | Here you may specify custom validation messages for attributes using the
122 | | convention "attribute.rule" to name the lines. This makes it quick to
123 | | specify a specific custom language line for a given attribute rule.
124 | |
125 | */
126 |
127 | 'custom' => [
128 | 'attribute-name' => [
129 | 'rule-name' => 'custom-message',
130 | ],
131 | ],
132 |
133 | /*
134 | |--------------------------------------------------------------------------
135 | | Custom Validation Attributes
136 | |--------------------------------------------------------------------------
137 | |
138 | | The following language lines are used to swap attribute place-holders
139 | | with something more reader friendly such as E-Mail Address instead
140 | | of "email". This simply helps us make messages a little cleaner.
141 | |
142 | */
143 |
144 | 'attributes' => [],
145 |
146 | ];
147 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_NAME', 'Laravel'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application Environment
21 | |--------------------------------------------------------------------------
22 | |
23 | | This value determines the "environment" your application is currently
24 | | running in. This may determine how you prefer to configure various
25 | | services your application utilizes. Set this in your ".env" file.
26 | |
27 | */
28 |
29 | 'env' => env('APP_ENV', 'production'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Debug Mode
34 | |--------------------------------------------------------------------------
35 | |
36 | | When your application is in debug mode, detailed error messages with
37 | | stack traces will be shown on every error that occurs within your
38 | | application. If disabled, a simple generic error page is shown.
39 | |
40 | */
41 |
42 | 'debug' => env('APP_DEBUG', false),
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application URL
47 | |--------------------------------------------------------------------------
48 | |
49 | | This URL is used by the console to properly generate URLs when using
50 | | the Artisan command line tool. You should set this to the root of
51 | | your application so that it is used when running Artisan tasks.
52 | |
53 | */
54 |
55 | 'url' => env('APP_URL', 'http://localhost'),
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Timezone
60 | |--------------------------------------------------------------------------
61 | |
62 | | Here you may specify the default timezone for your application, which
63 | | will be used by the PHP date and date-time functions. We have gone
64 | | ahead and set this to a sensible default for you out of the box.
65 | |
66 | */
67 |
68 | 'timezone' => 'Asia/Seoul',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Application Locale Configuration
73 | |--------------------------------------------------------------------------
74 | |
75 | | The application locale determines the default locale that will be used
76 | | by the translation service provider. You are free to set this value
77 | | to any of the locales which will be supported by the application.
78 | |
79 | */
80 |
81 | 'locale' => 'en',
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Application Fallback Locale
86 | |--------------------------------------------------------------------------
87 | |
88 | | The fallback locale determines the locale to use when the current one
89 | | is not available. You may change the value to correspond to any of
90 | | the language folders that are provided through your application.
91 | |
92 | */
93 |
94 | 'fallback_locale' => 'en',
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Encryption Key
99 | |--------------------------------------------------------------------------
100 | |
101 | | This key is used by the Illuminate encrypter service and should be set
102 | | to a random, 32 character string, otherwise these encrypted strings
103 | | will not be safe. Please do this before deploying an application!
104 | |
105 | */
106 |
107 | 'key' => env('APP_KEY'),
108 |
109 | 'cipher' => 'AES-256-CBC',
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Autoloaded Service Providers
114 | |--------------------------------------------------------------------------
115 | |
116 | | The service providers listed here will be automatically loaded on the
117 | | request to your application. Feel free to add your own services to
118 | | this array to grant expanded functionality to your applications.
119 | |
120 | */
121 |
122 | 'providers' => [
123 |
124 | /*
125 | * Laravel Framework Service Providers...
126 | */
127 | Illuminate\Auth\AuthServiceProvider::class,
128 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
129 | Illuminate\Bus\BusServiceProvider::class,
130 | Illuminate\Cache\CacheServiceProvider::class,
131 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
132 | Illuminate\Cookie\CookieServiceProvider::class,
133 | Illuminate\Database\DatabaseServiceProvider::class,
134 | Illuminate\Encryption\EncryptionServiceProvider::class,
135 | Illuminate\Filesystem\FilesystemServiceProvider::class,
136 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
137 | Illuminate\Hashing\HashServiceProvider::class,
138 | Illuminate\Mail\MailServiceProvider::class,
139 | Illuminate\Notifications\NotificationServiceProvider::class,
140 | Illuminate\Pagination\PaginationServiceProvider::class,
141 | Illuminate\Pipeline\PipelineServiceProvider::class,
142 | Illuminate\Queue\QueueServiceProvider::class,
143 | Illuminate\Redis\RedisServiceProvider::class,
144 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
145 | Illuminate\Session\SessionServiceProvider::class,
146 | Illuminate\Translation\TranslationServiceProvider::class,
147 | Illuminate\Validation\ValidationServiceProvider::class,
148 | Illuminate\View\ViewServiceProvider::class,
149 |
150 | /*
151 | * Package Service Providers...
152 | */
153 |
154 | /*
155 | * Application Service Providers...
156 | */
157 | App\Providers\AppServiceProvider::class,
158 | App\Providers\AuthServiceProvider::class,
159 | // App\Providers\BroadcastServiceProvider::class,
160 | App\Providers\EventServiceProvider::class,
161 | App\Providers\RouteServiceProvider::class,
162 | Weidner\Goutte\GoutteServiceProvider::class,
163 | ],
164 |
165 | /*
166 | |--------------------------------------------------------------------------
167 | | Class Aliases
168 | |--------------------------------------------------------------------------
169 | |
170 | | This array of class aliases will be registered when this application
171 | | is started. However, feel free to register as many as you wish as
172 | | the aliases are "lazy" loaded so they don't hinder performance.
173 | |
174 | */
175 |
176 | 'aliases' => [
177 |
178 | 'App' => Illuminate\Support\Facades\App::class,
179 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
180 | 'Auth' => Illuminate\Support\Facades\Auth::class,
181 | 'Blade' => Illuminate\Support\Facades\Blade::class,
182 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
183 | 'Bus' => Illuminate\Support\Facades\Bus::class,
184 | 'Cache' => Illuminate\Support\Facades\Cache::class,
185 | 'Config' => Illuminate\Support\Facades\Config::class,
186 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
187 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
188 | 'DB' => Illuminate\Support\Facades\DB::class,
189 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
190 | 'Event' => Illuminate\Support\Facades\Event::class,
191 | 'File' => Illuminate\Support\Facades\File::class,
192 | 'Gate' => Illuminate\Support\Facades\Gate::class,
193 | 'Hash' => Illuminate\Support\Facades\Hash::class,
194 | 'Lang' => Illuminate\Support\Facades\Lang::class,
195 | 'Log' => Illuminate\Support\Facades\Log::class,
196 | 'Mail' => Illuminate\Support\Facades\Mail::class,
197 | 'Notification' => Illuminate\Support\Facades\Notification::class,
198 | 'Password' => Illuminate\Support\Facades\Password::class,
199 | 'Queue' => Illuminate\Support\Facades\Queue::class,
200 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
201 | 'Redis' => Illuminate\Support\Facades\Redis::class,
202 | 'Request' => Illuminate\Support\Facades\Request::class,
203 | 'Response' => Illuminate\Support\Facades\Response::class,
204 | 'Route' => Illuminate\Support\Facades\Route::class,
205 | 'Schema' => Illuminate\Support\Facades\Schema::class,
206 | 'Session' => Illuminate\Support\Facades\Session::class,
207 | 'Storage' => Illuminate\Support\Facades\Storage::class,
208 | 'URL' => Illuminate\Support\Facades\URL::class,
209 | 'Validator' => Illuminate\Support\Facades\Validator::class,
210 | 'View' => Illuminate\Support\Facades\View::class,
211 | 'Goutte' => Weidner\Goutte\GoutteFacade::class,
212 | ],
213 |
214 | ];
215 |
--------------------------------------------------------------------------------