mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-14 00:41:06 +03:30
fix issue "user can create a package only from his items"
This commit is contained in:
@@ -111,13 +111,13 @@ class ItemController extends Controller
|
|||||||
|
|
||||||
public function getItems()
|
public function getItems()
|
||||||
{
|
{
|
||||||
$user = auth()->user();
|
$userId = auth('api')->user()->id;
|
||||||
$medicalCenterId = optional(optional($user)->medical_center)->id;
|
// $medicalCenterId = optional(optional($user)->medical_center)->id;
|
||||||
$userIds = User::where('medical_center_id', $medicalCenterId)->pluck('id')->toArray();
|
// $userIds = User::where('medical_center_id', $medicalCenterId)->pluck('id')->toArray();
|
||||||
|
|
||||||
$Items = Item::where( "status" , StatusTypeEnum::APPROVED )
|
$Items = Item::where( "status" , StatusTypeEnum::APPROVED )
|
||||||
->where( "package_id" , null )
|
->where( "package_id" , null )
|
||||||
->whereIn('creator_id', $userIds)
|
->whereIn('creator_id', $userId)
|
||||||
->orderByDesc( 'id' )
|
->orderByDesc( 'id' )
|
||||||
->isNotRepaired()
|
->isNotRepaired()
|
||||||
->get();
|
->get();
|
||||||
|
|||||||
Reference in New Issue
Block a user