35 lines
986 B
PHP
35 lines
986 B
PHP
<?php
|
|
|
|
namespace App\Websocket\Controllers;
|
|
|
|
use App\Actions\Reports;
|
|
use App\Websocket\GameController;
|
|
|
|
/** report.index {world_id, page}, 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)));
|
|
}
|
|
|
|
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')));
|
|
}
|
|
}
|