Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120840050
PlanResource.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
PlanResource.php
View Options
<?php
namespace
App\Http\Resources
;
use
App\Http\Controllers\Controller
;
use
App\Plan
;
use
Illuminate\Http\Request
;
/**
* Plan response
*
* @mixin Plan
*/
class
PlanResource
extends
ApiResource
{
/**
* Transform the resource into an array.
*/
public
function
toArray
(
Request
$request
):
array
{
$button
=
Controller
::
trans
(
"app.planbutton-{$this->resource->title}"
);
if
(
str_contains
(
$button
,
'app.planbutton'
))
{
$button
=
Controller
::
trans
(
'app.planbutton'
,
[
'plan'
=>
$this
->
resource
->
name
]);
}
return
[
// @var string Plan identifier
'id'
=>
$this
->
resource
->
id
,
// @var string Plan title (identifier)
'title'
=>
$this
->
resource
->
title
,
// @var string Plan name
'name'
=>
$this
->
resource
->
name
,
// @var string Plan description
'description'
=>
$this
->
resource
->
description
,
// @var string Button label
'button'
=>
$button
,
// @var string Plan mode (email, token, mandate, etc.)
'mode'
=>
$this
->
resource
->
mode
?:
Plan
::
MODE_EMAIL
,
// @var bool Is the plan viable for a custom domain?
'isDomain'
=>
$this
->
resource
->
hasDomain
(),
// @var int Minimum number of months this plan is for
'months'
=>
$this
->
resource
->
months
,
// @var int Cumulative cost (in cents)
'cost'
=>
$this
->
resource
->
cost
(),
// Cost currency
'currency'
=>
\config
(
'app.currency'
),
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 2:21 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18739998
Default Alt Text
PlanResource.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline