Enhance get_testing_data response with additional fields as requested_date and null safety
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Plant;
|
||||
use App\Models\User;
|
||||
//use Carbon\Carbon;
|
||||
use Hash;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -83,10 +84,11 @@ class UserController extends Controller
|
||||
//$user = User::where('email', $email)->first();
|
||||
if (Hash::check($header_pass, $existUser->password)) {
|
||||
return response()->json([
|
||||
'created_at' => $existUser->created_at->format('Y-m-d H:i:s'),
|
||||
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s'),
|
||||
'plant' => (String)$existPlant,
|
||||
'email' => $existUser->email,
|
||||
'created_at' => $existUser->created_at->format('Y-m-d H:i:s') ?? "",
|
||||
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s') ?? "",
|
||||
'requested_at' => now()->format('Y-m-d H:i:s') ?? "", //Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s') ?? "",
|
||||
'plant' => (String)$existPlant ?? "",
|
||||
'email' => $existUser->email ?? "",
|
||||
'roles' => $existUser->roles()->pluck('name')->toArray()
|
||||
], 200);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user