i am trying to display duration value, using database "column name" ( "date_of_join" ,"date_of_completion") value in view
like ( 1/1/2018 to 1/1/2019 ) this value show like ( 1 year )
( 1/1/2018 to 1/2/2018 ) value show like ( 1 month )
( 1/1/2018 to 10/2/2018 ) value show like (1 month 10 days )
how to do this in laravel how to show y=this in view
my view
@if(isset($details))
<table class="table table-striped">
<thead>
<tr>
<th>PHOTO</th>
<th>NAME</th>
<th>CERTIFICATE NO</th>
<th>COURSE</th>
<th>COURSE DURATION</th>
<th>DATE OF JOIN</th>
<th>CENTER NAME</th>
</tr>
</thead>
<tbody>
@foreach($details as $user)
<td>
<td>{{$user->student_name}}</td>
<td>{{$user->student_registration_id}}</td>
<td>{{$user->student_course}}</td>
<td>{{ }}</td>
<td>{{$user->date_of_join}}</td>
<td>{{$user->center_name}}</td>
</tr>
@endforeach
</tbody>
</table>
@elseif(isset($message))
<p style="color:red" align="center">{{$message}}</p>
@endif
</div>
my route
Route::any( '/search', function(){
$id = Input::get( 'id' );
$certificate_issue_date = Input::get('certificate_issue_date');
if($id != ""){
$user = Student::where( 'student_registration_id', 'LIKE', '%' . $id . '%' );
if (!empty($certificate_issue_date))
{
$user->where('certificate_issue_date','=',$certificate_issue_date)->where('student_certificate_approval', 'APPROVED');
}
$user = $user->get();
if (count ( $user ) > 0)
return view( 'verify_certificate' )->withDetails( $user )->withQuery($id)->withDateOfJoin($certificate_issue_date);
}
return view ( 'verify_certificate' )->withMessage ( "No Details found!" );
} );
Mutators
, put the logic in model. View is just used to display datas.