Skip to content

feat: User defined Class aliases in .phpantom.toml (Like 'Illuminate\Contracts\Auth\Authenticatable' = 'App\Models\User') #53

@AbyssWaIker

Description

@AbyssWaIker

Love the project and all of the good work you are doing

TODO for Laravel mentions "Application provider scanning", "Auth model from config", "Contract → concrete resolution", and "Manager → driver resolution" being all out of scope.

So I had an idea to let users specify this inside of a config (so it get's scanned once on a start up into a hashmap and once key for the hashmap is encountered it can be treated as a value)

This may help both Laravel devs like me and other devs who have different specialized use-cases.

Though recently you have removed "better auth() helper type" from "won't fix", so you may already have an idea how to do it, I'm publishing the issue in case this solution may be more re-usable and may cause less head-aches with people creating their own custom User model with a different path/name and specifying them in config/auth.php

init-ing default toml file with something like:

(update: fixed an obvious oversight of me copying a wrong class)

[aliases]
'Illuminate\Contracts\Auth\Factory' = 'Illuminate\Auth\AuthManager'
'Illuminate\Contracts\Auth\Authenticatable' = 'App\Models\User'

may both solve auth()->user() type error in a re-usable way and inform users of the way this feature works.

I hope even if this won't fit into the project it can give you some ideas for sprints 5-7

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions