laravel-api-response maintained by novaday-co
Description
This Package helps developers to easily make response for API
Author
Last update
2021/08/03 06:18
(dev-master)
License
Downloads
1
Tags
Laravel API Response
This Package helps developers to easily make response for API . Add extra data to collection response . Short magic method that use your translate files to set messages .
How to install :
composer require novaday-co/laravel-api-response
How to use :
Success response
Api::success("Successful Action")->response();
Success response
Api::success("Successful Action")->response();
Failure response
Api::failure("Failed")->response();
Custom response
Api::customResponse(201,'Created Successfully',['key'=>'value'])->response();
With data
Api::success('Ok',['key'=>'value'])->response();
External data in data
Api::success('Ok',[ User::all() ])->withData([ Customer::first() ])->response();
External data next to data
Api::success('Ok',[ User::all() ])->with([ 'Customers' => Customer::all() ])->response();
Short magic method for set messages
Api::updated()->response();