# fluent-cart/1.6.4/api/Resource/ActivityResource.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.4. 60 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/api/Resource/ActivityResource.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.4/raw/api/Resource/ActivityResource.php
- Modified: 2025-10-14T16:36:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.4/code/api/Resource/ActivityResource.php#L10-L20`.

```php
<?php

namespace FluentCart\Api\Resource;

use FluentCart\Framework\Database\Orm\Builder;
use FluentCart\App\Models\Activity;
use FluentCart\Framework\Support\Arr;

class ActivityResource extends BaseResourceApi
{
    public static function get(array $params = [])
    {
        $logsQuery =  Activity::query()
            ->orderBy(
                sanitize_sql_orderby(Arr::get($params, 'order_by', 'id')),
                sanitize_sql_orderby(Arr::get($params, 'order_type', 'DESC'))
            );
        $status = Arr::get($params, 'status');

        if (!empty($status) && $status !== 'all') {
            if ($status === 'api') {
                $logsQuery->where('log_type', 'api');
            } else {
                $logsQuery->where('status', $status);
            }
        }

        return $logsQuery->paginate(
            Arr::get($params, 'per_page', 15),
            ['*'],
            'page',
            Arr::get($params, 'page', 1)
        );
    }

    public static function find($id, $params = [])
    {
        return Activity::query()->find($id);
    }

    public static function create($data, $params = [])
    {
        return Activity::query()->create($data);
    }

    public static function update($data, $id, $params = [])
    {
        return Activity::query()->where('id', $id)->update($data);
    }

    public static function delete($id, $params = [])
    {
        return Activity::query()->where('id', $id)->delete();
    }

    static function getQuery(): Builder
    {
        return Activity::query();
    }
}
```
