karimi_wahid wrote a comment+100 XP
3w ago
Auth::user()->ideas()->create([ 'description' => request('description'), 'state' => 'pending', ]); Undefined method 'ideas'.
karimi_wahid liked a comment+100 XP
3w ago
It would be great if there was a Git repository of the code so we could check for any errors.
karimi_wahid wrote a comment+100 XP
4w ago
Dear Laracasts team,
I hope this message finds you all well. First off, I just want to say how much I admire the work you’ve put into Laracasts. The quality of your content is incredible, and it has helped so many developers like me grow. My name is Wahidullah Karimi, and I’m a student living in Afghanistan. I’m truly passionate about web development and I’m trying my best to learn Laravel and modern PHP practices. But honestly, the monthly subscription fee, while fair for many, is far out of reach for me here. The economic situation in Afghanistan is very difficult right now, and even a small amount in USD can be overwhelming for a student like me. I’m not asking for a free ride — just a small discount that could make the subscription fit into my reality as a student from a low-income country. Your platform would be a lifeline for me to continue learning and eventually build a better future for myself and my family.
Thank you for considering my request, and thank you for everything you do for the dev community. Either way, I’ll keep following your free content with gratitude.
Warmly, Wahidullah Karimi A hopeful developer from Afghanistan
karimi_wahid liked a comment+100 XP
1mo ago
@karimi_wahid Hi, if you would load the page first time, it would try to read the session, but since you have not pushed any ideas so far, session()->read('ideas') would return null. If you used @foreach directive on it, it would result in an error, because you cannot foreach a null.
To remedy this, session()->read() function has a second argument that sets a default value if the key is not found. Jeffrey used an empty array, so if your session is empty, instead of a null, an empty array is returned. And because empty array is still an array (technically), @foreach throws no errors.
karimi_wahid wrote a comment+100 XP
1mo ago
What is the array -> [] for in here $ideas = session()->get('ideas', []);