Skip to content

novaday-co/laravel-api-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel API Response package

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();