first commit

This commit is contained in:
Sampanna Rimal
2024-08-27 17:48:06 +05:45
commit 53c0140f58
10839 changed files with 1125847 additions and 0 deletions

View File

@ -0,0 +1,49 @@
<?php
namespace Modules\Customer\Repositories;
use Modules\Customer\Models\Customer;
class CustomerRepository implements CustomerInterface
{
public function findAll()
{
return Customer::when(true, function ($query) {
// if (auth()->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');
}
}