master

laravel/framework

Last updated at: 28/12/2023 01:39

controller.nested.singleton.api.stub

TLDR

This file is a stub for a nested, singleton API controller class that extends the base Controller class.

Methods

store

This method is responsible for storing a newly created resource in storage. It accepts a Request object and an instance of the parentModel as parameters and always throws a 404 exception.

show

This method is responsible for displaying a resource. It accepts an instance of the parentModel as a parameter and does not perform any actions.

update

This method is responsible for updating a resource in storage. It accepts a Request object and an instance of the parentModel as parameters and does not perform any actions.

destroy

This method is responsible for removing a resource from storage. It accepts an instance of the parentModel as a parameter and always throws a 404 exception.

<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use {{ rootNamespace }}Http\Controllers\Controller;
use Illuminate\Http\Request;
use {{ namespacedParentModel }};

class {{ class }} extends Controller
{
    /**
     * Store the newly created resource in storage.
     */
    public function store(Request $request, {{ parentModel }} ${{ parentModelVariable }}): never
    {
        abort(404);
    }

    /**
     * Display the resource.
     */
    public function show({{ parentModel }} ${{ parentModelVariable }})
    {
        //
    }

    /**
     * Update the resource in storage.
     */
    public function update(Request $request, {{ parentModel }} ${{ parentModelVariable }})
    {
        //
    }

    /**
     * Remove the resource from storage.
     */
    public function destroy({{ parentModel }} ${{ parentModelVariable }}): never
    {
        abort(404);
    }
}