Skip to content

Laravel 12 - model attributes not shown by default in php artisan tinker interactive shell (PsySH 0.12.14) #193

@andvaranaut

Description

@andvaranaut

Laravel Version

12.39.0

PHP Version

8.4.14

Database Driver & Version

No response

Description

Usually, if you use an expression which returns a Model, a Collection and such, it is shown in the REPL:

Psy Shell v0.12.10 (PHP 8.3.6 — cli) by Justin Hileman
> User::first()
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
= App\Models\User {#6200
    id: 1,
    name: "admin",
    fullname: "Admin",
(............... rest of the model ...............)
    created_at: "2025-08-07 16:32:46",
    updated_at: "2025-08-07 16:33:18",
  }

However, in a recent Laravel 12 project, that stopped happening automatically for Models, Collections and such, even though using eg. ->getAttributes() works, and that the attributes are accessible:

Psy Shell v0.12.14 (PHP 8.4.14 — cli) by Justin Hileman
New PHP manual is available (latest: 3.0.0). Update with --update-manual
> User::first()
[!] Aliasing 'User' to 'App\Models\User' for this Tinker session.
= App\Models\User {#6112 …8}
> User::first()->id
= 1
> User::first()->getAttributes()
= [
    "id" => 1,
    "name" => "Admin",
    "email" => "admin@test.test",
(............... rest of the model ...............)
    "created_at" => "2025-11-24 13:05:28",
    "updated_at" => "2025-11-24 13:05:28",
  ]
> 

This is happening in a recent Laravel 12 installation, which installed the most recent stable version of PsySH (0.12.14). This seems to be a regression in PsySH, as reverting to PsySH 0.12.10 fixes the issue. Other than that, I have had no success trying to get PsySH 0.12.14 to work.

Steps To Reproduce

  • Install new Laravel 12 project
  • Create any model (eg. User)
  • php artisan tinker + User::first()
  • The model attributes should be shown

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions