Skip to content

开发指令

生成插件 Command

Generate the given console command for the specified plugin.

sh
fresns make:command CreateDemoCommand

生成插件 Migration

Generate a migration for specified plugin.

sh
fresns make:migration create_demos_table

生成插件 Seed

Generate the given seed name for the specified plugin.

sh
fresns make:seed seed_fake_demos

生成插件 Factory

Generate the given database factory for the specified plugin.

sh
fresns make:factory FactoryName

生成插件 Provider

Generate the given service provider name for the specified plugin.

sh
fresns make:provider DemoServiceProvider

生成插件 Controller

Generate a controller for the specified plugin.

sh
fresns make:controller PostsController

生成插件 Model

Generate the given model for the specified plugin.

sh
fresns make:model Post

Optional options:

  • --fillable=field1,field2: set the fillable fields on the generated model
  • --migration, -m: create the migration file for the given model

生成插件 Middleware

Generate the given middleware name for the specified plugin.

sh
fresns make:middleware CanReadPostsMiddleware

生成插件 DTO

Generate a DTO(data transfer object) for specified plugin.

sh
fresns make:dto VerifySignDTO

生成插件 Mail

Generate the given mail class for the specified plugin.

sh
fresns make:mail SendWeeklyPostsEmail

生成插件 Notification

Generate the given notification class name for the specified plugin.

sh
fresns make:notification NotificationAdminOfNewComment

生成插件 Listener

Generate the given listener for the specified plugin. Optionally you can specify which event class it should listen to. It also accepts a --queued flag allowed queued event listeners.

sh
fresns make:listener NotificationUsersOfANewPost

fresns make:listener NotificationUsersOfANewPost --event=PostWasCreated

fresns make:listener NotificationUsersOfANewPost --event=PostWasCreated --queued

生成插件 Request

Generate the given request for the specified plugin.

sh
fresns make:request CreatePostRequest

生成插件 Event

Generate the given event for the specified plugin.

sh
fresns make:event BlogPostWasUpdated

生成插件 Job

Generate the given job for the specified plugin.

sh
fresns make:job JobName

//A synchronous job class
fresns make:job JobName --sync

生成插件 Policy

Generate the given policy class for the specified plugin.

The Policies is not generated by default when creating a new plugin. Change the value of paths.generator.policies in plugins.php to your desired location.

sh
fresns make:policy PolicyName

生成插件 Rule

Generate the given validation rule class for the specified plugin.

The Rules folder is not generated by default when creating a new plugin. Change the value of paths.generator.rules in plugins.php to your desired location.

sh
fresns make:rule ValidationRule

生成插件 Resource

Generate the given resource class for the specified plugin. It can have an optional --collection argument to generate a resource collection.

The Transformers folder is not generated by default when creating a new plugin. Change the value of paths.generator.resource in plugins.php to your desired location.

sh
fresns make:resource PostResource

fresns make:resource PostResource --collection

生成插件 Test

Generate the given test class for the specified plugin.

sh
fresns make:test EloquentPostRepositoryTest

生成插件任务调度提供者

Generate a console service provider for specified plugin.

sh
fresns make:console-provider

生成插件事件服务提供者

Generate a event provider for specified plugin.

sh
fresns make:event-provider
  • You need to add it yourself to the providers parameter of plugin.json.

生成插件 SQL 服务提供者

Generate a sql provider for specified plugin.

sh
fresns make:sql-provider
  • You need to add it yourself to the providers parameter of plugin.json.

生成插件 Exception 服务提供者

Generate a exception provider for specified plugin.

sh
fresns make:exception-provider

生成插件「命令字」服务提供者

Generate a cmd word service provider for specified plugin.

sh
fresns make:cmdword-provider
  • You need to add it yourself to the providers parameter of plugin.json.

遵循 Apache-2.0 开源协议