mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
added relationship for company and user
This commit is contained in:
@@ -9,4 +9,9 @@ class Company extends Model
|
||||
//
|
||||
protected $fillable = ['company_profile', 'reg_cert', 'company_name', 'registration_no', 'tax_no', 'tel_no', 'fax', 'address', 'city', 'postcode', 'state', 'country', 'contact_person'];
|
||||
//protected $guarded = [];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ class AuthController extends Controller
|
||||
return response()->json(['error' => 'invalid_credentials'], 401);
|
||||
}
|
||||
|
||||
// TODO : Create company for user
|
||||
|
||||
|
||||
$expiration = JWTAuth::setToken($userToken)->getPayload()->get('exp');
|
||||
// all good so return the token
|
||||
return response()->json(['success' => true, 'token' => $userToken,
|
||||
|
||||
@@ -54,4 +54,9 @@ class User extends Authenticatable implements JWTSubject
|
||||
return $this->hasOne('App\UserVerification', 'user_id');
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->hasOne('App\Company');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user