mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
wip
This commit is contained in:
@@ -17,12 +17,11 @@ class MakeFieldCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$field = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the field name?',
|
||||
placeholder: 'Name (e.g. `RangeSlider`)',
|
||||
required: true
|
||||
))
|
||||
$field = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the field name?',
|
||||
placeholder: 'RangeSlider',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
|
||||
@@ -24,12 +24,11 @@ class MakeFormCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$component = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the form name?',
|
||||
placeholder: 'Name (e.g. `Products/CreateProduct`)',
|
||||
required: true
|
||||
))
|
||||
$component = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the form name?',
|
||||
placeholder: 'Products/CreateProduct',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
@@ -49,7 +48,7 @@ class MakeFormCommand extends Command
|
||||
$model = (string) str($this->argument('model') ??
|
||||
text(
|
||||
label: 'What is the model name?',
|
||||
placeholder: 'Model (e.g. `Product`)',
|
||||
placeholder: 'Product',
|
||||
required: $this->option('edit')
|
||||
))->replace('/', '\\');
|
||||
$modelClass = (string) str($model)->afterLast('\\');
|
||||
|
||||
@@ -17,12 +17,11 @@ class MakeLayoutComponentCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$component = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the layout name?',
|
||||
placeholder: 'Name (e.g. `Wizard`)',
|
||||
required: true
|
||||
))
|
||||
$component = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the layout name?',
|
||||
placeholder: 'Wizard',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
|
||||
@@ -17,12 +17,11 @@ class MakeEntryCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$entry = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the infolist name?',
|
||||
placeholder: 'Name (e.g. `StatusSwitcher`)',
|
||||
required: true
|
||||
))
|
||||
$entry = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the infolist name?',
|
||||
placeholder: 'StatusSwitcher',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
|
||||
@@ -17,12 +17,11 @@ class MakeLayoutComponentCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$component = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the layout name?',
|
||||
placeholder: 'Name (e.g. `Wizard`)',
|
||||
required: true
|
||||
))
|
||||
$component = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the layout name?',
|
||||
placeholder: 'Wizard',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
|
||||
@@ -26,9 +26,9 @@ class MakePageCommand extends Command
|
||||
$this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the page name?',
|
||||
placeholder: 'Settings Page',
|
||||
required: true
|
||||
)
|
||||
placeholder: 'EditSettings',
|
||||
required: true,
|
||||
),
|
||||
)
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
@@ -43,13 +43,12 @@ class MakePageCommand extends Command
|
||||
$resourceClass = null;
|
||||
$resourcePage = null;
|
||||
|
||||
$resourceInput = $this->option('resource') ??
|
||||
text(
|
||||
label: 'Make Page For Resource?',
|
||||
placeholder: '(Optional) Resource (e.g. `UserResource`)',
|
||||
);
|
||||
$resourceInput = $this->option('resource') ?? text(
|
||||
label: 'Would you like to create the page inside a resource?',
|
||||
placeholder: '[Optional] UserResource',
|
||||
);
|
||||
|
||||
if ($resourceInput !== null) {
|
||||
if (filled($resourceInput)) {
|
||||
$resource = (string) str($resourceInput)
|
||||
->studly()
|
||||
->trim('/')
|
||||
@@ -64,20 +63,18 @@ class MakePageCommand extends Command
|
||||
$resourceClass = (string) str($resource)
|
||||
->afterLast('\\');
|
||||
|
||||
$resourcePage = $this->option('type') ??
|
||||
|
||||
select(
|
||||
label: 'Which type of page would you like to create?',
|
||||
options: [
|
||||
'custom' => 'Custom',
|
||||
'ListRecords' => 'List',
|
||||
'CreateRecord' => 'Create',
|
||||
'EditRecord' => 'Edit',
|
||||
'ViewRecord' => 'View',
|
||||
'ManageRecords' => 'Manage',
|
||||
],
|
||||
default: 'custom'
|
||||
);
|
||||
$resourcePage = $this->option('type') ?? select(
|
||||
label: 'Which type of page would you like to create?',
|
||||
options: [
|
||||
'custom' => 'Custom',
|
||||
'ListRecords' => 'List',
|
||||
'CreateRecord' => 'Create',
|
||||
'EditRecord' => 'Edit',
|
||||
'ViewRecord' => 'View',
|
||||
'ManageRecords' => 'Manage',
|
||||
],
|
||||
default: 'custom'
|
||||
);
|
||||
}
|
||||
|
||||
$panel = $this->option('panel');
|
||||
|
||||
@@ -17,12 +17,11 @@ class MakePanelCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$id = Str::lcfirst($this->argument('id') ??
|
||||
text(
|
||||
label: 'What is the ID?',
|
||||
placeholder: 'ID (e.g. `app`)',
|
||||
required: true
|
||||
));
|
||||
$id = Str::lcfirst($this->argument('id') ?? text(
|
||||
label: 'What is the ID?',
|
||||
placeholder: 'app',
|
||||
required: true,
|
||||
));
|
||||
|
||||
$class = (string) str($id)
|
||||
->studly()
|
||||
|
||||
@@ -23,12 +23,11 @@ class MakeRelationManagerCommand extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$resource = (string) str(
|
||||
$this->argument('resource') ??
|
||||
text(
|
||||
label: 'What is the Resource name?',
|
||||
placeholder: 'Resource (e.g. `DepartmentResource`)',
|
||||
required: true
|
||||
)
|
||||
$this->argument('resource') ?? text(
|
||||
label: 'What is the resource you would like to create this in?',
|
||||
placeholder: 'DepartmentResource',
|
||||
required: true,
|
||||
),
|
||||
)
|
||||
->studly()
|
||||
->trim('/')
|
||||
@@ -40,23 +39,21 @@ class MakeRelationManagerCommand extends Command
|
||||
$resource .= 'Resource';
|
||||
}
|
||||
|
||||
$relationship = (string) str($this->argument('relationship') ??
|
||||
text(
|
||||
label: 'What is the Relationship?',
|
||||
placeholder: 'Relationship (e.g. `members`)',
|
||||
required: true
|
||||
))
|
||||
$relationship = (string) str($this->argument('relationship') ?? text(
|
||||
label: 'What is the relationship?',
|
||||
placeholder: 'members',
|
||||
required: true,
|
||||
))
|
||||
->trim(' ');
|
||||
$managerClass = (string) str($relationship)
|
||||
->studly()
|
||||
->append('RelationManager');
|
||||
|
||||
$recordTitleAttribute = (string) str($this->argument('recordTitleAttribute') ??
|
||||
text(
|
||||
label: 'What is the Title attribute?',
|
||||
placeholder: 'Title attribute (e.g. `name`)',
|
||||
required: true
|
||||
))
|
||||
$recordTitleAttribute = (string) str($this->argument('recordTitleAttribute') ?? text(
|
||||
label: 'What is the title attribute?',
|
||||
placeholder: 'name',
|
||||
required: true,
|
||||
))
|
||||
->trim(' ');
|
||||
|
||||
$panel = $this->option('panel');
|
||||
|
||||
@@ -28,12 +28,11 @@ class MakeResourceCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$model = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'Model name?',
|
||||
placeholder: 'Model (e.g. `BlogPost`)',
|
||||
required: true
|
||||
))
|
||||
$model = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the model name?',
|
||||
placeholder: 'BlogPost',
|
||||
required: true,
|
||||
))
|
||||
->studly()
|
||||
->beforeLast('Resource')
|
||||
->trim('/')
|
||||
|
||||
@@ -34,7 +34,7 @@ class MakeUserCommand extends Command
|
||||
return [
|
||||
'name' => $this->options['name'] ?? text(
|
||||
label: 'Name',
|
||||
required: true
|
||||
required: true,
|
||||
),
|
||||
|
||||
'email' => $this->options['email'] ?? text(
|
||||
@@ -49,7 +49,7 @@ class MakeUserCommand extends Command
|
||||
|
||||
'password' => Hash::make($this->options['password'] ?? password(
|
||||
label: 'Password',
|
||||
required: true
|
||||
required: true,
|
||||
)),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -16,12 +16,11 @@ class MakeSettingsPageCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$page = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the page name?',
|
||||
placeholder: 'Page name (e.g. `ManageFooter`)',
|
||||
required: true
|
||||
))
|
||||
$page = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the page name?',
|
||||
placeholder: 'ManageFooter',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
@@ -31,12 +30,11 @@ class MakeSettingsPageCommand extends Command
|
||||
(string) str($page)->beforeLast('\\') :
|
||||
'';
|
||||
|
||||
$settingsClass = (string) str($this->argument('settingsClass') ??
|
||||
text(
|
||||
label: 'What is the settings name?',
|
||||
placeholder: 'Settings class (e.g. `FooterSettings`)',
|
||||
required: true
|
||||
))
|
||||
$settingsClass = (string) str($this->argument('settingsClass') ?? text(
|
||||
label: 'What is the settings name?',
|
||||
placeholder: 'FooterSettings',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ');
|
||||
|
||||
@@ -17,12 +17,11 @@ class MakeColumnCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$column = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the column name?',
|
||||
placeholder: 'Name (e.g. `StatusSwitcher`)',
|
||||
required: true
|
||||
))
|
||||
$column = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the column name?',
|
||||
placeholder: 'StatusSwitcher',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
|
||||
@@ -23,12 +23,11 @@ class MakeTableCommand extends Command
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$component = (string) str($this->argument('name') ??
|
||||
text(
|
||||
label: 'What is the table name?',
|
||||
placeholder: 'Products/ListProducts`)',
|
||||
required: true
|
||||
))
|
||||
$component = (string) str($this->argument('name') ?? text(
|
||||
label: 'What is the table name?',
|
||||
placeholder: 'Products/ListProducts',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
->trim('\\')
|
||||
->trim(' ')
|
||||
@@ -45,12 +44,11 @@ class MakeTableCommand extends Command
|
||||
->map(fn ($segment) => Str::lower(Str::kebab($segment)))
|
||||
->implode('.');
|
||||
|
||||
$model = (string) str($this->argument('model') ??
|
||||
text(
|
||||
label: 'What is the model name?',
|
||||
placeholder: 'Model (e.g. `Product`)',
|
||||
required: true
|
||||
))
|
||||
$model = (string) str($this->argument('model') ?? text(
|
||||
label: 'What is the model name?',
|
||||
placeholder: 'Product',
|
||||
required: true,
|
||||
))
|
||||
->replace('/', '\\');
|
||||
$modelClass = (string) str($model)->afterLast('\\');
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ class MakeWidgetCommand extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$widget = (string) str($this->argument('name') ?? text(
|
||||
label: 'Name (e.g. `BlogPostsChart`)',
|
||||
label: 'What is the widget name?',
|
||||
placeholder: 'BlogPostsChart',
|
||||
required: true,
|
||||
))
|
||||
->trim('/')
|
||||
@@ -40,10 +41,11 @@ class MakeWidgetCommand extends Command
|
||||
|
||||
if (class_exists(Resource::class)) {
|
||||
$resourceInput = $this->option('resource') ?? text(
|
||||
label: '(Optional) Resource (e.g. `BlogPostResource`)',
|
||||
label: 'Would you like to create the page inside a resource?',
|
||||
placeholder: '[Optional] BlogPostResource',
|
||||
);
|
||||
|
||||
if ($resourceInput !== null) {
|
||||
if (filled($resourceInput)) {
|
||||
$resource = (string) str($resourceInput)
|
||||
->studly()
|
||||
->trim('/')
|
||||
@@ -154,7 +156,7 @@ class MakeWidgetCommand extends Command
|
||||
|
||||
if ($this->option('chart')) {
|
||||
$chart = select(
|
||||
label: 'Chart type',
|
||||
label: 'Which type of chart would you like to create?',
|
||||
options: [
|
||||
'Bar chart',
|
||||
'Bubble chart',
|
||||
|
||||
Reference in New Issue
Block a user