for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Port\Transformer\Abstracts;
use App\Containers\Authentication\Tasks\GetAuthenticatedUserTask;
use Illuminate\Support\Facades\App;
use League\Fractal\TransformerAbstract as FractalTransformerAbstract;
/**
* Class Transformer.
*
* @author Mahmoud Zalt <[email protected]>
*/
abstract class Transformer extends FractalTransformerAbstract
{
* @return mixed
public function user()
return App::make(GetAuthenticatedUserTask::class)->run();
}
* @param $adminResponse
* @param $clientResponse
* @return array
public function ifAdmin($adminResponse, $clientResponse)
if ($this->user()->hasAdminRole()) {
return array_merge($clientResponse, $adminResponse);
return $clientResponse;