KosmosX / support by Fabrizio Cafolla

Utilities support.
148
0
2
Package Data
Maintainer Username: Fabrizio Cafolla
Maintainer Contact: developer@fabriziocafolla.com (Fabrizio Cafolla)
Package Create Date: 2019-04-28
Package Last Update: 2019-08-24
Language: PHP
License: MIT
Last Refreshed: 2024-12-13 15:00:40
Package Statistics
Total Downloads: 148
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

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