z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.14k stars 2.81k forks source link

How to create a custom page, without using Model? #5598

Open Glarionov opened 2 years ago

Glarionov commented 2 years ago

Description:

If we create routes by

$router->resource

There are need to be methods like form and grid, which need some model to be created. But what if I want to create a page, that does not bind to any model?

altwei commented 2 years ago

You can refer to this page

https://laravel-admin.org/docs/zh/1.x/model-grid-data

KomAuras commented 2 years ago
namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;

class SampleController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->title(__('Sample page'))
            ->row(function (Row $row) {
                $row->column(12, 'sample text');
            });
    }
}