Open profprof-hub opened 2 years ago
I am facing the same issue/errors? Any fix for that? I tried Laravel Docs, stackoverflow etc.
It seems to have fixed the problem when I replaced ' auth()->user()->listings()->get() ' to 'request()->user()->listings()->get()'.
I have solved that issue by changing the access modifier of the listings() method from protected function listings (){
return $this->hasMany(Listing::class, 'user_id');
} to public function listings (){ return $this->hasMany (Listing::class, 'user_id'); } in the User Model.
Yes, for now, the request () is the best solution to the problem.
On Sat, Aug 20, 2022, 8:22 PM TechNech @.***> wrote:
It seems to have fixed the problem when I replaced ' auth()->user()->listings()->get() ' to 'request()->user()->listings()->get()'.
— Reply to this email directly, view it on GitHub https://github.com/bradtraversy/laragigs/issues/13#issuecomment-1221391226, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2LL5INP2I4VN336HLNG5OLV2EV6DANCNFSM56WK3VLQ . You are receiving this because you modified the open/close state.Message ID: @.***>
When you use the request() method in place of auth(), the error will disappear.
On Sun, Oct 9, 2022, 4:16 PM Iorawua. H Francis @.***> wrote:
Yes, for now, the request () is the best solution to the problem.
On Sat, Aug 20, 2022, 8:22 PM TechNech @.***> wrote:
It seems to have fixed the problem when I replaced ' auth()->user()->listings()->get() ' to 'request()->user()->listings()->get()'.
— Reply to this email directly, view it on GitHub https://github.com/bradtraversy/laragigs/issues/13#issuecomment-1221391226, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2LL5INP2I4VN336HLNG5OLV2EV6DANCNFSM56WK3VLQ . You are receiving this because you modified the open/close state.Message ID: @.***>
I have solved that issue by changing the access modifier of the listings() method from protected function listings (){ return $this->hasMany(Listing::class, 'user_id'); } to public function listings (){ return $this->hasMany (Listing::class, 'user_id'); } in the User Model.
Where exactly? I have the modifier public and it's still not working.
"severity": 8,
"message": "Undefined method 'listings'.",
"source": "intelephense",
"startLineNumber": 99,
"startColumn": 67,
"endLineNumber": 99,
"endColumn": 75
Even if public function listings() is in User table the listings() method shows as undefined in listingcontroller.php
Undefined method 'listings'.intelephense(P1013): Seems like the plugin is just not recognizing the function, but it still works fine.
I just ignored it.
/** @disregard */
return view('listings.manage', [
'listings' => auth()->user()->listings()->paginate() //intelephense marks this as an error but it works
]);
Mine too is working fine, despite the error message
On Sun, Dec 17, 2023, 11:00 AM karizmaj @.***> wrote:
Undefined method 'listings'.intelephense(P1013): Seems like the plugin is just not recognizing the function, but it still works fine.
I just ignored it.
/* @disregard / return view('listings.manage', [ 'listings' => auth()->user()->listings()->paginate() //intellephense marks this as an error but it works ]);
— Reply to this email directly, view it on GitHub https://github.com/bradtraversy/laragigs/issues/13#issuecomment-1859096591, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2LL5IIGG4TRZNM2MIXXNATYJ27FHAVCNFSM56WK3VL2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBVHEYDSNRVHEYQ . You are receiving this because you modified the open/close state.Message ID: @.***>
i am having issue with this line of code "return view('listings.manage', ['listings' => auth()->user()->listings()->get()]);". i try replacing it with the one on github but it still not working.