Level 102
if($page->homepage) { //if 1 or true
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When I test the page model for its attributes doing a dd($page) basically grabbing the page model data I get this dd dump:
App\Models\Published\Page {#1482 ▼
#connection: "mysql_publish"
#table: "pages"
#primaryKey: "id"
#keyType: "int"
+incrementing: true
#with: []
#withCount: []
+preventsLazyLoading: false
#perPage: 15
+exists: true
+wasRecentlyCreated: false
#escapeWhenCastingToString: false
#attributes: array:9 [▼
"id" => 297
"grid_id" => 40
"project_id" => 23
"homepage" => 1
"name" => "home"
"slug" => "home"
"json" => ".....
...
I want to check if homepage is 1 or true basically. How can I grab the value for homepage here?
if($page->homepage) { //if 1 or true
Please or to participate in this conversation.