i have a problem on my project on my user table im using an usertype it has a Student Teacher Admin and i want them to have a separate table with out using an eloquent just a simple query/code or an simple tutorial to help my problem..
controller
public function index()
{
$users = User::find();
return view('teacherpage.teacher_table', compact('users'));
}
teacher_table
@foreach ($users as $position)
<tbody>
<tr>
<td>{{ $position->id}}</td>
<td>{{ $position->first_name}}</td>
<td>{{ $position->last_name}}</td>
<td>{{ $position->contact}}</td>
<td>{{ $position->department}}</td>
<td>{{ $position->usertype}}</td>
<td>{{ $position->email}}</td>
<th>
<a href="{{action('AdminTableController@edit',['id' =>$position->id])}}" class="btn btn-success">Edit </a>
</th>
</tr>
</tbody>
@endforeach
**i want to view the Student usertype i don't know please help me **
Adding an additional model makes it possible to assign a type/role to a user. Start by creating the
Rolemodel:and then editing the following migration:
database/migrations/*_*_creates_roles_table.phpto have the following up method:The
Rolemodel can now be associated with a User by adding a relation to the user model:after migrating the database(
php artisan migrate) the following code can be used: