ID

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

Extends Text * has the same features

It is almost always present and will be hidden by default on the add/edit page. If the primary key has a name other than id you have to specify its name as the first argument of the make method.

use MoonShine\Fields\ID;
 
//...
 
public function fields(): array
{
return [
ID::make()
];
}
 
//...
use MoonShine\Fields\ID;
 
//...
 
public function fields(): array
{
return [
ID::make('primary_key')
];
}
 
//...