modeltyper
modeltyper copied to clipboard
Generate TypeScript interfaces from Laravel Models
### What happened? ## The Problem I specified a "clickhouse" connection for one of my models using the [laravel clickhouse db driver](https://github.com/glushkovds/phpclickhouse-laravel). Now whenever I run the `model:typer` command, it...
```ts export interface RoleResults extends Omit { data: Role[] } ```
For instance, in User model ``` protected $casts = [ 'database_roles' => AsEnumCollection::class.':'.DatabaseRole::class, ] ``` Here is the error when running the model:typer tool. `Class "Illuminate\Database\Eloquent\Casts\AsEnumCollection:App\Enums\DatabaseRole" does not exist` It's...
Hi there, This is a great package, and thank you so much for putting it together. I wanted to throw out an idea for feedback and see if it's something...
### What happened? When running `vendor/bin/sail artisan model:typer --plurals --api-resources` modeltyper return this error: ```bash Exception Accessor method for parent_id on model App\Modules\ProductCatalog\Models\Category does not exist at vendor/fumeapp/modeltyper/src/Actions/DetermineAccessorType.php:38 34▕ return...
### What happened? I read that starting support is from Laravel version 9.21. I was on 8 so had to upgrade my project anyway, so I did. I'm currently at...
When using only casts it generates the types perfectly. But when we try to define an accessor then it looses the type ```php namespace App\Models; use App\Enums\PostType; use Illuminate\Database\Eloquent\Casts\Attribute; use...
What do you think about a feature that includes relation properties for the `withCount()` and `withExists()` Laravel methods? Such a feature would generate a Typescript definition like this: ```ts export...
closes #95 Not sure if I want to actually go as far as the example install autoloader (though I think it is necessary).