Taks 4 - belongsToMany pivot

This commit is contained in:
PovilasKorop
2021-11-22 07:47:31 +02:00
parent 0fbdf0c99a
commit 4ec2014369
8 changed files with 128 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
<?php
namespace App\Http\Controllers;
use App\Models\Role;
class RoleController extends Controller
{
public function index()
{
$roles = Role::withCount('users')->get();
return view('roles.index', compact('roles'));
}
}