MinimumRevenueService
in package
uses
HasResource
Class MinimumRevenueService
Provides services for managing and retrieving minimum revenue data.
Table of Contents
Properties
- $model : Model
Methods
- __construct() : mixed
- MinimumRevenueService constructor.
- all() : Collection
- Retrieve all records for the authenticated user, with optional search.
- create() : Model
- Create a new record with the given data.
- delete() : bool
- Delete a record by ID.
- fetch() : array<string|int, mixed>
- Fetches minimum revenue data from an external API.
- find() : Model|null
- Find a record by ID for the authenticated user.
- findBy() : Model|null
- Find a record by a specific field and value.
- findByPeriod() : MinimumRevenue|null
- Finds minimum revenue data for a specific period.
- getBy() : Collection
- Get records by a specific field and value.
- getByYear() : Collection
- Retrieves minimum revenue data for a specific year.
- paginate() : LengthAwarePaginator
- Paginate records for the authenticated user, with optional search and sorting.
- query() : Builder
- Get a new query builder instance for the model.
- update() : Model|null
- Update a record by ID with the given data.
Properties
$model
private
Model
$model
Methods
__construct()
MinimumRevenueService constructor.
public
__construct() : mixed
all()
Retrieve all records for the authenticated user, with optional search.
public
all([array<string|int, mixed> $search = [] ]) : Collection
Parameters
- $search : array<string|int, mixed> = []
-
Search options.
Return values
Collection —The collection of records.
create()
Create a new record with the given data.
public
create(array<string|int, mixed> $data) : Model
Parameters
- $data : array<string|int, mixed>
-
The data for the new record.
Return values
Model —The created model.
delete()
Delete a record by ID.
public
delete(int $id) : bool
Parameters
- $id : int
-
The record ID.
Return values
bool —True if deleted, false otherwise.
fetch()
Fetches minimum revenue data from an external API.
public
fetch(int $id, string $period) : array<string|int, mixed>
Parameters
- $id : int
-
The reseller subnet ID.
- $period : string
-
The period for which to fetch data.
Return values
array<string|int, mixed> —The fetched data or an empty array on failure.
find()
Find a record by ID for the authenticated user.
public
find(int $id) : Model|null
Parameters
- $id : int
-
The record ID.
Return values
Model|null —The found model or null.
findBy()
Find a record by a specific field and value.
public
findBy(string $field, mixed $value) : Model|null
Parameters
- $field : string
-
The field name.
- $value : mixed
-
The value to search for.
Return values
Model|null —The found model or null.
findByPeriod()
Finds minimum revenue data for a specific period.
public
findByPeriod(int $id, string $period) : MinimumRevenue|null
Parameters
- $id : int
-
The reseller subnet ID.
- $period : string
-
The period to search for.
Return values
MinimumRevenue|null —The found record or null.
getBy()
Get records by a specific field and value.
public
getBy(string $field, mixed $value) : Collection
Parameters
- $field : string
-
The field name.
- $value : mixed
-
The value to search for.
Return values
Collection —The collection of records.
getByYear()
Retrieves minimum revenue data for a specific year.
public
getByYear(int $id, string $year) : Collection
Parameters
- $id : int
-
The reseller subnet ID.
- $year : string
-
The year to search for.
Return values
Collection —The collection of records.
paginate()
Paginate records for the authenticated user, with optional search and sorting.
public
paginate([int $perPage = 15 ][, array<string|int, mixed> $search = [] ][, array<string|int, mixed> $sort = [] ]) : LengthAwarePaginator
Parameters
- $perPage : int = 15
-
Number of records per page.
- $search : array<string|int, mixed> = []
-
Search options.
- $sort : array<string|int, mixed> = []
-
Sort options.
Return values
LengthAwarePaginator —Paginated result set.
query()
Get a new query builder instance for the model.
public
query() : Builder
Return values
Builder —The query builder instance.
update()
Update a record by ID with the given data.
public
update(int $id, array<string|int, mixed> $data) : Model|null
Parameters
- $id : int
-
The record ID.
- $data : array<string|int, mixed>
-
The data to update.
Return values
Model|null —The updated model or null.