PHP code example of ihor-radchenko / laravel-ide-helper-macros
1. Go to this page and download the library: Download ihor-radchenko/laravel-ide-helper-macros 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/ */
ihor-radchenko / laravel-ide-helper-macros example snippets
/**
* Bootstrap services.
*
* @return void
*/
public function boot(): void
{
/**
* @param array $data
*
* @return \Illuminate\Http\Response
*/
\Illuminate\Http\Response::macro('addContent', function (array $data) {
/** @var \Illuminate\Http\Response $this */
$response = $this;
$content = json_decode($response->getContent(), true);
if (is_array($content)) {
$response->setContent(json_encode(array_merge($content, $data)));
}
return $response;
});
}
/**
* Illuminate\Http\Response
*
* @method \Illuminate\Http\Response addContent(array $data)
* @package ide_helper_macros
*/
class Response extends BaseResponse
{
php artisan vendor:publish --provider="IhorRadchenko\LaravelIdeHelperMacros\IdeHelperMacrosServiceProvider"
php artisan ide-helper:macros