Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

ModelMakeCommand

Ferdinand Frank edited this page Jan 31, 2019 · 2 revisions

Creates a new Eloquent model class. Extends the Laravel's native ModelMakeCommand by adding options to create a policy, a resource, and a resource collection class.

Usage

php artisan make:model [options] [--] <name>

Arguments

Argument Description Note
name The name of the class Required

Options

Option Description
-a, --all Generate a migration, policy, api resources, factory, and resource controller for the model
-m, --migration Create a new migration file for the model
-f, --factory Create a new factory for the model
-c, --controller Create a new controller for the model
-r, --resource Indicates if the generated controller should be a resource controller
-p, --policy Create a new policy for the model
--api Create a resource and a resource collection file for the model
--pivot Indicates if the generated model should be a custom intermediate table model
--force Create the class even if the model already exists
-h, --help Display a help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages

Stubs

This table gives you an overview when which stub file is used as a template to create the php file.

Stub Command Restriction
model.stub Always used
Clone this wiki locally