@@ -9,17 +9,19 @@ class File extends JsonResource
9
9
{
10
10
public function toArray ($ request )
11
11
{
12
- return [
13
- 'id ' => $ this ->id ,
14
- 'name ' => $ this ->original_name ,
15
- 'size ' => $ this ->size ,
16
- 'mimeType ' => $ this ->mime_type ,
17
- 'type ' => $ this ->type (),
18
- 'owner ' => new User ($ this ->whenLoaded ('createdBy ' )),
19
- 'isDestroyable ' => $ this ->destroyableBy ($ request ->user ()),
20
- 'isShareable ' => $ this ->shareableBy ($ request ->user ()),
21
- 'isViewable ' => $ this ->viewableBy ($ request ->user ()),
22
- 'createdAt ' => $ this ->created_at ->toDatetimeString (),
23
- ];
12
+ return $ this ->id
13
+ ? [
14
+ 'id ' => $ this ->id ,
15
+ 'name ' => $ this ->original_name ,
16
+ 'size ' => $ this ->size ,
17
+ 'mimeType ' => $ this ->mime_type ,
18
+ 'type ' => $ this ->type (),
19
+ 'owner ' => new User ($ this ->whenLoaded ('createdBy ' )),
20
+ 'isDestroyable ' => $ this ->destroyableBy ($ request ->user ()),
21
+ 'isShareable ' => $ this ->shareableBy ($ request ->user ()),
22
+ 'isViewable ' => $ this ->viewableBy ($ request ->user ()),
23
+ 'createdAt ' => $ this ->created_at ->toDatetimeString (),
24
+ ]
25
+ : null ;
24
26
}
25
27
}
0 commit comments