Download the PHP package bensherred/laravel-make-model without Composer

On this page you can find all versions of the php package bensherred/laravel-make-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-make-model

Laravel Make Model

This package extends the Laravel make:controller and make:model commands to create policies, requests and views all within 1 command. The arguments you specify will also affect the controller that gets generated. Installing this package also creates a make:view command.

Installation

You can install this package via composer:

The service provider will automatically register or you may manually add the service provider in your file:

Usage

There are 2 parts to this package, the extension of the Laravel make:model command and the Laravel make:controller command.

make:model

If you run the following command, you will notice 1 extra option and that the --all argument has been updated.

First off, running the following command will not only generate a migration, factory and resource controller but it will also now create a policy, request classes and views.

The additional classes/files that will get created for this example are:

The controller that gets generated will automatically return the views, include the requests and policy.

Another option that is available is to just create the policy for the model. This can be done by running the following command:

make:controller

The extension of the make:controller is very similar to the make:model command, but has a few additional options.

Creating a policy

To create a policy along with the controller you can add the --policy option. This will only get added to the controller automatically if you specify a model for the controller.

Running the above command will create a resource controller and use the Post model, along with creating the PostPolicy and including the authorizeResource option in the controller.

If you already have a policy or would like a custom name for a policy you can run the following command:

If you create a resource controller the policy will be create, but the authorizeResource option will not be automatically added to the controller.

Create requests

If you would like to create custom request classes for your controller, you can add the --requests option to the command. This will create a {Model}StoreRequest and {Model}UpdateRequest class under app/Http/Requests/{Model}/.

This option will work for both model controllers and resource controllers. If you create a model controller by specifying the --model= option, it will use the model name to create the requests folder. However, if you create a resource controller, it will remove the world Controller from the controller name and use that instead.

Therefore, running the following command will create a StorePostRequest and UpdatePostRequest class under app/Http/Requests/Post.

Create views

Another option which has been added to the make:controller command is the ability to automatically create views. You can this by specifying the --views option. If you were creating a PostController and added this option, the following views would be created under a folder called post:

Like the --requests option, if you specify a model it will use the model name for the folder. However, if you create a resource controller it will work out the name of the folder based on the controller name.

If you create a model or resource controller, the views will also be automatically added to the controller. If a model controller is generated, it will also pass the model through to the controller.

Please note if you specify the --api option, this option will be ignored

Using multiple options

If you would like to use multiple options, you can daisy chain them on.

For example, running the command below would create a model controller along with then policy and the 2 request classes:

Alternatively, you can use all 3 together:

make:view

This package also creates a make:view command available.

Running the following command will create an index.blade.php file under a blog folder in views.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-make-model with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bensherred/laravel-make-model contains the following files

Loading the files please wait ....