@@ -13,7 +13,7 @@ class DistributionController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(): JsonResponse
|
public function index(): JsonResponse
|
||||||
{
|
{
|
||||||
if (!Gate::any(['super_admin', 'petani','fasilitator'])) {
|
if (!Gate::any(['super_admin', 'petani','fasilitator', 'offtaker'])) {
|
||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +25,11 @@ class DistributionController extends Controller
|
|||||||
$query->where('farmer_id', $user->profile->id);
|
$query->where('farmer_id', $user->profile->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Jika offtaker, filter hanya data yang ditugaskan kepadanya
|
||||||
|
if ($user->role === 'offtaker') {
|
||||||
|
$query->where('offtaker_id', $user->profile->id);
|
||||||
|
}
|
||||||
|
|
||||||
return response()->json($query->get());
|
return response()->json($query->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user