You've already forked isop-mirror
fix: retrieve first company and student data directly for user endpoint
This commit is contained in:
@@ -8,11 +8,11 @@ use Illuminate\Support\Facades\Route;
|
||||
Route::middleware(['auth:sanctum'])->get('/user', function (Request $request) {
|
||||
$user = $request->user();
|
||||
|
||||
$company_data = Company::whereContact($user->id)->get();
|
||||
$student_data = StudentData::whereUserId($user->id)->get();
|
||||
$company_data = Company::whereContact($user->id)->get()->first();
|
||||
$student_data = StudentData::whereUserId($user->id)->get()->first();
|
||||
|
||||
$user->company_data = $company_data->isEmpty() ? null : $company_data;
|
||||
$user->student_data = $student_data->isEmpty() ? null : $student_data;
|
||||
$user->company_data = $company_data;
|
||||
$user->student_data = $student_data;
|
||||
|
||||
return $user;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user