I have two table in my database which are user and the attendance table. What I want to do now is I want to show the attendance data from database according to the user in their attendance view which is linked with their profile. This is my attendance function in the userController.
public function attendance($id)
{
$user = UserProfile::findOrFail($id);
$this->authorize('modifyUser', $user);
return view ('user.attendance', ['user'=>$user]);
}
This is my route to attendance view.
Route::get('/attendance/', ['as' => 'user.attendance', 'uses' => 'UserController@attendance']);
This is my attendance view.
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
<h1><i class="fa fa-university"></i> Attendance</h1>
</div>
<div class="row">
<table class="table table-bordered">
<tr>
<th>No</th>
<th>Date</th>
<th>Time</th>
<th>Present</th>
</tr>
<?php $no=1; ?>
<tr>
<td>{{ $no++ }}</td>
<td>{{$user->attendance->date}}</td>
<td>{{$user->attendance->time}}</td>
<td>{{$user->attendance->present}}</td>
</tr>
</table>
</div>
</div>
</div>
@stop
This is the error that i got. Type error: Too few arguments to function App\Http\Controllers\UserController::attendance(), 0 passed and exactly 1 expected". I am new to laravel.