Creating comments (relationships) | Laravel 10 Tutorial #18

Поделиться
HTML-код
  • Опубликовано: 21 июл 2023
  • Laravel 10 one to many relationship tutorial
    On this episode we cover how to create comments and learn about how laravel handles relationships.
    Documentation mentioned in the video :
    laravel.com/docs/10.x/control...
    Playlist of Laravel 10 Tutorial Course :
    • Laravel 10 Beginners C...
    What is Laravel :
    Laravel is a free and open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model-view-controller architectural pattern and based on Symfony.
    en.wikipedia.org/wiki/Laravel
    If you have any questions or problems please leave a comment.
    Laravel Blade
    Laravel crash course
    Laravel Database and crud tutorial
    Laravel crud tutorial
    Laravel relationships

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

  • @kouzokiodin3623
    @kouzokiodin3623 20 дней назад

    Thank you so much teacher

  • @LoneTaha
    @LoneTaha 3 месяца назад

    perfect

  • @dawghouse1111
    @dawghouse1111 9 месяцев назад +1

    Question about the controller function store parameter (tutorial 10 near video time frame 10:08). The "Idea" $idea (not $idea)parameter, is that the model name if not where is it coming from and do you need it. I been following your vides to learn Laravel 10 and I was little confused about the need for the "Idea" parameter. I tried running the function ($idea) like and it seems to work so what is the purpose to "Idea" parameter?

    • @yelocode
      @yelocode  9 месяцев назад +1

      Thanks for watching.
      Your are correct, that is the model class type Those are called type hints in PHP, you are basically telling php what type of class this function accepts. In php these are optional so your code will still work without it in this case.
      In has at least 2 main benefits in this case:
      1 - it helps your IDE or code editor know what the $idea type is, so you can get auto suggestions.
      2 - It also lets laravel know, what model should be used for route model binding if you use a different name than idea in your route web.php file.

  • @siavash100200
    @siavash100200 7 месяцев назад +1

    I did exactly what you learned and idea show and edit page working but when I go back to dashboard ( home page ) it can't load comments and get something like this error " $idea->comments or $idea->id are undefined variables"

    • @yelocode
      @yelocode  7 месяцев назад +2

      Thanks for watching.
      Are you using a different variable name than $idea in your project? I would check "dashboard.blade.php" as well as "idea-card.blade.php" to see if you are using the variable name $idea or something else.
      The entire code for this episode is also on github, you can compare your code with it to see what may be the issue.
      github.com/yelocode/ideas/tree/2bfd88f556c8582fe4afbc745ac6b70789856c48

  • @SiFu_Max
    @SiFu_Max 6 месяцев назад

    How I can display the Name of the User who commented?

  • @user-ib8dh2ji5s
    @user-ib8dh2ji5s 3 месяца назад

    good day! where ever you are. Just a question, what does the ($idea) that you always use on codes like $idea->comments, etc. represent? Is it a variable for the model? If so, where can I find it?

    • @Traveler-Tan
      @Traveler-Tan 2 месяца назад

      not completely sure but i think it's from the foreach at the very beginning of dashboard.blade.php where we render all ideas, since its @include('shared.idea-card'), the idea-card has access to $idea while comments-box is included on the idea-card so comment-box has access to it too, this might be wrong but that's how how i understood it

    • @user-ib8dh2ji5s
      @user-ib8dh2ji5s 2 месяца назад

      @@Traveler-Tan woah tnx for the clarification

  • @potatosmile_s_v
    @potatosmile_s_v 8 месяцев назад +1

    is it possible to access your code, I need to see some sort of code pls, Thanksss

    • @yelocode
      @yelocode  8 месяцев назад

      Thanks for watching,
      Can find the code here : github.com/yelocode/ideas/commit/2bfd88f556c8582fe4afbc745ac6b70789856c48

  • @Kai-xc7qu
    @Kai-xc7qu 3 месяца назад +5

    Russia

    • @black_river102
      @black_river102 2 месяца назад

      MЫ, РУССКИЕ, НЕ ОБМАНЫВАЕМ ДХУГ-ДХУГА

    • @Kai-xc7qu
      @Kai-xc7qu 2 месяца назад

      @@black_river102 не бро, неважно какая нация все друг друга обманывают

    • @black_river102
      @black_river102 2 месяца назад

      @@Kai-xc7qu да это цитата из Брата 2, спокуха