mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
Refactor for API
This commit is contained in:
parent
a331368383
commit
d5d1d7d9a3
@ -147,9 +147,6 @@ class BaseController extends Controller
|
||||
|
||||
$data = $this->createCollection($query, $transformer, $this->entity_type);
|
||||
|
||||
if(request()->include_static)
|
||||
$data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
||||
|
||||
return $this->response($data);
|
||||
|
||||
}
|
||||
@ -195,6 +192,10 @@ class BaseController extends Controller
|
||||
$response['meta'] = $meta;
|
||||
unset($response[$index]['meta']);
|
||||
}
|
||||
|
||||
if(request()->include_static)
|
||||
$response['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
|
||||
|
||||
}
|
||||
|
||||
$response = json_encode($response, JSON_PRETTY_PRINT);
|
||||
|
@ -45,7 +45,7 @@ class CompanyUserTransformer extends EntityTransformer
|
||||
|
||||
public function transform(CompanyUser $company_user)
|
||||
{
|
||||
return ['company_user' => [
|
||||
return [
|
||||
'permissions' => $company_user->permissions,
|
||||
'settings' => $company_user->settings,
|
||||
'is_owner' => (bool) $company_user->is_owner,
|
||||
@ -53,7 +53,7 @@ class CompanyUserTransformer extends EntityTransformer
|
||||
'is_locked' => (bool) $company_user->is_locked,
|
||||
'updated_at' => $company_user->updated_at,
|
||||
'deleted_at' => $company_user->deleted_at,
|
||||
]
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,6 @@ class CompanyTest extends TestCase
|
||||
]
|
||||
)
|
||||
->assertStatus(200)->decodeResponseJson();
|
||||
\Log::error($response['data'][0]);
|
||||
//$company = Company::find($this->decodePrimaryKey($response['data']['company_users'][0]['company']['id']));
|
||||
$company = Company::find($this->decodePrimaryKey($response['data'][0]['company']['id']));
|
||||
|
||||
$response = $this->withHeaders([
|
||||
|
Loading…
Reference in New Issue
Block a user