mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for tests
This commit is contained in:
parent
8a9061b00e
commit
4976d5b057
@ -9,7 +9,7 @@ class EntityRequest extends Request {
|
|||||||
protected $entityType;
|
protected $entityType;
|
||||||
private $entity;
|
private $entity;
|
||||||
|
|
||||||
public function entity()
|
public function entity()
|
||||||
{
|
{
|
||||||
if ($this->entity) {
|
if ($this->entity) {
|
||||||
return $this->entity;
|
return $this->entity;
|
||||||
@ -20,24 +20,24 @@ class EntityRequest extends Request {
|
|||||||
foreach (['_id', 's'] as $suffix) {
|
foreach (['_id', 's'] as $suffix) {
|
||||||
$field = $this->entityType . $suffix;
|
$field = $this->entityType . $suffix;
|
||||||
if ($this->$field) {
|
if ($this->$field) {
|
||||||
$publicId= $this->$field;
|
$publicId= $this->$field;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! $publicId) {
|
if ( ! $publicId) {
|
||||||
$publicId = Input::get('public_id') ?: Input::get('id');
|
$publicId = Input::get('public_id') ?: Input::get('id');
|
||||||
}
|
}
|
||||||
if ( ! $publicId) {
|
if ( ! $publicId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$class = Utils::getEntityClass($this->entityType);
|
$class = Utils::getEntityClass($this->entityType);
|
||||||
|
|
||||||
if (method_exists($class, 'withTrashed')) {
|
if (method_exists($class, 'trashed')) {
|
||||||
$this->entity = $class::scope($publicId)->withTrashed()->firstOrFail();
|
$this->entity = $class::scope($publicId)->withTrashed()->firstOrFail();
|
||||||
} else {
|
} else {
|
||||||
$this->entity = $class::scope($publicId)->firstOrFail();
|
$this->entity = $class::scope($publicId)->firstOrFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->entity;
|
return $this->entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class EntityModel extends Eloquent
|
|||||||
$entity->setRelation('user', $user);
|
$entity->setRelation('user', $user);
|
||||||
$entity->setRelation('account', $account);
|
$entity->setRelation('account', $account);
|
||||||
|
|
||||||
if (method_exists($className, 'withTrashed')){
|
if (method_exists($className, 'trashed')){
|
||||||
$lastEntity = $className::withTrashed()
|
$lastEntity = $className::withTrashed()
|
||||||
->scope(false, $entity->account_id);
|
->scope(false, $entity->account_id);
|
||||||
} else {
|
} else {
|
||||||
|
491
composer.lock
generated
491
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user