Skip to content

Commit ad9cbc8

Browse files
committed
#1 컬럼명 변경
1 parent 421a6e7 commit ad9cbc8

File tree

7 files changed

+56
-59
lines changed

7 files changed

+56
-59
lines changed

config.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
'notify' => ['subject' => '휴면게정 처리 예정 안내', 'content' => function($user, $type, $config) {
1717

1818
if($config['freeze_type'] === 'freeze') {
19-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 휴면 상태로 전환될 예정입니다. <br> 휴면상태로 전환된 후에는 개인정보를 분리하여 보관하게 됩니다. 차후 휴면 상태로 전환된 계정으로 다시 서비스를 이용하기 위해서는 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인을 하시면 됩니다. 감사합니다 ";
19+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 휴면 상태로 전환될 예정입니다. <br> 휴면상태로 전환된 후에는 개인정보를 분리하여 보관하게 됩니다. 차후 휴면 상태로 전환된 계정으로 다시 서비스를 이용하기 위해서는 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인을 하시면 됩니다. 감사합니다 ";
2020
} else {
21-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 탈퇴 처리될 예정입니다. <br> 탈퇴 처리된 후에는 다시 서비스를 이용하기 위해 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입하여야 합니다. 감사합니다 ";
21+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 탈퇴 처리될 예정입니다. <br> 탈퇴 처리된 후에는 다시 서비스를 이용하기 위해 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입하여야 합니다. 감사합니다 ";
2222
}
2323
}],
2424
'freeze' => ['subject' => '휴면계정 처리 결과 안내', 'content' => function($user, $type, $config) {
25-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 휴면 상태로 전환되었습니다. <br> 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인하실 경우 계정이 복구되며, 서비스를 정상적으로 다시 이용할 수 있습니다. 감사합니다 ";
25+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 휴면 상태로 전환되었습니다. <br> 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인하실 경우 계정이 복구되며, 서비스를 정상적으로 다시 이용할 수 있습니다. 감사합니다 ";
2626
}],
2727
'delete' => ['subject' => '휴면계정 삭제처리 안내', 'content' => function($user, $type, $config) {
28-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 탈퇴 처리되었습니다. <br> 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입후 서비스를 다시 이용할 수 있습니다. 감사합니다 ";
28+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 탈퇴 처리되었습니다. <br> 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입후 서비스를 다시 이용할 수 있습니다. 감사합니다 ";
2929
}],
3030
'unfreeze' => ['subject' => '휴면개정 복구 결과 안내', 'content' => function($user, $type, $config) {
3131
return "{$user->getDisplayName()}님, 장기간 서비스를 이용하지 않아 분리 보관했던 계정 정보가 다시 정상적으로 복구되었습니다. <br> 이제부터 서비스를 다시 이용할 수 있습니다 ";

plugin.php

+28-28
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ function ($target, $name) {
156156

157157
$result = $target($name);
158158
if($result === true) {
159-
$frozenId = app('freezer::handler')->attempt(['displayName' => $name]);
159+
$frozenId = app('freezer::handler')->attempt(['display_name' => $name]);
160160
if($frozenId !== null) {
161161
throw new DisplayNameAlreadyExistsException();
162162
}
@@ -255,18 +255,18 @@ public function install()
255255
$table->engine = "InnoDB";
256256

257257
$table->string('id', 36);
258-
$table->string('displayName', 255)->unique();
258+
$table->string('display_name', 255)->unique();
259259
$table->string('email', 255)->nullable();
260260
$table->string('password', 255)->nullable();
261261
$table->string('rating', 15)->default('member');
262262
$table->char('status', 20);
263263
$table->text('introduction')->default(null)->nullable();
264-
$table->string('profileImageId', 36)->nullable();
265-
$table->string('rememberToken', 255)->nullable();
266-
$table->timestamp('loginAt');
267-
$table->timestamp('createdAt')->index();
268-
$table->timestamp('updatedAt')->index();
269-
$table->timestamp('passwordUpdatedAt');
264+
$table->string('profile_image_id', 36)->nullable();
265+
$table->string('remember_token', 255)->nullable();
266+
$table->timestamp('login_at');
267+
$table->timestamp('created_at')->index();
268+
$table->timestamp('updated_at')->index();
269+
$table->timestamp('password_updated_at');
270270

271271
$table->primary('id');
272272
});
@@ -277,13 +277,13 @@ public function install()
277277
$table->engine = "InnoDB";
278278

279279
$table->increments('id');
280-
$table->string('groupId', 36);
281-
$table->string('userId', 36);
282-
$table->timestamp('createdAt');
280+
$table->string('group_id', 36);
281+
$table->string('user_id', 36);
282+
$table->timestamp('created_at');
283283

284-
$table->unique(['groupId','userId']);
285-
$table->index('groupId');
286-
$table->index('userId');
284+
$table->unique(['group_id','user_id']);
285+
$table->index('group_id');
286+
$table->index('user_id');
287287
});
288288
}
289289

@@ -292,18 +292,18 @@ public function install()
292292
$table->engine = "InnoDB";
293293

294294
$table->string('id', 36);
295-
$table->string('userId');
296-
$table->string('accountId');
295+
$table->string('user_id');
296+
$table->string('account_id');
297297
$table->string('email')->nullable();
298298
$table->char('provider', 20);
299299
$table->string('token', 500);
300-
$table->string('tokenSecret', 500);
300+
$table->string('token_secret', 500);
301301
$table->string('data');
302-
$table->timestamp('createdAt');
303-
$table->timestamp('updatedAt');
302+
$table->timestamp('created_at');
303+
$table->timestamp('updated_at');
304304

305305
$table->primary('id');
306-
$table->unique(['provider','accountId']);
306+
$table->unique(['provider','account_id']);
307307
});
308308
}
309309

@@ -312,12 +312,12 @@ public function install()
312312
$table->engine = "InnoDB";
313313

314314
$table->increments('id');
315-
$table->string('userId', 36);
315+
$table->string('user_id', 36);
316316
$table->string('address');
317-
$table->timestamp('createdAt')->index();
318-
$table->timestamp('updatedAt');
317+
$table->timestamp('created_at')->index();
318+
$table->timestamp('updated_at');
319319

320-
$table->index('userId');
320+
$table->index('user_id');
321321
$table->index('address');
322322
});
323323
}
@@ -327,13 +327,13 @@ public function install()
327327
$table->engine = "InnoDB";
328328

329329
$table->increments('id');
330-
$table->string('userId', 36);
330+
$table->string('user_id', 36);
331331
$table->string('action', 20); // freeze, delete, unfreeze, notify
332332
$table->string('result', 20); // successd, failed
333333
$table->string('content');
334-
$table->timestamp('createdAt')->index();
335-
$table->timestamp('updatedAt');
336-
$table->index('userId');
334+
$table->timestamp('created_at')->index();
335+
$table->timestamp('updated_at');
336+
$table->index('user_id');
337337
});
338338
}
339339
}

services.php.example

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ return [
1313
'email' => [
1414
'notify' => ['subject' => '휴면게정 처리 예정 안내', 'content' => function($user, $type, $config) {
1515
if($config['freeze_type'] === 'freeze') {
16-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 휴면 상태로 전환될 예정입니다. <br> 휴면상태로 전환된 후에는 개인정보를 분리하여 보관하게 됩니다. 차후 휴면 상태로 전환된 계정으로 다시 서비스를 이용하기 위해서는 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인을 하시면 됩니다. 감사합니다 ";
16+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 휴면 상태로 전환될 예정입니다. <br> 휴면상태로 전환된 후에는 개인정보를 분리하여 보관하게 됩니다. 차후 휴면 상태로 전환된 계정으로 다시 서비스를 이용하기 위해서는 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인을 하시면 됩니다. 감사합니다 ";
1717
} else {
18-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 탈퇴 처리될 예정입니다. <br> 탈퇴 처리된 후에는 다시 서비스를 이용하기 위해 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입하여야 합니다. 감사합니다 ";
18+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 11개월간 이용되지 않아 1개월 후 탈퇴 처리될 예정입니다. <br> 탈퇴 처리된 후에는 다시 서비스를 이용하기 위해 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입하여야 합니다. 감사합니다 ";
1919
}
2020
}],
2121
'freeze' => ['subject' => '휴면계정 처리 결과 안내', 'content' => function($user, $type, $config) {
22-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 휴면 상태로 전환되었습니다. <br> 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인하실 경우 계정이 복구되며, 서비스를 정상적으로 다시 이용할 수 있습니다. 감사합니다 ";
22+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 휴면 상태로 전환되었습니다. <br> 사이트의 <a href=\"{route('login')}\">로그인</a> 페이지에서 다시 로그인하실 경우 계정이 복구되며, 서비스를 정상적으로 다시 이용할 수 있습니다. 감사합니다 ";
2323
}],
2424
'delete' => ['subject' => '휴면계정 삭제처리 안내', 'content' => function($user, $type, $config) {
25-
return "{$user->getDisplayName()}님, {$user->createdAt->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 탈퇴 처리되었습니다. <br> 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입후 서비스를 다시 이용할 수 있습니다. 감사합니다 ";
25+
return "{$user->getDisplayName()}님, {$user->created_at->format('Y년 m월 d일')}에 가입한 계정이 최근 1년간 이용되지 않아 탈퇴 처리되었습니다. <br> 사이트의 <a href=\"{route('auth.register')}\">회원가입</a> 페이지에서 새로운 계정으로 가입후 서비스를 다시 이용할 수 있습니다. 감사합니다 ";
2626
}],
2727
'unfreeze' => ['subject' => '휴면개정 복구 결과 안내', 'content' => function($user, $type, $config) {
2828
return "{$user->getDisplayName()}님, 장기간 서비스를 이용하지 않아 분리 보관했던 계정 정보가 다시 정상적으로 복구되었습니다. <br> 이제부터 서비스를 다시 이용할 수 있습니다 ";

src/Commands/UnfreezeCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function handle()
5252

5353
if ($this->input->isInteractive() && $this->confirm(
5454
// 총 x명의 회원을 휴면처리 하려고 합니다. 실행하시겠습니까?
55-
"'{$userInfo->displayName}' users will be unfreezed. Do you want to execute it?"
55+
"'{$userInfo->display_name}' users will be unfreezed. Do you want to execute it?"
5656
) === false
5757
) {
5858
$this->warn('Process is canceled by you.');

src/Handler.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ public function choose($action = 'freeze')
6969
if ($action === 'freeze') {
7070
$duration = $this->config('timer');
7171
$eventDate = Carbon::now()->subDays($duration);
72-
$users = $this->handler->where('loginAt', '<', $eventDate)->get();
72+
$users = $this->handler->where('login_at', '<', $eventDate)->get();
7373
} elseif ($action === 'notify') {
7474
$duration = $this->config('notify_timer');
7575
$eventDate = Carbon::now()->subDays($duration);
76-
$candidates = User::where('loginAt', '<', $eventDate)->with(
76+
$candidates = User::where('login_at', '<', $eventDate)->with(
7777
[
7878
'freeze_logs' => function ($q) {
79-
return $q->orderBy('createdAt', 'desc');
79+
return $q->orderBy('created_at', 'desc');
8080
}
8181
]
8282
)->get();
@@ -246,24 +246,24 @@ protected function moveData($type, $user_id)
246246

247247
// copy user_account table
248248
$table = ['origin' => 'user_account', 'target' => 'freezer_user_account'];
249-
$accounts = DB::table($table[$origin])->where('userId', $user_id)->get();
250-
DB::table($table[$origin])->where('userId', $user_id)->delete();
249+
$accounts = DB::table($table[$origin])->where('user_id', $user_id)->get();
250+
DB::table($table[$origin])->where('user_id', $user_id)->delete();
251251
foreach ($accounts as $account) {
252252
DB::table($table[$target])->insert((array) $account);
253253
}
254254

255255
// copy user_email table
256256
$table = ['origin' => 'user_email', 'target' => 'freezer_user_email'];
257-
$emails = DB::table($table[$origin])->where('userId', $user_id)->get();
258-
DB::table($table[$origin])->where('userId', $user_id)->delete();
257+
$emails = DB::table($table[$origin])->where('user_id', $user_id)->get();
258+
DB::table($table[$origin])->where('user_id', $user_id)->delete();
259259
foreach ($emails as $email) {
260260
DB::table($table[$target])->insert((array) $email);
261261
}
262262

263263
// copy user_group_user
264264
$table = ['origin' => 'user_group_user', 'target' => 'freezer_user_group_user'];
265-
$group_users = DB::table($table[$origin])->where('userId', $user_id)->get();
266-
DB::table($table[$origin])->where('userId', $user_id)->delete();
265+
$group_users = DB::table($table[$origin])->where('user_id', $user_id)->get();
266+
DB::table($table[$origin])->where('user_id', $user_id)->delete();
267267
foreach ($group_users as $group) {
268268
DB::table($table[$target])->insert((array) $group);
269269
}
@@ -273,7 +273,7 @@ protected function logging($user_id, $action, $content = [], $result = 'successd
273273
{
274274
// type = freeze, delete, unfreeze, notify
275275
$log = new Log();
276-
$log->userId = $user_id;
276+
$log->user_id = $user_id;
277277
$log->action = $action;
278278
$log->result = $result;
279279
$log->content = $content;
@@ -321,26 +321,26 @@ public function attempt($credentials = [])
321321

322322
// account info가 freeze 되어 있다면 바로 반환
323323
// email info가 freeze 되어 있다면,
324-
$accountInfo = DB::table('freezer_user_account')->where('accountId', $account_id)->first();
324+
$accountInfo = DB::table('freezer_user_account')->where('account_id', $account_id)->first();
325325
if ($accountInfo !== null) {
326-
return $accountInfo->userId;
326+
return $accountInfo->user_id;
327327
} elseif ($email !== null) {
328328
$emailInfo = DB::table('freezer_user_email')->where('address', $email)->first();
329329
if ($emailInfo !== null) {
330-
return $emailInfo->userId;
330+
return $emailInfo->user_id;
331331
}
332332
}
333-
} elseif (array_has($credentials, 'displayName')) { // 이름 검사
334-
$name = array_get($credentials, 'displayName');
335-
$userInfo = DB::table('freezer_user')->where('displayName', $name)->first();
333+
} elseif (array_has($credentials, 'display_name')) { // 이름 검사
334+
$name = array_get($credentials, 'display_name');
335+
$userInfo = DB::table('freezer_user')->where('display_name', $name)->first();
336336
if ($userInfo !== null) {
337337
return $userInfo->id;
338338
}
339339
} elseif (array_has($credentials, 'address')) { // 이메일 검사
340340
$address = array_get($credentials, 'address');
341341
$emailInfo = DB::table('freezer_user_email')->where('address', $address)->first();
342342
if ($emailInfo !== null) {
343-
return $emailInfo->userId;
343+
return $emailInfo->user_id;
344344
}
345345
}
346346

src/Models/Log.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
*/
2626
class Log extends Model
2727
{
28-
const CREATED_AT = 'createdAt';
29-
const UPDATED_AT = 'updatedAt';
30-
3128
protected $table = 'freezer_log';
3229

3330
public $timestamps = true;
@@ -38,7 +35,7 @@ class Log extends Model
3835

3936
public function user()
4037
{
41-
$this->belongsTo(User::class, 'userId');
38+
$this->belongsTo(User::class, 'user_id');
4239
}
4340

4441
}

src/Models/User.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ class User extends OriginUser
2828
{
2929
public function freeze_logs()
3030
{
31-
return $this->hasMany(Log::class, 'userId');
31+
return $this->hasMany(Log::class, 'user_id');
3232
}
3333
}

0 commit comments

Comments
 (0)