filter fasil
This commit is contained in:
@@ -27,6 +27,10 @@ class PetaniController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
if (!Gate::any(['super_admin', 'admin', 'fasilitator'])) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$provinsi = Provinsi::orderBy('kode', 'asc')->get();
|
||||
|
||||
$query = Petani::with('desakelurahan')
|
||||
@@ -39,6 +43,10 @@ class PetaniController extends Controller
|
||||
});
|
||||
}
|
||||
|
||||
if (auth()->user()->role->value === 'fasilitator') {
|
||||
$query->where('created_by', auth()->user()->id);
|
||||
}
|
||||
|
||||
$petani = $query->paginate($request->per_page ?? 10);
|
||||
|
||||
return view('produktivitas.petani.index', compact('petani', 'provinsi'));
|
||||
|
||||
Reference in New Issue
Block a user