Jump to content

Identify model class properties


Recommended Posts


I wrote this code and printed it:



The result: (The result of executing the above code , return an object of the category class.)

App\Models\Category {#1353 ▼
  #connection: "mysql"
  #table: "categories"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  +preventsLazyLoading: false
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #escapeWhenCastingToString: false
  #attributes: array:5 [▶]
  #original: array:5 [▶]
  #changes: []
  #casts: []
  #classCastCache: []
  #attributeCastCache: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #fillable: array:2 [▶]
  #guarded: array:1 [▶]



but , When I run this code:

        $class_vars = get_object_vars($category);



array:5 [▼
  "incrementing" => true
  "preventsLazyLoading" => false
  "exists" => true
  "wasRecentlyCreated" => false
  "timestamps" => true


Which of the results, Are the real properties of category class ?
  I'm confused

Edited by ali_254
Link to comment
Share on other sites

  • ali_254 changed the title to Identify model class properties
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.