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:
+24
-2
@@ -6,7 +6,11 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class AccountType extends Model
|
class AccountType extends Model
|
||||||
{
|
{
|
||||||
/*
|
/**************************************************************************
|
||||||
|
* DIRECT RELATIONS *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
* Get the account class of the account type.
|
* Get the account class of the account type.
|
||||||
*
|
*
|
||||||
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
@@ -16,7 +20,11 @@ class AccountType extends Model
|
|||||||
return $this->belongsTo('App\AccountClass');
|
return $this->belongsTo('App\AccountClass');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**************************************************************************
|
||||||
|
* INDIRECT RELATIONS *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
* Get the IO-type of the account type.
|
* Get the IO-type of the account type.
|
||||||
*
|
*
|
||||||
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
@@ -52,4 +60,18 @@ class AccountType extends Model
|
|||||||
});
|
});
|
||||||
})->get();
|
})->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* INDIRECT PROPERTIES *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name and number of the account-type as string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function numberAndName()
|
||||||
|
{
|
||||||
|
return $this->number . ' - ' . $this->name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@section('title', 'Kassenbuch')
|
@section('title', 'Kassenbuch')
|
||||||
|
|
||||||
@section('subnav')
|
@section('subnav')
|
||||||
|
<a href='/bookings/create'>Neue Buchung</a>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@@ -60,12 +60,11 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($booking->isSimple())
|
@if ($booking->isSimple())
|
||||||
{{ $booking->accountType()->number . ' - ' .
|
{{ $booking->accountType()->numberAndName() }}
|
||||||
$booking->accountType()->name }}
|
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($booking->isSimple())
|
@if ($booking->isSimple() and $booking->project() !== null)
|
||||||
{{ $booking->project()->name }}
|
{{ $booking->project()->name }}
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
@@ -89,11 +88,12 @@
|
|||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ $subBooking->accountType->number . ' - ' .
|
{{ $subBooking->accountType->numberAndName() }}
|
||||||
$subBooking->accountType->name }}
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ $subBooking->project->name }}
|
@if ($subBooking->project !== null)
|
||||||
|
{{ $subBooking->project->name }}
|
||||||
|
@endif
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in New Issue
Block a user