master

laravel/framework

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

controller.model.stub

TLDR

This file is a stub file for a controller model. It contains methods for displaying a listing of resources, creating a new resource, storing a newly created resource, displaying a specified resource, editing a specified resource, updating a specified resource, and removing a specified resource.

Methods

index

This method is responsible for displaying a listing of the resource.

create

This method is responsible for showing the form for creating a new resource.

store

This method is responsible for storing a newly created resource in storage. It takes a store request as a parameter.

show

This method is responsible for displaying the specified resource. It takes a model object as a parameter.

edit

This method is responsible for showing the form for editing the specified resource. It takes a model object as a parameter.

update

This method is responsible for updating the specified resource in storage. It takes an update request and a model object as parameters.

destroy

This method is responsible for removing the specified resource from storage. It takes a model object as a parameter.

<?php

namespace {{ namespace }};

use {{ namespacedModel }};
use {{ rootNamespace }}Http\Controllers\Controller;
use {{ namespacedRequests }}

class {{ class }} extends Controller
{
    /**
     * Display a listing of the resource.
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     */
    public function store({{ storeRequest }} $request)
    {
        //
    }

    /**
     * Display the specified resource.
     */
    public function show({{ model }} ${{ modelVariable }})
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     */
    public function edit({{ model }} ${{ modelVariable }})
    {
        //
    }

    /**
     * Update the specified resource in storage.
     */
    public function update({{ updateRequest }} $request, {{ model }} ${{ modelVariable }})
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     */
    public function destroy({{ model }} ${{ modelVariable }})
    {
        //
    }
}