> For the complete documentation index, see [llms.txt](https://idt-nida.gitbook.io/developer-guideline/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idt-nida.gitbook.io/developer-guideline/laravel/template/readme.md).

# Template Function in FormController on Laravel

ตัวอย่าง Function มาตรฐานที่ควรมี เมื่อทำงานกับฐานข้อมูลที่เกี่ยวข้องกับ CRUD

```php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class FormController extends Controller
{
    public function index()
    {
        // Read - Display a list of items
    }
    public function create()
    {
        // Create - Show the form to create a new item
    }
    public function store(Request $request)
    {
        // Create - Save a new item to the database
    }
    public function show($id)
    {
        // Read - Display a single item
    }
    public function edit($id)
    {
        // Update - Show the form to edit an item
    }
    public function update(Request $request, $id)
    {
        // Update - Save the edited item to the database
    }
    public function destroy($id)
    {
        // Delete - Remove an item from the database
    }
```
