Skip to content

Commit

Permalink
chore: add property annotations to models
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jan 3, 2025
1 parent ef316f8 commit 88deb21
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 70 deletions.
70 changes: 0 additions & 70 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,6 @@ parameters:
count: 1
path: src/ApiResources/Transformers/OrderTransformer.php

-
message: "#^Access to an undefined property Igniter\\\\PayRegister\\\\Models\\\\Payment\\:\\:\\$code\\.$#"
count: 1
path: src/ApiResources/Transformers/PaymentMethodTransformer.php

-
message: "#^Access to an undefined property Igniter\\\\PayRegister\\\\Models\\\\Payment\\:\\:\\$description\\.$#"
count: 1
path: src/ApiResources/Transformers/PaymentMethodTransformer.php

-
message: "#^Access to an undefined property Igniter\\\\PayRegister\\\\Models\\\\Payment\\:\\:\\$name\\.$#"
count: 1
path: src/ApiResources/Transformers/PaymentMethodTransformer.php

-
message: "#^Access to an undefined property Igniter\\\\Reservation\\\\Models\\\\Reservation\\:\\:\\$assignee\\.$#"
count: 1
Expand Down Expand Up @@ -185,26 +170,6 @@ parameters:
count: 1
path: src/ApiResources/Transformers/ReviewTransformer.php

-
message: "#^Access to an undefined property Igniter\\\\Api\\\\Models\\\\Resource\\:\\:\\$controller\\.$#"
count: 1
path: src/Classes/ApiManager.php

-
message: "#^Access to an undefined property Igniter\\\\Api\\\\Models\\\\Resource\\:\\:\\$endpoint\\.$#"
count: 2
path: src/Classes/ApiManager.php

-
message: "#^Access to an undefined property Igniter\\\\Api\\\\Models\\\\Resource\\:\\:\\$meta\\.$#"
count: 1
path: src/Classes/ApiManager.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\Igniter\\:\\:hasDatabase\\(\\)\\.$#"
count: 1
path: src/Classes/ApiManager.php

-
message: "#^Result of method Illuminate\\\\Console\\\\Command\\:\\:error\\(\\) \\(void\\) is used\\.$#"
count: 1
Expand Down Expand Up @@ -285,31 +250,11 @@ parameters:
count: 1
path: src/Http/Controllers/CreateToken.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Resources.php

-
message: "#^Call to an undefined static method Igniter\\\\Admin\\\\Facades\\\\AdminMenu\\:\\:setContext\\(\\)\\.$#"
count: 1
path: src/Http/Controllers/Tokens.php

-
message: "#^Access to an undefined property Illuminate\\\\Support\\\\Optional\\:\\:\\$tokenable\\.$#"
count: 1
path: src/Listeners/TokenEventSubscriber.php

-
message: "#^Access to an undefined property Igniter\\\\Api\\\\Models\\\\Resource\\:\\:\\$endpoint\\.$#"
count: 6
path: src/Models/Resource.php

-
message: "#^Access to an undefined property Igniter\\\\Api\\\\Models\\\\Resource\\:\\:\\$meta\\.$#"
count: 1
path: src/Models/Resource.php

-
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$description\\.$#"
count: 1
Expand All @@ -335,31 +280,16 @@ parameters:
count: 1
path: src/Models/Resource.php

-
message: "#^Call to an undefined static method Igniter\\\\Api\\\\Models\\\\Resource\\:\\:lists\\(\\)\\.$#"
count: 1
path: src/Models/Resource.php

-
message: "#^Call to an undefined static method Igniter\\\\Api\\\\Models\\\\Resource\\:\\:where\\(\\)\\.$#"
count: 1
path: src/Models/Resource.php

-
message: "#^Call to an undefined static method Igniter\\\\Flame\\\\Support\\\\Facades\\\\File\\:\\:existsInsensitive\\(\\)\\.$#"
count: 1
path: src/Models/Resource.php

-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 3
path: src/Models/Resource.php

-
message: "#^Access to an undefined property Igniter\\\\Api\\\\Models\\\\Token\\:\\:\\$tokenable_type\\.$#"
count: 2
path: src/Models/Token.php

-
message: "#^Call to an undefined method Igniter\\\\Flame\\\\Database\\\\Model\\:\\:tokens\\(\\)\\.$#"
count: 1
Expand Down
32 changes: 32 additions & 0 deletions src/Models/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@

/**
* Resource Model
*
* @property int $id
* @property string $name
* @property string $endpoint
* @property string|null $description
* @property array|null $meta
* @property bool $is_custom
* @property-read mixed $base_endpoint
* @property-read mixed $controller
* @method static \Igniter\Flame\Database\Builder<static>|Resource applyFilters(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|Resource applySorts(array $sorts = [])
* @method static \Igniter\Flame\Database\Builder<static>|Resource dropdown(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|Resource findSimilarSlugs($attribute, array $config, $slug)
* @method static \Igniter\Flame\Database\Builder<static>|Resource like(string $column, string $value, string $side = 'both', string $boolean = 'and')
* @method static \Igniter\Flame\Database\Builder<static>|Resource listFrontEnd(array $options = [])
* @method static \Igniter\Flame\Database\Builder<static>|Resource lists(string $column, string $key = null)
* @method static \Igniter\Flame\Database\Builder<static>|Resource newModelQuery()
* @method static \Igniter\Flame\Database\Builder<static>|Resource newQuery()
* @method static \Igniter\Flame\Database\Builder<static>|Resource orLike(string $column, string $value, string $side = 'both')
* @method static \Igniter\Flame\Database\Builder<static>|Resource orSearch(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|Resource pluckDates(string $column, string $keyFormat = 'Y-m', string $valueFormat = 'F Y')
* @method static \Igniter\Flame\Database\Builder<static>|Resource query()
* @method static \Igniter\Flame\Database\Builder<static>|Resource search(string $term, string $columns = [], string $mode = 'all')
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereDescription($value)
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereEndpoint($value)
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereId($value)
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereIsCustom($value)
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereMeta($value)
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereName($value)
* @method static \Igniter\Flame\Database\Builder<static>|Resource whereSlug(string $slug)
* @mixin \Igniter\Flame\Database\Model
*/
class Resource extends Model
{
Expand Down Expand Up @@ -49,6 +80,7 @@ class Resource extends Model

protected $casts = [
'meta' => 'array',
'is_custom' => 'boolean',
];

protected $permalinkable = [
Expand Down
24 changes: 24 additions & 0 deletions src/Models/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,30 @@

/**
* Token Model
*
* @property int $id
* @property string $tokenable_type
* @property int $tokenable_id
* @property string $name
* @property string $token
* @property array|null $abilities
* @property \Illuminate\Support\Carbon|null $last_used_at
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $tokenable
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereAbilities($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereLastUsedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereToken($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereTokenableId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereTokenableType($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Token whereUpdatedAt($value)
* @mixin \Igniter\Flame\Database\Model
*/
class Token extends PersonalAccessToken
{
Expand Down

0 comments on commit 88deb21

Please sign in to comment.