\App\Http\ResourcesOffer

Offer JSON resource

Summary

Methods
Properties
Constants
toArray()
No public properties found
No constants found
getUser()
whenAdmin()
whenLoggedIn()
whenOwned()
getOwnedBy()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

toArray()

toArray(  $request) : array

Transform the resource into an array.

Parameters

$request

Returns

array

getUser()

getUser() : \App\User|null

Get currently authorized user

Returns

\App\User|null

whenAdmin()

whenAdmin(mixed  $value, mixed  $default = null) : \Illuminate\Http\Resources\MissingValue|mixed

Retrieve a value based on whether the user has admin privileges

Parameters

mixed $value
mixed $default

Returns

\Illuminate\Http\Resources\MissingValue|mixed

whenLoggedIn()

whenLoggedIn(mixed  $value, mixed  $default = null) : \Illuminate\Http\Resources\MissingValue|mixed

Retrieve a value based on whether the user is logged in

Parameters

mixed $value
mixed $default

Returns

\Illuminate\Http\Resources\MissingValue|mixed

whenOwned()

whenOwned(mixed  $value, mixed  $default = null) : \Illuminate\Http\Resources\MissingValue|mixed

Retrieve a value based on whether the model is owned by the logged in user

Parameters

mixed $value
mixed $default

Returns

\Illuminate\Http\Resources\MissingValue|mixed

getOwnedBy()

getOwnedBy(\App\User  $user) 

Parameters

\App\User $user