feat : 내 정보 조회 API 추가
This commit is contained in:
@@ -11,7 +11,7 @@ class Member extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, Notifiable, TwoFactorAuthenticatable;
|
||||
|
||||
protected $primaryKey = 'mb_id'; // 기본 키 변경
|
||||
protected $primaryKey = 'mb_num'; // 기본 키 변경
|
||||
|
||||
protected $fillable = [
|
||||
'mb_id', 'mb_pass', 'mb_name', 'mb_phone', 'mb_mail',
|
||||
@@ -36,4 +36,10 @@ public function getAuthIdentifierName()
|
||||
{
|
||||
return 'mb_id'; // 기본 로그인 필드를 mb_id로 변경
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo(MemberCompany::class, 'tn_num', 'mc_num');
|
||||
// members.tn_num = member_company.mc_num
|
||||
}
|
||||
}
|
||||
|
||||
17
app/Models/MemberCompany.php
Normal file
17
app/Models/MemberCompany.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
|
||||
class MemberCompany extends Model
|
||||
{
|
||||
protected $table = 'member_company';
|
||||
protected $primaryKey = 'mc_num'; // 기본 키 변경
|
||||
|
||||
public function members()
|
||||
{
|
||||
return $this->hasMany(Member::class, 'tn_num', 'mc_num');
|
||||
// member_company.mc_num = members.tn_num
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user