orchestral / canvas

Code Generators for Laravel Applications and Packages
https://packagist.org/packages/orchestra/canvas
MIT License
187 stars 12 forks source link

Models Path #11

Closed almasaeed2010 closed 3 years ago

almasaeed2010 commented 3 years ago

Hello!

Quick question. Is there a way to specify where models should be placed when running canvas make:model? I tried adding path: src/Models to the yaml file but no luck there.

Thanks in advance for the help!

crynobone commented 3 years ago

You should be able to change the location by updating the namespace variable under model. path is mostly for file without namespace.

almasaeed2010 commented 3 years ago

Thanks for the response @crynobone

I tried your suggestion as shown below. However, the model generated still goes to src/ and not src/Models even though the namespace generated in the new model is correct (namespace Acme\Package\Models;).

model:
  namespace: Acme\Package\Models
crynobone commented 3 years ago

can you share the full canvas.yaml file

almasaeed2010 commented 3 years ago

Here is the file

preset: package

namespace: Acme\Package
user-auth-provider: App\User

paths:
  src: src
  resource: resources

factory:
  path: src/Factories

migration:
  path: src/Migrations
  prefix: ''

console:
  namespace: Acme\Package\Console

model:
  namespace: Acme\Package\Models

provider:
  namespace: Acme\Package

testing:
  namespace: Acme\Package\Tests

middleware:
  namespace: Acme\Package\Http\Middleware
crynobone commented 3 years ago

Can you check whether the latest commit fixed the problem?

crynobone commented 3 years ago

This should have been fixed.