Skip to content

Commit

Permalink
Add model property types to magic where methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpickwell committed Jul 13, 2020
1 parent 6cb0201 commit 288b89e
Show file tree
Hide file tree
Showing 17 changed files with 387 additions and 385 deletions.
6 changes: 4 additions & 2 deletions src/Console/ModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,11 @@ protected function getPropertiesFromTable($model)
if (!$column->getNotnull()) {
$this->nullableColumns[$name] = true;
}

$propertyType = $this->getTypeInModel($model, $type);
$this->setProperty(
$name,
$this->getTypeInModel($model, $type),
$propertyType,
true,
true,
$comment,
Expand All @@ -449,7 +451,7 @@ protected function getPropertiesFromTable($model)
$this->getClassNameInModel($model, \Illuminate\Database\Eloquent\Builder::class)
. '|'
. $this->getClassNameInModel($model, get_class($model)),
array('$value')
array(empty($propertyType) ? '$value' : "{$propertyType} \$value")
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Simple query()
* @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Simple whereId(integer $value)
* @mixin \Eloquent
*/
class Simple extends Model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate query()
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate whereCreatedAt(\Carbon\CarbonImmutable $value)
* @method static \Illuminate\Database\Eloquent\Builder|CustomDate whereUpdatedAt(\Carbon\CarbonImmutable $value)
* @mixin \Eloquent
*/
class CustomDate extends Model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,79 +83,79 @@
* @method static \Illuminate\Database\Eloquent\Builder|Post newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Post newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Post query()
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNotNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNotNullable(mixed $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNullable(mixed $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCreatedAt(\Illuminate\Support\Carbon $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNotNullable(float $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNullable(float $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNotNullable(float $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNullable(float $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereId(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUpdatedAt(\Illuminate\Support\Carbon $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNotNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNullable(string $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNotNullable(integer $value)
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable(integer $value)
* @mixin \Eloquent
*/
class Post extends Model
Expand Down
Loading

0 comments on commit 288b89e

Please sign in to comment.