master

laravel/framework

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

controller.singleton.api.stub

TLDR

This file contains a stub for a controller class in a Laravel application. It extends the Controller base class and has methods for storing, displaying, updating, and deleting resources.

Methods

store

Stores a newly created resource in storage. This method accepts a Request object as a parameter and returns never. It aborts the response with a 404 error.

show

Displays the resource. This method has no parameters and does not return any value. The implementation is missing and needs to be added.

update

Updates the resource in storage. This method accepts a Request object as a parameter and does not return any value. The implementation is missing and needs to be added.

destroy

Removes the resource from storage. This method has no parameters and returns never. It aborts the response with a 404 error.

<?php

namespace {{ namespace }};

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

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

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

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

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