user()->hasRole('Customer')) { // $user = \Auth::user(); // $query->where('id', $user->Customer_id); // } })->paginate(20); } public function getCustomerById($CustomerId) { return Customer::findOrFail($CustomerId); } public function getCustomerByEmail($email) { return Customer::where('email', $email)->first(); } public function delete($CustomerId) { Customer::destroy($CustomerId); } public function create($CustomerDetails) { return Customer::create($CustomerDetails); } public function update($CustomerId, array $newDetails) { return Customer::whereId($CustomerId)->update($newDetails); } public function pluck() { return Customer::pluck('customer_name', 'id'); } }