Skip to content

Commit

Permalink
implement codes that moved form core to ship
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammad-Alavi committed Sep 29, 2021
1 parent b67c0b6 commit d39dd05
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/Ship/Parents/Transformers/Transformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@
namespace App\Ship\Parents\Transformers;

use Apiato\Core\Abstracts\Transformers\Transformer as AbstractTransformer;
use Illuminate\Support\Facades\Auth;

abstract class Transformer extends AbstractTransformer
{
/**
* @param $adminResponse
* @param $clientResponse
*
* @return array
*/
public function ifAdmin($adminResponse, $clientResponse): array
{
$user = Auth::user();

if (!is_null($user) && $user->hasAdminRole()) {
return array_merge($clientResponse, $adminResponse);
}

return $clientResponse;
}
}

0 comments on commit d39dd05

Please sign in to comment.