macropay-solutions/laravel-crud-wizard-client-free

Request builder for calling projects that implement macropay-solutions/laravel-crud-wizard-free

1.0.5 2025-03-26 09:00 UTC

This package is not auto-updated.

Last update: 2025-03-26 14:30:22 UTC


README

Total Downloads Latest Stable Version License

This is a stripped down version of laravel-lumen-crud-wizard-client

and can be used for calling laravel-crud-wizard-free

Install

composer require macropay-solutions/laravel-crud-wizard-client-free

Start using it

    $crud = new \MacroPaySolutions\LaravelCrudWizardClient\RequestBuilder(\env('API_BEARER'), \env('APP_URL'));

    try {
        $result = $crud->list('clients', $crud->getBuilder()->sort('country', 'asc')
            ->sort('zip')->equals('name', 'alt')->withRelation('relation')
            ->withRelations(['rel1', 'rel2'])
            ->addCountRelations(['relation1'])->addExistRelation('relation2');
        $result = $crud->get('clients', '73', ['rel1', 'rel2']);
        $result = $crud->delete('clients', '73');
        $result = $crud->create('clients', [
            'active' => '1',
            'name' => 'abc',
            // ...
        ]);
        $result = $crud->update('clients', '73', [
            'active' => '1',
            'name' => 'abc',
            // ...
        ]);
    } catch (\Exception $e) {
        $decodedErrorMessage = \json_decode($e->getMessage());
        echo $decodedErrorMessage->message;
    }

    $decodedResult = \json_decode($result);

Discover more methods available by installing it.