Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120836315
FsItemInfoResource.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
FsItemInfoResource.php
View Options
<?php
namespace
App\Http\Resources
;
use
App\Fs\Item
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Auth
;
/**
* Filesystem item information response
*
* @mixin Item
*/
class
FsItemInfoResource
extends
FsItemResource
{
public
?
string
$downloadUrl
=
null
;
/**
* Transform the resource into an array.
*/
public
function
toArray
(
Request
$request
):
array
{
// TODO: Handle read-write/full access rights
$isOwner
=
Auth
::
guard
()->
user
()->
id
==
$this
->
resource
->
user_id
;
$parent
=
$this
->
resource
->
parents
()->
first
();
return
[
$this
->
merge
(
parent
::
toArray
(
$request
)),
'canUpdate'
=>
$isOwner
,
'canDelete'
=>
$isOwner
,
'isOwner'
=>
$isOwner
,
// @var string Unauthenticated doawnload location for the file content
'downloadUrl'
=>
$this
->
when
(!
empty
(
$this
->
downloadUrl
),
$this
->
downloadUrl
),
// @var ?string Parent folder identifier
'parentId'
=>
$parent
?->
id
,
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:28 PM (11 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18844009
Default Alt Text
FsItemInfoResource.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline