user()->hasRole('Supplier')) { // $user = \Auth::user(); // $query->where('id', $user->Supplier_id); // } })->paginate(20); } public function getSupplierById($SupplierId) { return Supplier::findOrFail($SupplierId); } public function getSupplierByEmail($email) { return Supplier::where('email', $email)->first(); } public function delete($SupplierId) { Supplier::destroy($SupplierId); } public function create($SupplierDetails) { return Supplier::create($SupplierDetails); } public function update($SupplierId, array $newDetails) { return Supplier::whereId($SupplierId)->update($newDetails); } public function pluck() { return Supplier::pluck('supplier_name', 'id'); } }