Added AccountType method numberAndName().
Fixed bug in bookings.index view: There is no error anymore when a booking has no project assigned.
This commit is contained in:
+25
-3
@@ -6,7 +6,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AccountType extends Model
|
||||
{
|
||||
/*
|
||||
/**************************************************************************
|
||||
* DIRECT RELATIONS *
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the account class of the account type.
|
||||
*
|
||||
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
@@ -15,8 +19,12 @@ class AccountType extends Model
|
||||
{
|
||||
return $this->belongsTo('App\AccountClass');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
/**************************************************************************
|
||||
* INDIRECT RELATIONS *
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the IO-type of the account type.
|
||||
*
|
||||
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
@@ -52,4 +60,18 @@ class AccountType extends Model
|
||||
});
|
||||
})->get();
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* INDIRECT PROPERTIES *
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
* Returns the name and number of the account-type as string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function numberAndName()
|
||||
{
|
||||
return $this->number . ' - ' . $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user