- Added `mary.php` configuration file for customizable component and route prefixes. - Upgraded `livewire/livewire` to v4.3 and added `robsontenorio/mary` v2.8 for maryUI support. - Updated `ConnectedApps` component to fetch data dynamically via `ConnectedAppService`. - Replaced static services with computed properties and streamlined data mappings in templates. - Enhanced frontend styling with `daisyUI` and TailwindCSS v4.3 integration. - Improved user feedback in `ConnectedAppForm` with success/error toasts.
40 lines
871 B
PHP
40 lines
871 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Data\ConnectedApp\ConnectAppRequest;
|
|
use App\Data\Ui\ConnectedApps\ConnectedAppData;
|
|
use App\Models\ConnectedApp;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Spatie\LaravelData\DataCollection;
|
|
use Throwable;
|
|
|
|
final class ConnectedAppService
|
|
{
|
|
/**
|
|
* Create a new connected app.
|
|
*
|
|
* @throws Throwable
|
|
*/
|
|
public function create(ConnectAppRequest $data): void
|
|
{
|
|
DB::transaction(
|
|
fn () => ConnectedApp::query()->create(
|
|
$data->toArray()
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @return DataCollection<int, ConnectedAppData>
|
|
*/
|
|
public function getAll(): DataCollection
|
|
{
|
|
$data = ConnectedApp::with('provider', 'protocol', 'status')->get();
|
|
|
|
return ConnectedAppData::collect($data, DataCollection::class);
|
|
}
|
|
}
|