Тёмный

Laravel Blade Components: Two Examples - Laravel Breeze/UI 

Laravel Daily
Подписаться 145 тыс.
Просмотров 37 тыс.
50% 1

Опубликовано:

 

25 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 88   
@sergiuprt
@sergiuprt 3 года назад
I found out about these components recently when I've installed breeze for a small personal project. It wasn't clear at all what's the deal with them. It's clear now! thank you!
2 года назад
Hey, I am just falling love in your channel! I learn laravel now, and it is so difficult to me to find explanations of laravel features, that makes really sence! I don't need so much time to understand them! Thans man!
@IlPandax
@IlPandax 4 года назад
As far as I can understand, components are perfect in replacing "elements" (inputs, images, buttons, etc.) but are a complete mess when they replace "sections". I think, and of course I could be wrong, we should take a step back to extend sections and use components to replace elements.
@PovilasKorop
@PovilasKorop 4 года назад
Exactly my takeaway as well.
@javieru5871
@javieru5871 4 года назад
Well, I guess it depends on the Component's responsibility, if it is a simple plain dumb Component, I guess it is ok to extract things like inputs, buttons, images, selections, etc with no structural markup in this kind of Component.
@phread6691
@phread6691 3 года назад
I implemented blade components/slots. Took a bit, but I got it done and working. HOWEVER, I decided to revert back to the original code due to a major issue: it was taking more 50-60mg of memory to display the blade. I spent multiple days trying to find why the memory went up, and found that once I reverted back to the original code I was able to decrease the memory usage by 50-60mg.. Holy cow!!!!!! One other issue, the code seemed to have gotten much more difficult for somebody to follow. This might be a personal issue, mine. I am bummed that I can't use this approach. I will revisit this if/when the components/slots are allowed to be compiled. It will be interesting to see the difference. However, THANK YOU for taking your time to create this video. It was a tremendous help for me to create the components/slots.
@msmitsumitsuko
@msmitsumitsuko 3 года назад
This overwhelmed me so much. So happy you made this video.
@Ruggie1of1
@Ruggie1of1 4 года назад
I've always used view partials that I pass an array to as a second parameter long before components came out. I use them virtually the same way (inputs, buttons, charts, modals, etc) but feel I have more flexibility (not to mention several large code bases with this already in place). I can pass any data I want to the view, including custom arrays without any weird IDE linting issues. I have the option to place the views wherever I want instead of a central components folder. And I feel it makes it clear "something dynamic/special is happening here" instead of trying to look like another html tag. If anyone is wondering how to do this, just make a view without any @sections in it. Then use @include('path.to.your.view', [array_of_data_here]) where you want it to show up. The array data ends up in the views local scope. So if you pass ['data'=>$something] you can access it in the view by calling $data. For edge cases where I need default logic, I handle that in the view partial via a @php declaration at the top of the view that checks if the expected input exists and creates the default if needed. This wasn't meant to be an argument against components, more that there was already a way to get DRY within Laravel before they came along.
@theological1127
@theological1127 4 года назад
i've been using laravel since 5.5 and i use it almost exclusively for every project big or small. I'd be lying if I said that laravel wasn't leaving me behind. I take a break from learning to work on projects for 3-4 months and when I come back during a lull the laravel world has sped forward and there's so much new material out. Like you, sometimes I wonder what the trade off value is: use repeated code that I'm super familiar with and just copy/paste because it's second nature, or take the time to learn the new component syntax. Will I save more copy/paste time by learning the syntax or will I spend more time learning syntax than it takes me to just copy/paste things....
@PovilasKorop
@PovilasKorop 4 года назад
The short answer is "it depends".
@martinh4982
@martinh4982 4 года назад
Agreed. When I started my project last year it was with Laravel 5.8. I launched last week and in the intervening time we had Laravel 6, Laravel 7 and Laravel 8 (which I can't use, due to LTS linux on the server only supporting PHP 7.2). The pace of change in Laravel world is stupidly - and unnecessarily - fast. I can't spend all day, everyday, learning about new Laravel features!
@dmdk8301
@dmdk8301 3 года назад
@@martinh4982 plus million. I used to skip almost a year. And i was so angry when i saw current version 8. Cmon, when was 7??? And what i see? Tailwind, inertia, livewire, jetstream etc etc etc. Imho everythings getting more and more complicated. And too fast. What was to the purpose of rewriting all route files from controller@action into controller:class, 'action'. Extra commas, brackets. View folder is now a true quest. I am so disappionted, really. In order to start a basic project you have to make too many extra movements, installations, requirements, npms ... In early 00 i had a notepad txt editor, and dreamweaver-) and a full-featured php site was working fine. And now basic project consists of thousands files. Sorry for overemotions)
@celebritydev1
@celebritydev1 4 года назад
Thanks for clearing some concepts. Components help to not having to repeat yourself over again. The DRY concept.
@martinh4982
@martinh4982 4 года назад
Components are great for making complex reusable features, like profile cards and so on. I'm less convinced about taking it down to tag level components. I've seen people turn h1's, td's, tr's etc. into components. The main reason they do this is because they're using Tailwind and want to avoid copying large blocks of tw class names all over the place - which would be a real maintenance nightmare. I think in those cases you might be better off using plain old CSS or even Tailwind's apply functionality. Designing reusable components can also be very tricky. Sometimes you're far better off just using HTML until you reach the point of repeating yourself and it clicks "hey, I should turn this into a component!". So I guess my take on this is to use components where it makes sense to use them.
@shoemoney
@shoemoney 4 года назад
Have you seen jetstreams components? h1 h2 h3 h4 and even borders and horizontal dividers....
@martinh4982
@martinh4982 4 года назад
@@shoemoney Oh dear. Fortunately I've been avoiding Jetstream (and probably will never adopt it) because it reminds me too much of when ASP.Net got ajax extensions in the mid 2000s. It was very nasty indeed.
@shoemoney
@shoemoney 4 года назад
@@martinh4982 lol... well you don't have to use them... but ya...
@AlfredoElizondoLife
@AlfredoElizondoLife 4 года назад
Nos the next step is to know when to make:component, when to livewire and when to just use simple ones like the ones described here, btw liked that you usted that componentize word.
@JohnSmith-zl8rz
@JohnSmith-zl8rz 3 года назад
I like Blade Components, actually for now I avoid Vue or React on Laravel.
@jihadabdulrazaq338
@jihadabdulrazaq338 2 года назад
I just started using laravel breeze and I agree with you, using components for atoms (inputs, selects, buttons...etc) and using traditional includes, yield and extends could be better for sections.
@shoemoney
@shoemoney 4 года назад
Sounds like Taylor is getting a God complex. Honestly I also do not like forced to learn tailwind when I am already pretty overwhelmed. Eventually someone will fork it. Just like what happened with b2 then matt forked it into wordpress.
@shamarkellman
@shamarkellman 4 года назад
But you aren't force to use tailwind. The whole argument is dumb if you don't want to use tailwind then scaffold the Laravel app without jetstream and add bootstrap. It's really not that difficult to understand. Y'all just lazy.
@shoemoney
@shoemoney 4 года назад
@@shamarkellman Ok I gotta be honest... The more I use tailwind ..... well its growing on me.
@sunwavesonmars7588
@sunwavesonmars7588 4 года назад
i like this kind of style of working , makes it easier once you understand it
@Sdirimohamedsalah
@Sdirimohamedsalah 5 месяцев назад
I have the same opinion, GEST is not a component it's A LAYOUT, it's not readable, hard to figure out, a time consuming, NOT always DRY sometimes you find yourself in blocked situation. A button is a component yes! I believe that all wrappers or any portions that have a logic should not be used as components here include is pretty cool solution.
@themathittiahcompany5263
@themathittiahcompany5263 3 года назад
Thanks. This is quite informative. However ,a video on the routing rules for jetstream will be appreciated
@carlosvargas3507
@carlosvargas3507 4 года назад
You helped me understand laravel better.
@msdeav
@msdeav 2 года назад
Thank you, now I'll start to use them
@marlonferreira5081
@marlonferreira5081 4 года назад
I just release my first project using breeze. I still missing the simplicity of Laravel 7 (or before). Taylor did a good job on Breeze, but I prefer the old brade components instead. One good point of new blade components is the ability to use AlphineJS almost on-the-fly.
@marlonferreira5081
@marlonferreira5081 4 года назад
Also, check out tailwind components on web. Everything is compatible, so you don’t spend a lot of time building everything. Tailwind community is growing!
@everdaniel
@everdaniel 4 года назад
in previous Laravel versions you could use ViewComposers which works pretty similar, Blade Components sounds a lot like ViewComposers but as 1st class citizens now
@joshyboy152
@joshyboy152 4 года назад
Thanks for explaining the difference
@cano5063
@cano5063 3 года назад
I see from where they are coming but doesn’t this “componenting” everything and anything has drawbacks too? For example if you change one element maybe you just want to change only that element and nothing else. Or am I wrong there?
@VadimBesedin
@VadimBesedin 2 года назад
I didn't get the reason to use blade components instead of includes (except for the inputs). And includes way more simpler and clear. I think it's an interesting addition to Laravel, but totally not a replacement for includes, sections, and yields. Unless you want some extra complexity.
@sodomousprime
@sodomousprime 3 года назад
I am getting left behind too, I am still struggling to get my head around the x components. I have been using laravel since 5.2 and every version update seamed to be straight forward but the upgrade from 7 to 8 feels like more of a change in one version that all of the past changes combined over the years.
@LetTheWritersWrite
@LetTheWritersWrite 3 года назад
Think of components as blade files with mini controllers.
@fatimazahraelhichami1410
@fatimazahraelhichami1410 2 года назад
Thank you soo much for this video
@turdakhov
@turdakhov 2 года назад
So useful lesson! Thank you a lot!
@rcr786
@rcr786 3 года назад
How can we use x-dropwdown component in order tu add sub options in the main menu?
@PovilasKorop
@PovilasKorop 3 года назад
You would probably need to create your own component, cause x-nav-link and x-dropdown have different behavior.
@fatehalrabeai3110
@fatehalrabeai3110 4 года назад
Hi Mr.Povilas hope you're doing well. I was wondering if can make a video showing how to configure multiauth api using passport with laravel 8 because there's no package supports that for laravel 8.
@PovilasKorop
@PovilasKorop 4 года назад
What exactly do you call multiauth? Roles/permissions? Also, do you really need passport, why not sanctum, it's much easier.
@fatehalrabeai3110
@fatehalrabeai3110 4 года назад
@@PovilasKorop Thanks for replying. I mean configuring multi-auth providers. What I'm doing is building an api for two apps one is for user(student) and and one for teacher and each of them has his own model. each of them requires different authentication. I tried many ways but the tokens created for a user can be used in teacher routes and the opposite even after using middlebrows following all the steps of laravel passport documentaion.
@PovilasKorop
@PovilasKorop 4 года назад
@@fatehalrabeai3110 I see. Sorry I haven't used multiple guards for auth in Laravel passport so can't help.
@JamesAutoDude
@JamesAutoDude Год назад
The one thing that sucks is when you add on something like livewire... You then need a $slot and that's with components :/
@edino1981
@edino1981 3 года назад
Are there any ready to use laravel components, something like vuetify but using laravel and livewire
@LaravelDaily
@LaravelDaily 3 года назад
My own recently launched project: livewirekit.com Also there's Blade UI Kit: blade-ui-kit.com/
@nikulnayi3271
@nikulnayi3271 3 года назад
want to use blade com[ponent x-dropdown but dont know the syntext
@jaspercaelan4998
@jaspercaelan4998 2 года назад
Web developers just love creating solutions to problems that don't exist. People will look back at this stuff in 10 years like we look back at spacer gifs in the early 2000's and cringe.
@Defaulttt
@Defaulttt 3 года назад
Can I still use html components?
@jonathantyar5879
@jonathantyar5879 4 года назад
Everyday we stray further from php and here comes the javascript
@shoemoney
@shoemoney 4 года назад
I agree... php has a lot of great libraries that are asynchronous as is.
@johnneijzen
@johnneijzen 3 года назад
Now see this video I think will use components but before I was not because I was more used to copy and paste code directly and able see what code does and how it structured in way but I still feel x-layout was bad idea in some cases like let say you want to run one extra js file for one specific page it gonna be bit hard
@CarlosMafla
@CarlosMafla 2 года назад
Not really a big a fan of the new blade components I feel new and old Laravel users will get lost with all this new syntax, now developers need to know this first to be able to create a simple page in the framework. A component for a simple button seems overkill to me, all this just for not repeating a css class name?
@ammarmustufa7301
@ammarmustufa7301 4 года назад
hey sir can u plz create a multi authentication through laravel breeze/ui
@PovilasKorop
@PovilasKorop 4 года назад
What do you mean by multi authentication? You mean roles and permissions? I see a lot of people mixing those two things. They are trying to use multi-auth drivers, instead of using the same "users" table and adding Roles/Permissions to it. Watch this video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Uq-eEOhVCmw.html
@aminedaimallah310
@aminedaimallah310 4 года назад
nice video, i have a question please, is it okay if i did this __invoke(Request $request = null) i mean is it okay to make request nullable ?
@PovilasKorop
@PovilasKorop 4 года назад
I don't see when it would be nullable, if there's a page loaded then there's always a request, no?
@aminedaimallah310
@aminedaimallah310 4 года назад
@@PovilasKorop yeah I agree with you, but let me tell you what is the case, actually, I created an invoke function that read XML file and saves the necessary data in DB, and this should happen every day, so I have to create a command line and a schedule, but after that, I had to create same function to import XML file because there is a case for that, so instead of creating new one I decided to use that previews invoke function which doesn't expect any request before, so I had to add request as a param and that cost me an error in the command line so what I did was adding request like this _invoke(Request $request=null)
@aminedaimallah310
@aminedaimallah310 4 года назад
this is handle function inside command line: public function handle() { $controller = new ImportMoviesController(); $controller->__invoke(); } and this is the function inside the controller: public function __invoke(Request $request = null){ if ($request->file){ //import this file }else{ //find the existed file in storage and import it } }
@PovilasKorop
@PovilasKorop 4 года назад
@@aminedaimallah310 creating a new controller object inside of other method and calling invoke? It's some kind of very weird code, I would never use a controller like this. Controllers are assigned only in routes, they should not be created dynamically like this.
@aminedaimallah310
@aminedaimallah310 4 года назад
@@PovilasKorop I think I didn't explain well basically, this is a command class:
@bw7868
@bw7868 2 года назад
But everyone should use them wisely. Don't make components for everything and make nested components then put them inside loops. Yes, from software design perspective you're doing great job by making your reusable blocks and don't copy paste the same code everywhere. But on the other side you'll notice a massive drop in your app performance, because of how blade render those components. Use @include whenever possible and make components your last option.
@shoemoney
@shoemoney 4 года назад
YOU make videos every day helping people. FOR FREE. And the reason its badly needed is cause their docs SUCK. That sucks he talks to you like that. Sorry this pisses me off.
@PovilasKorop
@PovilasKorop 4 года назад
Well, Taylor also works for free when making things like Jetstream or Breeze. And their docs are good actually. It's just a disagreement on what tech stack to use under the hood and why.
@shoemoney
@shoemoney 4 года назад
@@PovilasKorop Respectfully I disagree. Wordpress is 100% free with an option for some professional services but ALL the main code is free... And Matt is worth hundreds of millions of dollars. Point being build an application that people use and the money will come. Every saas app I have ever built was free. I made money from conferences, 3rd party services... etc... The price of free =). Now YOU are making videos to help him make money. Sure you will pickup some but without your tools, videos even if you charge for them its making me more entrenched in the Laravel ecosystem. Make sense?
@arpd16
@arpd16 2 года назад
This mean I can use both methods interchangably and create and even more hated legacy code.
@theekingyodah1431
@theekingyodah1431 3 года назад
livewire components seems to be much easier to understand and work with , this needs a whole new uncerstanding
@gurulabss
@gurulabss 4 года назад
I think everything nowadays is just a gimmick. I’m soon moving beyond laravel. May be back to Rails
@shoemoney
@shoemoney 4 года назад
They have what envoy, envoyer, etc etc vapor is a pile of crap and thats a shame. Good idea.... horrible execution and support. They are spread way to thing trying to do way to much. Loosing focus of making a good core product. its so bloated there is a TON of stuff that has next to no docs.
@atiquechowdhury8910
@atiquechowdhury8910 4 года назад
Agreed. I am thinking about learning python and Django. I agree that laravel is going forward way too fast without any reason to.
@alexhizjimenez260
@alexhizjimenez260 3 года назад
SELECT PLIS!!!!
@robiparvez
@robiparvez 4 года назад
messed up
@v0nd3rB0y
@v0nd3rB0y 3 года назад
Laravel was supposed to be a nice framework with clear code... it changes - for the worse
@BalwantSingh-bb3ul
@BalwantSingh-bb3ul 3 года назад
dificult to understand ! i think it's not good for jr. laravel developer
@PovilasKorop
@PovilasKorop 3 года назад
Then surely don't use Blade components, it's totally optional.
@joseleonrs9817
@joseleonrs9817 2 года назад
In spanish please 🙏🙏
Далее
Creating Laravel Blade Component: Step-By-Step
7:39
Просмотров 29 тыс.
Каха понты
00:40
Просмотров 336 тыс.
Google Drive hates developers now
23:56
Просмотров 88 тыс.
So I've tried 3 popular Laravel CMSs...
17:53
Просмотров 8 тыс.
Laravel Migrations: 12 Useful Tips in 12 Minutes
12:06
Become a PRO at Using Components in Laravel
32:51
Просмотров 38 тыс.
Unstyled Component Libraries Are A Game Changer
12:07
Просмотров 278 тыс.
Laravel Basics - Components - Complete Explanation
32:23
Using Laravel Blade Components for Page Titles
10:20