Skip to content

Commit

Permalink
ip address service added
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed May 19, 2024
1 parent e08cd8e commit f2f0011
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Fintech\Auth\Services\AuditService;
use Fintech\Auth\Services\FavouriteService;
use Fintech\Auth\Services\IdDocTypeService;
use Fintech\Auth\Services\IpAddressService;
use Fintech\Auth\Services\OneTimePinService;
use Fintech\Auth\Services\PasswordResetService;
use Fintech\Auth\Services\PermissionService;
Expand All @@ -13,6 +14,7 @@
use Fintech\Auth\Services\RoleService;
use Fintech\Auth\Services\TeamService;
use Fintech\Auth\Services\UserService;
use Illuminate\Contracts\Foundation\Application;

class Auth
{
Expand Down Expand Up @@ -94,19 +96,19 @@ public function audit()
}

/**
* @return IdDocTypeService
* @return FavouriteService
*/
public function idDocType()
public function favourite()
{
return app(IdDocTypeService::class);
return app(FavouriteService::class);
}

/**
* @return FavouriteService
* @return IpAddressService
*/
public function favourite()
public function ipAddress()
{
return app(FavouriteService::class);
return app(IpAddressService::class);
}

//** Crud Service Method Point Do not Remove **//
Expand Down
4 changes: 2 additions & 2 deletions src/Facades/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Fintech\Auth\Services\AuditService;
use Fintech\Auth\Services\FavouriteService;
use Fintech\Auth\Services\IdDocTypeService;
use Fintech\Auth\Services\IpAddressService;
use Fintech\Auth\Services\OneTimePinService;
use Fintech\Auth\Services\PasswordResetService;
use Fintech\Auth\Services\PermissionService;
Expand All @@ -25,8 +25,8 @@
* @method static PasswordResetService passwordReset()
* @method static PinResetService pinReset()
* @method static AuditService audit()
* @method static IdDocTypeService idDocType()
* @method static FavouriteService favourite()
* @method static IpAddressService ipAddress()
* // Crud Service Method Point Do not Remove //
*
* @see \Fintech\Auth\Auth
Expand Down
39 changes: 39 additions & 0 deletions src/Interfaces/IpAddressRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Fintech\Auth\Interfaces;

use Fintech\Core\Abstracts\BaseModel;
use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Support\Collection;

/**
* Interface IpAddressRepository
* @package Fintech\Auth\Interfaces
*/
interface IpAddressRepository
{
/**
* return a list or pagination of items from
* filtered options
*
* @param array $filters
* @return Paginator|Collection
*/
public function list(array $filters = []);

/**
* find and delete a entry from records
*
* @param int|string $id
* @param bool $onlyTrashed
* @return BaseModel
*/
public function find(int|string $id, $onlyTrashed = false);

/**
* find and delete a entry from records
* @param int|string $id
*/
public function delete(int|string $id);

}
41 changes: 41 additions & 0 deletions src/Services/IpAddressService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Fintech\Auth\Services;

use Fintech\Auth\Interfaces\AuditRepository;

/**
* Class IpAddressService
* @package Fintech\Auth\Services
*
*/
class IpAddressService
{
/**
* IpAddressService constructor.
* @param AuditRepository $auditRepository
*/
public function __construct(private readonly AuditRepository $auditRepository)
{
}

/**
* @param array $filters
* @return mixed
*/
public function lookup(array $filters = [])
{
return $this->auditRepository->list($filters);

}

public function find($id, $onlyTrashed = false)
{
return $this->auditRepository->find($id, $onlyTrashed);
}

public function destroy($id)
{
return $this->auditRepository->delete($id);
}
}

0 comments on commit f2f0011

Please sign in to comment.