Follow & Unfollow | Laravel 10 Tutorial #28

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

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

  • @javajoint
    @javajoint 11 месяцев назад +5

    quick note for when you want to zoom in on something on your Mac: enable the assist where you can control - mousewheel to zoom in / out (not just for TablePlus, but the whole screen)

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

      Thanks for sharing that Daniel. Just tried it and it works like a charm, wish I known about it sooner.

  • @mrx7mrx
    @mrx7mrx 11 месяцев назад +2

    Thanks for the lessons. Few suggestions:
    1. For the unfollow route more common to use a DELETE method
    2. For the User->follows method instead of using a query builder we can just use "return $this->followings->contains($user);"
    And of course, it's better to use a Redis for those methods but I think it's not for beginners :)
    thanks again for your job

  • @isaiahsemeton7473
    @isaiahsemeton7473 11 месяцев назад +2

    you are really good in teaching. Keep it up sir

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

      Thank you for watching.

  • @MdSohelRana-wj8yr
    @MdSohelRana-wj8yr Год назад +1

    Outstanding..! man. Take love and live long by the grace of Almighty...!

    • @yelocode
      @yelocode  Год назад

      Thanks for watching.

  • @kouzokiodin3623
    @kouzokiodin3623 5 месяцев назад +1

    Great Content

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

    Is there a way to actually get rid of the red line errors which arent an actual errors ? since laravel does not detect the "followings()" method

  • @mohammadyassen2750
    @mohammadyassen2750 Год назад +1

    you are a legend!

  • @ismaail
    @ismaail Год назад +2

    Thanks.
    Don't you think that the Follow/Unfollow button could be better if done with Livewire ?

    • @yelocode
      @yelocode  Год назад +5

      I agree, makes more sense to use livewire on a real world application. I'm assuming viewers of this series are not familiar with livewire. But you gave me a great idea, I might redo these at the end of the course using livewire.
      Thank you for watching

    • @lucascavalheri7217
      @lucascavalheri7217 Год назад +1

      @@yelocode Damn, if you make this application in Livewire I would love it.

  • @nukeman4
    @nukeman4 Год назад +1

    Bro, you helped me so much. I have question, is there easy way to implement microsoft oauth sign in in laravel?

    • @yelocode
      @yelocode  Год назад +1

      I personally have never implemented microsoft oauth, For google and facebook Laravel Socialite is super easy and I used it multiple times but does not support microsoft.
      Microsoft seems to have a tutorial on this learn.microsoft.com/en-us/graph/tutorials/php?tutorial-step=4&tabs=aad if you haven't checked it out already.

  • @HamadAbdulla_7
    @HamadAbdulla_7 Год назад +3

    Thanks Boss

    • @yelocode
      @yelocode  Год назад

      Thanks for the support

  • @ousssika5359
    @ousssika5359 Год назад +1

    thanks for your hellp man

  • @skia515
    @skia515 Год назад +1

    thanks man

    • @yelocode
      @yelocode  Год назад +1

      Thank you for watching bro

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

    Hello Bro
    I got error in this section
    Error
    PHP 8.3.1
    Call to a member function attach() on false
    public function follow(User $user)
    {
    $follower = auth()->user();
    $follower->followings()->attach($user);
    return redirect()->route('users.show',$user->id)-with('success',"followed succesfully!");
    }
    Can you help with that please?

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

      Looks like an issue with your relationship definition,
      make sure you have the relationship defined on your User model.
      public function followings()
      {
      return $this->belongsToMany(User::class, 'follower_user', 'follower_id', 'user_id')->withTimestamps();
      }

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

      @yelocode thank you i fixed it now

  • @darshanbhandary
    @darshanbhandary 10 месяцев назад +1

    hello there's a small issue to be resolved in your user model
    your function defination rises a expection stating call to undefined method Illuminate\Database\Eloquent\Relations\BelongsToMany::exits()
    if your are using the below code which i have commented out below so to solve it you can use other intruction it works fine
    public function follows( User $user){
    // return $this->following()->where('user_id', $user->id)->exists();
    return $this->following()->where('follower_id', $this->id)->where('user_id', $user->id)->exists();
    }
    thank you