Skip to content

v1.0.0

Latest
Compare
Choose a tag to compare
@FabrizioCafolla FabrizioCafolla released this 02 May 18:49
· 0 commits to master since this release

KosmosX Support

composer require kosmosx/support

Register service poviders

/Kosmosx/Support/SupportServiceProvider::class

Use it

$support = app('factory.support');

$statusSuccess = $support->success(200, $var, 'message...'); //return object StatusService 
$statusFail = $support->fail(400, $var, 'message...');       //return object StatusService


$statusFail->isSuccess() //return false
$statusFail->isFail()    //return true
$statusFail->toArray()
//result
[
    "success"=>false,
    "data"=>[...],
    "message"=>"message...",
    "statusCode"=>200
]

$api = $support->api()
$api->collection($data, $transformer, $includesData = null, $serializer = null) //Create collection with data Transformer