Created
September 9, 2021 14:53
-
-
Save FunctionDJ/b76fcd4692a9837765bffb500eeac973 to your computer and use it in GitHub Desktop.
Revisions
-
FunctionDJ created this gist
Sep 9, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ <?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 hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <?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); } }