40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Websocket\Controllers;
|
|
|
|
use App\Actions\Reports;
|
|
use App\Websocket\GameController;
|
|
|
|
/** report.index {world_id, page, type?}, report.show {id}, report.delete {world_id, ids}, report.readAll {world_id} */
|
|
class ReportController extends GameController
|
|
{
|
|
public function index()
|
|
{
|
|
return $this->play(fn () => app(Reports::class)->list(
|
|
auth()->user(),
|
|
(int) request('world_id'),
|
|
(int) (request('page') ?: 1),
|
|
request('type') ? (string) request('type') : null,
|
|
));
|
|
}
|
|
|
|
public function show()
|
|
{
|
|
return $this->play(fn () => app(Reports::class)->show(auth()->user(), (int) request('id')));
|
|
}
|
|
|
|
public function delete()
|
|
{
|
|
return $this->play(fn () => app(Reports::class)->delete(
|
|
auth()->user(),
|
|
(int) request('world_id'),
|
|
array_map('intval', (array) request('ids', [])),
|
|
));
|
|
}
|
|
|
|
public function readAll()
|
|
{
|
|
return $this->play(fn () => app(Reports::class)->readAll(auth()->user(), (int) request('world_id')));
|
|
}
|
|
}
|