iwedmak/helper
laravel-5-helper
FormatResponce
To return json or html on same route. Register Middleware, add this to app/Http/Kernel.php in middlewareGroups array in web, as last one of them:
iWedmak\Helper\Middleware\FormatResponce::class,
now you can return array from your controllers this way:
return ['data'=>$data, 'view'=>'someview'];
check looks like that:
$response = $next($request);
try
{
if (method_exists($response, 'getOriginalContent'))
{
$data = $response->getOriginalContent();
if(isset($data['data']) && !empty($data['data']))
{
if ($request->wantsJson())
{
$response=response()->json($data['data']);
$response->header('Content-Length',mb_strlen($response->getContent()));
}
else
{
$response=response()->view($data['view'], $data['data']);
}
}
}
}
catch(BadMethodCallException $e)
{
}
return $response;
xCache
Register provider, add this to config/app.php in providers array:
iWedmak\Helper\Providers\CacheServiceProvider::class,
Register xcache driver, add this to config/cache.php in stores array:
'xcache' => [
'driver' => 'xcache',
],
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
641,106,524
9,700
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
418,291,778
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
399,241,428
4,660
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 0.0.5 | >=5.5.0 | 5.* | MIT | |
| 0.0.4 | >=5.5.0 | 5.* | MIT | |
| 0.0.3 | >=5.5.0 | 5.* | MIT | |
| 0.0.2 | >=5.5.0 | 5.* | MIT | |
| 0.0.1 | >=5.5.0 | 5.* | MIT |