Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
20f46adbc4
commit
9596d88b48
@@ -12,13 +12,14 @@ trait ExpensableTrait
|
||||
|
||||
/**
|
||||
* Morph to Expenses.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function expenses()
|
||||
{
|
||||
return $this->morphMany(
|
||||
Expense::class,
|
||||
'expenses', # overridden by the next two anyway
|
||||
'expenses', // overridden by the next two anyway
|
||||
'ref_model',
|
||||
'ref_model_id'
|
||||
);
|
||||
|
||||
@@ -8,13 +8,14 @@ trait FilesTrait
|
||||
{
|
||||
/**
|
||||
* Morph to type of File
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(
|
||||
File::class,
|
||||
'files', # overridden by the next two anyway
|
||||
'files', // overridden by the next two anyway
|
||||
'ref_model',
|
||||
'ref_model_id'
|
||||
);
|
||||
|
||||
@@ -8,8 +8,9 @@ use Hashids\Hashids;
|
||||
trait HashIdTrait
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Hashids\HashidsException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
final protected static function createNewHashId(): string
|
||||
{
|
||||
@@ -20,6 +21,7 @@ trait HashIdTrait
|
||||
|
||||
/**
|
||||
* Register callbacks
|
||||
*
|
||||
* @throws \Hashids\HashidsException
|
||||
*/
|
||||
final protected static function bootHashIdTrait(): void
|
||||
|
||||
@@ -30,8 +30,10 @@ trait JournalTrait
|
||||
* Initialize a journal for a given model object
|
||||
*
|
||||
* @param string $currency_code
|
||||
* @return Journal
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @return Journal
|
||||
*/
|
||||
public function initJournal($currency_code = 'USD')
|
||||
{
|
||||
|
||||
@@ -4,14 +4,15 @@ namespace App\Models\Traits;
|
||||
|
||||
/**
|
||||
* Trait ReferenceTrait
|
||||
*
|
||||
* @property \App\Interfaces\Model $ref_model
|
||||
* @property mixed $ref_model_id
|
||||
* @package App\Models\Traits
|
||||
*/
|
||||
trait ReferenceTrait
|
||||
{
|
||||
/**
|
||||
* @param \App\Interfaces\Model $object
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function referencesObject($object)
|
||||
@@ -25,12 +26,13 @@ trait ReferenceTrait
|
||||
|
||||
/**
|
||||
* Return an instance of the object or null
|
||||
*
|
||||
* @return \App\Interfaces\Model|null
|
||||
*/
|
||||
public function getReferencedObject()
|
||||
{
|
||||
if (!$this->ref_model || !$this->ref_model_id) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->ref_model === __CLASS__) {
|
||||
@@ -38,11 +40,11 @@ trait ReferenceTrait
|
||||
}
|
||||
|
||||
try {
|
||||
$klass = new $this->ref_model;
|
||||
$klass = new $this->ref_model();
|
||||
$obj = $klass->find($this->ref_model_id);
|
||||
return $obj;
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user