1. Go to this page and download the library: Download acelords/generators library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
acelords / generators example snippets
/**
* return a standardized error message
*
* @param string $message
* @param int $code
*
* @return \Illuminate\Http\JsonResponse
*/
public function respError($message = 'An error occurred', $code = 422)
{
return response()->json([
'message' => $message,
'alert' => 'error',
], $code);
}
/**
* return a standardized success message
*
* @param string $message
* @param int $code
*
* @return \Illuminate\Http\JsonResponse
*/
public function respSuccess($message = 'Action Successful', $code = 200)
{
return response()->json([
'message' => $message,
'alert' => 'success',
], $code);
}
/**
* provide a common function to return messages to the user
*
* @param $result
* @param string $messageOnSuccess
* @param string $messageOnError
*
* @return \Illuminate\Http\JsonResponse
*/
public function respJuicer($result, $messageOnSuccess = 'Action Successful', $messageOnError = 'An error occurred')
{
if($result)
return $this->respSuccess($messageOnSuccess);
return $this->respError($messageOnError);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.