DoubleClickDesignLtd wrote a comment+100 XP
5d ago
I've been using Livewire since version 1.5, and I ended up building a large enterprise application with Livewire 2. At the time, some of my coworkers thought I was completely mad for choosing it, but I could already see the potential of the framework.
Slots are an incredible addition. If it isn't immediately obvious why, here's a real-world example.
I spent more than four years building a large enterprise project in Livewire 2. A common pattern was having a checkbox or another interactive element inside a child component while the parent needed to control or respond to it. The usual approach was for the child to emit an event with a payload, and then for the parent to listen for that event and update its own state.
On the surface, that doesn't sound like a big deal. But when you're building complex client dashboards packed with interactive features, that constant back-and-forth communication adds a surprising amount of boilerplate. Over the years, I spent countless hours writing event emissions, listeners, and glue code just to make simple interactions work.
Looking back, I can appreciate how difficult this problem was to solve from a framework perspective. Enabling the parent to naturally inject and control content inside child components is a huge improvement, and I can only imagine how challenging it was to implement.
This is a much bigger feature than I think it's being presented as. It's one of those improvements that enterprise developers will appreciate immediately because it removes a lot of repetitive code and makes component composition feel much more natural.
Well done, @calebporzio
DoubleClickDesignLtd wrote a reply+100 XP
5mos ago
Hi @silveira, I've read about a similar issue in another post when upgrading to Livewire 4 and Filament. They fixed it by deleting the node_modules directory and installed the nodes packages again. I suggest giving it a try.
DoubleClickDesignLtd liked a comment+100 XP
5mos ago
Latest update.
After trying different things I deleted the node_modules directory and installed the nodes packages again. It solved the problem - as far as I can see
DoubleClickDesignLtd wrote a reply+100 XP
5mos ago
@troccoli I'm not 100% sure why your doing the persistent cache from what your describing.
However to answer your test fail issue, I believe this happens because Laravel’s test environment fakes the cache store, so the value you put() in the test is not available when the Livewire request runs.
Livewire component actions (->call('completeProfile')) are executed through a separate HTTP request lifecycle.
In your test, when you do the below, that value is stored in the cache instance for the current test lifecycle.
Cache::store('persistent')->put(key: $cacheKey, value: new SignUpAttempt(...));
During the Livewire call, Laravel boots a new request and the cache store is resolved again. In tests, Laravel commonly swaps cache stores with an array / fake store (or otherwise non-persistent store), so your “persistent” store isn’t actually hitting your persistent_cache DB table during the Livewire request.
That why the test is failing from my understand. To fix try forcing Laravel to use the real cache store in tests, not the fake/array one.
Question: Have you ensure cache tables exist in test DB and you set up the phpunit.xml to use your cache driver?
Let me know how you get on.
All the best
Mark
DoubleClickDesignLtd wrote a reply+100 XP
5mos ago
If you need to get your head round the backend I would suggest your start by doing the Level 1 The Fundamentals.
It a good base line and will help you moving forward.
DoubleClickDesignLtd wrote a reply+100 XP
5mos ago
No problem I wish you the best with your learning
DoubleClickDesignLtd liked a comment+100 XP
5mos ago
Thank you very kindly.
DoubleClickDesignLtd liked a comment+100 XP
5mos ago
@yumna12-coder You might not be ready for this series. Can you describe precisely what you found difficult, and we can point you to a place to learn more?
DoubleClickDesignLtd wrote a reply+100 XP
5mos ago
First don't be too hard on yourself. Everything you stated as challenging are very large areas of programming in general. Everyone finds them challenging. The good news is their are various courses on Laracasts that can help you.
I had difficulty with Testing and I'm still not great a it. I found watch this course help me a lot.
https://laracasts.com/series/php-testing-jargon
Also I recommend reading the Laravel documentation. I know it sound scary but the documentation is very human friendly to read and understand.
If you just struggling with the PHP in general I would recommend "PHP For Beginners" and the "PHP Crash Course" on Laracasts.
Authorisation is a massive topic and even after all my 20+ years as a developer I'm still learning on this subject. The best way to pick it up is to create a simple app yourself.
Start with a Laravel start kit. Use something like Laravel Breeze starter kit and learn to use the existing Auth process. By doing this you will learn the basics and you can look at the start kit codebase and start reading it to understand what going on.
Here a very good Laracasts course on the subject
https://laracasts.com/series/laravel-authentication-options
If you still don't understand I suggest copying the script into chatGPT and asking it to explain in detail what each line does and why, it can be a helpful exercise if you don't understand something.
Gate and Policies sound more complex than they really are. They are just layers you can add to system security. You don't have to master everything all at once. Just learn to get comfortable with Authorisation then once your good start playing with Gate...then Policies. Before long you will start feeling comfortable with everything.
Just remember programming is creative exercise and you learn through play. So just have fun and play.
As far as Vite and UI I would recommend watching.
https://laracasts.com/series/laravel-and-vite
I hope the above helps you and if you have any particular questions just let me know and I've tried and explain it to you.
All the best :-)