Laravel 6 Advanced - e5 - Macros

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024

Комментарии • 74

  • @Vinothvipin
    @Vinothvipin 5 лет назад +11

    Thanks for nice tutorial ... I have doubt, why we need to use macros ? Simply create helper functions file under the app directory then load it by composer.json. kindly explain about this .. thanks again..

    • @CodersTape
      @CodersTape  5 лет назад +27

      For most cases, they both would technically do the same thing. There are several disadvantages to importing an external functions file.
      First of, Laravel has deprecated helpers functions in a move to keeping everything in classes. Here's a post outlining this move laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers the thought behind that is to avoid duplication. And what that means is that functions can not be namespaced the way classes are, so let's say you add a helper function file to your project with a function by the name of happy_string() and then require a composer package that also declares a function by the name of happy_string(). That package function now conflicts with yours and will yield unexpected results.
      The second advantage you get with a macro is the fact that is integrates with the existing Laravel classes, for example, every Eloquent query returns a Collection object with the results. You can add macros to the Collection class and now those custom functions would be available to you just as if it had shipped with Laravel.
      Hope that sheds some light.

    • @Vinothvipin
      @Vinothvipin 5 лет назад +2

      @@CodersTape Many thanks ..now I have clear view ... Keep rock ..we are looking more interesting videos

    • @natnaelzenebe9269
      @natnaelzenebe9269 3 года назад +5

      @@CodersTape i read it like you are speaking it.. heeh

  • @walidbagh
    @walidbagh 5 лет назад +19

    I'll go ahead and leave a like before even watching cause i knw it's gonna be GOLD

  • @orangecode1902
    @orangecode1902 5 лет назад

    first time i watch a video on youtube that has no dislikes that means this great instructor going to take place of traversy media

  • @chunito
    @chunito 4 года назад

    I couldn't get enough of the macros after watching this.

  • @ericapalosaari1553
    @ericapalosaari1553 5 лет назад +3

    Awesome videos man! I'm glad I found your channel, I'm learning new stuff that I know I will use in the future. Your video about the view composers helped a lot and together with this, I can make things so much easier than before :D Pure gold! Subscribed + bell!

  • @JigneshJoisar
    @JigneshJoisar 5 лет назад +5

    Good job brother.
    Can u make a video in lazy colletion vs collection.

  • @AhmedMohammed-ks8uo
    @AhmedMohammed-ks8uo 2 года назад

    Thank you l love it .

  • @KingsleyUdenewu
    @KingsleyUdenewu 3 года назад

    Very nice tutorial please when will Laravel 7 or 8 advance tutorial be available. Thank you

  • @Zach2825
    @Zach2825 5 лет назад +2

    Thanks for the video! Keep up the great work!

  • @stalerideas
    @stalerideas 5 лет назад +1

    Good job my friend, i'm learning so so much with this lessons. Thanks a lot!!!

  • @Vball2718
    @Vball2718 4 года назад

    The trait is actually super simple but also super useful. I'm sure laravel didn't invent this but makes me even more sure that laravel will be the next thing I want to learn.

  • @CODINGISEASY
    @CODINGISEASY 5 лет назад +1

    *There doesnt look to be too many new features in 𝐋𝐀𝐑𝐀𝐕𝐄𝐋 6*

    • @CodersTape
      @CodersTape  5 лет назад +2

      Not at all. It’s a maintenance update and just a lock down of the framework structure

  • @pedropeter2717
    @pedropeter2717 5 лет назад +1

    Thanks Man.. you're awesome!

  • @i74ifa
    @i74ifa 2 года назад

    Thank you awesome explanation

  • @Zahra_CarBlogger
    @Zahra_CarBlogger 3 года назад

    Hi, Can you upload your codes to access them?

  • @omiorangsha665
    @omiorangsha665 5 лет назад +1

    please make a accounting web site for example & live practice

    • @primoashbee
      @primoashbee 5 лет назад

      Hey bro if u got tuts please share

  • @haroldpepete
    @haroldpepete 4 года назад

    Excellent, something laravell documentation is not exact you make it more clear and fast to understand, learning with code is the best option, i feel laravel how Ruby On Rails brother, it has a lot of thing as ROR

  • @quirkymarshmallow9324
    @quirkymarshmallow9324 4 года назад

    Incredible feature

  • @edforrest9826
    @edforrest9826 5 лет назад

    Another top video. I am so hungry for each of the videos in this series. I learn so much in each. I can't wait for the next one. I only discovered you in this series. Can't wait to go through the backlog.

  • @СергейГолубев-л5п
    @СергейГолубев-л5п 5 лет назад

    Man, can you please announce the list of topics which we can expect being explained from you during this course? Just to wonder how far are you going to push things.

  • @micortes89
    @micortes89 4 года назад

    That boot method inside the AppServiceProvider looks like a dumpster to me

  • @dailybizarrethings5380
    @dailybizarrethings5380 5 лет назад +1

    I'm just a simple web developer. My phone notified me for new Coder's Tape video. I watch it.

  • @JackbearAmine
    @JackbearAmine 5 лет назад +1

    Welcome back

  • @alexwhb122
    @alexwhb122 4 года назад

    this is awesome! Thanks for your super clear tutorials. Keep up the good work man.

  • @1mr4n4li
    @1mr4n4li 5 лет назад +3

    new thing to me

  • @yasminehikal
    @yasminehikal 4 года назад

    thanks alot for tutorial ... it is the best playlist i have ever watch .

  • @KevalSavani
    @KevalSavani 5 лет назад

    I really love your teaching methods and your knowledge, thanks mate :)

  • @orangecode1902
    @orangecode1902 5 лет назад +1

    Make:auth not defined in laravel 6? plzz help me sir

    • @CodersTape
      @CodersTape  5 лет назад

      laravel-news.com/running-make-auth-in-laravel-6

    • @orangecode1902
      @orangecode1902 5 лет назад

      @@CodersTape Thankyou so much sir it's work

  • @creative-commons-videos
    @creative-commons-videos 5 лет назад

    hello sir, please help me understand is there any difference between injecting service directly to function and to constructor, like
    class UserController extends BaseController {
    public $userRepository;
    public function __constructor(UserRepository $userRepository){
    $this->userRepository = $userRepository;
    }
    public function getUsers(UserRepository $userRepository){
    // 1
    $this->userRepository->getAll();
    // 2
    $userRepository->getAll();
    }
    }

    • @CodersTape
      @CodersTape  5 лет назад +1

      Technically they will both work but you’re going to have to inject it into every single method in your controller. That creates unnecessary repetition. And lastly, because you don’t global access to it, if you needed a helper function, you would need to pass it the repository. All and all, you lose a lot by doing it in every single method. I would stick to the construct.

    • @creative-commons-videos
      @creative-commons-videos 5 лет назад +1

      @@CodersTape thanks a lot, but one more doubt, let say i have 5 methods and each method has its own repository requirement, now if i initiate that 5 repositories into constructor,
      and try to call any specific method, will it try to load all repository into constructor as soon as class initialised ??

    • @CodersTape
      @CodersTape  5 лет назад +1

      Initially I misunderstood your question. To answer it, all of them can be injected in the constructor and the instantiation cost would be extremely minimal. I wouldn’t worry about that. Remember that it doesn’t perform any queries unless you actually us it.

    • @creative-commons-videos
      @creative-commons-videos 5 лет назад

      @@CodersTape Great, Thanks, Also Joined coderstape.com

  • @ibernohoffmann5427
    @ibernohoffmann5427 5 лет назад

    I knew it! Thanks Man.. you're really awesome!

  • @mooodddy1
    @mooodddy1 5 лет назад

    #Coder's Tape , Please Explain mircoservices with Laravel

    • @CodersTape
      @CodersTape  5 лет назад +1

      As an extraction?

    • @mooodddy1
      @mooodddy1 5 лет назад

      @@CodersTape yes, and laravel modulartiy

  • @ashishnimrot9221
    @ashishnimrot9221 5 лет назад +1

    In one world sir, You are awesome

  • @ChathuraDasanayaka
    @ChathuraDasanayaka 5 лет назад

    Please do a video on service providers

  • @T.berragragui
    @T.berragragui 4 года назад

    It's more than clear thanks a lot

  • @milantarami
    @milantarami 5 лет назад

    great! wanted more from you

  • @jonathanhavens8438
    @jonathanhavens8438 4 года назад

    Question that came to mind when you reached the __callStatic method in the video...forgive me if someone already asked..I read about 30 comments and didnt see it yet..
    What happens if multiple __callStatic methods exist on a class thats using a couple traits that have a __callStatic method? Im pretty sure that if the class has its own __callStatic, this will be called first and...overwrite the others?...Or not overwrite, just come first in a sequence of __callStatic calls? Not sure how to reason about it all. I do know that Laravel uses these magic methods a lot though, so I'm assuming whatever the answer is here...it can be applied to all magic method calls? (or i could be wrong again)
    Thanks for the great videos buddy.

    • @CodersTape
      @CodersTape  4 года назад

      You’re correct. They will get overwritten by the class static and ignore all traits.

    • @jonathanhavens8438
      @jonathanhavens8438 4 года назад

      @@CodersTape Ok, so what if theres two traits on a class that both have a __callStatic (and no callStatic on the class itself)?
      How would this play out?

  • @lucagambetta5842
    @lucagambetta5842 5 лет назад

    You are opening my eyes on Laravel: I used not to love it too much, being forced to use it, but your videos are so great they made me want to develop like a crazy using it! :D

    • @CodersTape
      @CodersTape  5 лет назад +1

      Glad to hear! Good job sticking with it.

    • @CodersTape
      @CodersTape  5 лет назад

      Glad to hear! Good job sticking with it.

  • @adam192021
    @adam192021 5 лет назад

    The BEST as always!

  • @lordgodgiven
    @lordgodgiven 5 лет назад

    Hello, master wizard of laravel,
    Thank you very much for your excellent tutorials, I have a question, it's about real-time notifications, so that as soon as there is an event that occurs in the application such as registering a new user, that the administrator who is connected receives a real-time notification without refreshing his page, much like those of youtube, how to set up such a system (the application is installed on a server that does not have Internet access).
    Thank you.

    • @CodersTape
      @CodersTape  5 лет назад +1

      Without internet you wouldn’t be able to send out the notification. You can use Laravel Echo, we have not covered it yet but we will.

    • @lordgodgiven
      @lordgodgiven 5 лет назад

      @@CodersTape But what about laravel sockets?

    • @CodersTape
      @CodersTape  5 лет назад

      Dieudonné NIEME sockets will still require internet connection

    • @lordgodgiven
      @lordgodgiven 5 лет назад

      @@CodersTape Try to have a look on this docs.beyondco.de/laravel-websockets/

    • @lordgodgiven
      @lordgodgiven 5 лет назад

      @@CodersTape Try to have a look on this docs.beyondco.de/laravel-websockets/

  • @rfpdl
    @rfpdl 5 лет назад

    Boom!

    • @CodersTape
      @CodersTape  5 лет назад

      I should put that on a tshirt or mug

    • @rfpdl
      @rfpdl 5 лет назад

      @@CodersTape Definitely :))

  • @omiorangsha665
    @omiorangsha665 5 лет назад +2

    very helpfull, thank you sir.

  • @mokhosh
    @mokhosh 5 лет назад

    8:26 how is your error page so pretty?

    • @CodersTape
      @CodersTape  5 лет назад +1

      Laravel 6

    • @mokhosh
      @mokhosh 5 лет назад

      @@CodersTape that's what I guessed and I upgraded the project i'm currently working on but i didn't get the pretty error page so i asked. maybe i should create a new project.

    • @strikerdon3139
      @strikerdon3139 5 лет назад +1

      composer require facade/ignition

  • @julianmartin5538
    @julianmartin5538 4 года назад

    Great video! Do you have any suggestions on how to to get autocomplete to work with macros?
    For Models and Facades I use github.com/barryvdh/laravel-ide-helper