Created
September 9, 2021 14:53
-
-
Save FunctionDJ/b76fcd4692a9837765bffb500eeac973 to your computer and use it in GitHub Desktop.
phpstan/larastan issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Database\Seeders; | |
use App\Models\ItemProfile; | |
class Foo | |
{ | |
public function run(): void | |
{ | |
$profile = ItemProfile::firstOrFail(); | |
echo $profile->warehouse; // Access to an undefined property (...) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Database\Eloquent\Model; | |
class ItemProfile extends Model | |
{ | |
use HasFactory; | |
protected $casts = [ | |
"has_batch_number" => "boolean", | |
"is_receivable" => "boolean", | |
"is_hazardous" => "boolean", | |
"has_host_notification" => "boolean", | |
"is_deleted" => "boolean" | |
]; | |
public function item() | |
{ | |
return $this->hasOne(Item::class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment