Skip to content

Commit

Permalink
add types to RelationController
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed May 14, 2024
1 parent 1b16762 commit 71a6050
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Http/Controllers/RelationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class RelationController extends Controller
*/
public function index(Request $request, Model $model): Response
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$data = $field->toIndex($request, $model);
Expand All @@ -32,6 +33,7 @@ public function index(Request $request, Model $model): Response
*/
public function create(Request $request, Model $model): Response
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$data = $field->toCreate($request, $model);
Expand All @@ -46,6 +48,7 @@ public function create(Request $request, Model $model): Response
*/
public function store(Request $request, Model $model): RedirectResponse
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$related = $field->getRelation($model)->make();
Expand All @@ -61,6 +64,7 @@ public function store(Request $request, Model $model): RedirectResponse
*/
public function show(Request $request, Model $model, Model $related): Response
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$data = $field->toShow($request, $model, $related);
Expand All @@ -75,6 +79,7 @@ public function show(Request $request, Model $model, Model $related): Response
*/
public function edit(Request $request, Model $model, Model $related): Response
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$data = $field->toEdit($request, $model, $related);
Expand All @@ -89,6 +94,7 @@ public function edit(Request $request, Model $model, Model $related): Response
*/
public function update(Request $request, Model $model, Model $related): RedirectResponse
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$field->handleFormRequest($request, $related);
Expand All @@ -102,6 +108,7 @@ public function update(Request $request, Model $model, Model $related): Redirect
*/
public function destroy(Request $request, Model $model, Model $related): RedirectResponse
{
/** @var \Cone\Root\Fields\Relation $field */
$field = $request->route('field');

$trashed = class_uses_recursive(SoftDeletes::class) && $related->trashed();
Expand Down

0 comments on commit 71a6050

Please sign in to comment.