v1.6 released

This commit is contained in:
carodej
2020-05-28 13:00:54 +02:00
parent a76d1dec3b
commit 252b6fd0bf
63 changed files with 1205 additions and 938 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Resources;
use Faker\Factory;
use Illuminate\Http\Resources\Json\JsonResource;
class UserResource extends JsonResource
@@ -14,18 +15,22 @@ class UserResource extends JsonResource
*/
public function toArray($request)
{
// Faker only for demo purpose
$faker = Factory::create();
return [
'data' => [
'id' => (string)$this->id,
'type' => 'user',
'attributes' => [
'name' => $this->name,
'email' => $this->email,
'avatar' => $this->avatar,
'role' => $this->role,
'storage' => $this->storage,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'name' => env('APP_DEMO') ? $faker->name : $this->name,
'email' => env('APP_DEMO') ? $faker->email : $this->email,
'avatar' => $this->avatar,
'role' => $this->role,
'storage' => $this->storage,
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]
]
];