"Built with Laravel" Code Review: Routes and Controllers

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

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

  • @wevertonlotosport
    @wevertonlotosport Месяц назад +5

    really like this code reviews!

  • @TalesGrechi
    @TalesGrechi Месяц назад +1

    These code reviews are really great!

  • @handyman911us
    @handyman911us Месяц назад +1

    Out of 2.6K views, only 145 of us could rate this ? Jeshhhhhhh.

  • @shahsawoodshinwari
    @shahsawoodshinwari Месяц назад +1

    Personally, I prefer to use resources instead of single get or post route because you easily extend routes in future with minimal work around.

  • @AhsanKhan89
    @AhsanKhan89 Месяц назад +1

    Please create a video about Manticore Search, is it better than Melisearch and elasticsearch? Should we use this in our projects? Thanks

    • @LaravelDaily
      @LaravelDaily  Месяц назад

      Haven't tried it. I personally use Algolia.

  • @virinom
    @virinom Месяц назад

    There is a simpler way to route by slug. With this way no need to add any method inside model class, and it works just file like ID based route-model binding.
    Route::get('services/{services:slug}', [\App\Http\Controllers\Frontend\ServiceController::class, 'show');

    • @LaravelDaily
      @LaravelDaily  Месяц назад +1

      Yes if you're querying it ONLY in routes. Model key allows you to call Model::find($slug) from anywhere

  • @handyman911us
    @handyman911us Месяц назад

    Would it be advisable to group the routes using the same middleware ? And then within that group, create another group for the controller ?

    • @LaravelDaily
      @LaravelDaily  Месяц назад +2

      Yes that's another option. It's your personal preference, generally.

  • @hodapro3394
    @hodapro3394 Месяц назад +2

    I used to use laravel to build my apps but one of my friends told me it is stupid thing to choose laravel nowadays is he wrong or right ? I am confused ? I like laravel actually but do I need to go to learn another stack ?

    • @LaravelDaily
      @LaravelDaily  Месяц назад +1

      It's a personal preference depending on which projects you work on

    • @hodapro3394
      @hodapro3394 Месяц назад

      @@LaravelDaily if its eucational site videos courses exams questions and answers ?

    • @LaravelDaily
      @LaravelDaily  Месяц назад +2

      Personally I'm a fan of Laravel and recommend it to anyone but it depends on your preference, again.
      It's like choosing which car to drive or which phone to buy.

    • @hodapro3394
      @hodapro3394 Месяц назад +1

      @@LaravelDaily thank you

    • @handyman911us
      @handyman911us Месяц назад +2

      Depends on the friend's reasoning. It is a fantastic platform to create an app from, there are some fantastic resources for learning Laravel, it has 3 different solutions for having Users log into the App, from very simple to very comprehensive.. It may be overkill for some websites, but jesh is it a fantastic platform to create a meaningful Website.
      Butttt, it may not be the best choice for some Websites/Apps. All depends on what you need and want to do. There are some mighty big companies that use Laravel, which may lead some people to think that it is not a stupid thing to learn. :-)

  • @bumblebity2902
    @bumblebity2902 Месяц назад +1

    Very juniorish code.

    • @ahmadkhaled7497
      @ahmadkhaled7497 Месяц назад +4

      It's a simple project, no need to make things complicated.

    • @bumblebity2902
      @bumblebity2902 Месяц назад +1

      @@ahmadkhaled7497 Go to do this approach when you applying for the company. I bet you get rejected. Also serious single responsibility principle violation. Controller should never ever contain private method

    • @LaravelDaily
      @LaravelDaily  Месяц назад +3

      Your statement is not flexible, please stop blaming culture. Counterargument to your situation: if you're already working at a company and your task is to quickly launch this project and you deliver in 2 hours instead of 8 hours with all design patterns, you may get PROMOTED.
      It all DEPENDS.

    • @bumblebity2902
      @bumblebity2902 Месяц назад +1

      @@LaravelDaily I have several coding tasks for companies where code works fine. But I was rejected for doing something like this. But with tight deadline it's approvable with room to improve.

    • @l.b76
      @l.b76 Месяц назад

      @@bumblebity2902 "Controller should never ever contain private method". Why not?