32 lines
840 B
PHP
32 lines
840 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\V3\Dashboard\Harim;
|
|
|
|
use App\Exceptions\ProhibitedAction;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Traits\ApiResponse;
|
|
use App\Models\Harim;
|
|
use App\Models\HarimState;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Throwable;
|
|
|
|
class DetailController extends Controller
|
|
{
|
|
use ApiResponse;
|
|
|
|
public function states(): JsonResponse
|
|
{
|
|
return $this->successResponse(HarimState::query()->get(['id', 'name']));
|
|
}
|
|
|
|
/**
|
|
* @throws Throwable
|
|
*/
|
|
public function histories(Harim $harim): JsonResponse
|
|
{
|
|
throw_if($this->harim->edareh_shahri_id == auth()->user()->edarate_shahri_id, new ProhibitedAction("unauthorized"));
|
|
|
|
return $this->successResponse($harim->histories()->get(['id', 'expert_description', 'action_name', 'previous_state_name']));
|
|
}
|
|
}
|