Overview:
I have this method getDailyTimeRecordEntry()
public function getDailyTimeRecordEntry($record_id = false) {
$user_id = Auth::user()->id;
$dtr = DailyTimeRecord::where('id', '=', $record_id)
->where('user_id', '=', $user_id);
if ($dtr->count() > 0) {
$dtr = $dtr->first();
} else if ($dtr->count() == 0 && $record_id != false) {
// If other user accessing someone's record id, will redirect
return Redirect::route('dashboard-shinra')
->with('failure', 'The hell are you accessing someone\'s record?');
}
// if the dtr->count() is 0 or has a value it still send the data to view
return View::make('dashboard.shinra.dtr_entry')
->with('dtr', $dtr);
}
So we know that whether the url has a parameter of record id or blank, it still send the dtr value that I'm passing to view
Without parameter:
www.mydomain.com/dashboard/shinra/daily-time-record-entry
With parameter:
www.mydomain.com/dashboard/shinra/daily-time-record-entry/2
So on the view dashboard.shinra.dtr_entry
I have this certain line of code that has a dtr variable in it.
<input type="text" name="date" value="{{ ($dtr->date) ? $dtr->date : '' }}">
So, if we access
www.mydomain.com/dashboard/shinra/daily-time-record-entry/1
All the records will be output in the text fields like the input above. Because the parameter 1 has a record in database.
So if I access
www.mydomain.com/dashboard/shinra/daily-time-record-entry
Without the parameter, I'm encountering the error

I know that it's because of this one
{{ ($dtr->date) ? $dtr->date : '' }}
But, are there any fix for this?
I even tried
{{ (isset($dtr->date)) ? $dtr->date : '' }}
And still doesn't work.