Skip to content
Discussion options

You must be logged in to vote

Sorry for the late response. Found another way to bind that with model. Which is written as secondary solution.

Solution 1
With enforceMorphMap
I had to write below code in AppServiceProvider.php 's boot method.

use Illuminate\Database\Eloquent\Relations\Relation; 

public function boot() {
        Relation::enforceMorphMap([
            'SubDealers' => 'App\Models\Partners\Subdealer\tbl_subdealer_master'
        ]);
    }

and below line in model file.

protected $guard_name = 'web'; //this could be a custom guard. I choose to go with default one.

Solution 2 - Secondary Solution
I had to append one model attribute name as id to bind roles object with the model. This one may have flaws. I…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@drbyte
Comment options

drbyte May 8, 2023
Collaborator

@drbyte
Comment options

drbyte Jun 18, 2023
Collaborator

@drbyte
Comment options

drbyte Jun 26, 2023
Collaborator

@dutchman1990
Comment options

Answer selected by drbyte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants