restore composer.json, add mysqli extension
This commit is contained in:
32
app/Http/Resources/OrderResource.php
Executable file
32
app/Http/Resources/OrderResource.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class OrderResource extends JsonResource
|
||||
{
|
||||
public static $wrap = false;
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
$lang = $request->header('Accept-Language') ?? 'ru';
|
||||
|
||||
// Set the application locale to the retrieved language
|
||||
App::setLocale($lang);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'status' => new StatusResource($this->getStatus),
|
||||
'created_at' => $this->created_at->format('Y-m-d H:i:s'),
|
||||
'total_amount' => $this->price_total,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user