You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-1
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,53 @@ All you need to do is to run the following command:
18
18
php artisan alibori:api-resource <model-name>
19
19
```
20
20
21
-
This command will generate a new resource for the given model name with the properties defined in the model.
21
+
This command will generate a new resource for the given model name with the properties defined in the model. For example, for the model named `User` you will get the following resource:
22
+
23
+
```php
24
+
<?php
25
+
26
+
namespace App\Http\Resources;
27
+
28
+
use Illuminate\Contracts\Support\Arrayable;
29
+
use Illuminate\Http\Request;
30
+
use Illuminate\Http\Resources\Json\JsonResource;
31
+
use JsonSerializable;
32
+
33
+
/**
34
+
*
35
+
*
36
+
* @property $id
37
+
* @property $name
38
+
* @property $email
39
+
* @property $email_verified_at
40
+
* @property $password
41
+
* @property $remember_token
42
+
* @property $created_at
43
+
* @property $updated_at
44
+
*/
45
+
class UserResource extends JsonResource
46
+
{
47
+
/**
48
+
* Transform the resource into an array.
49
+
*
50
+
* @param Request $request
51
+
* @return array|Arrayable|JsonSerializable
52
+
*/
53
+
public function toArray($request): array|JsonSerializable|Arrayable
0 commit comments