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