Laravel 9 & Vue 3 Blog with Sanctum authentication #22 Display posts dynamically on the homepage

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024
  • This lesson implements and explains how to display posts dynamically on the homepage in part of a series of an SPA Blog with Laravel Sanctum authentication created with Laravel 9 and Vue 3.
    Source code for this lesson: github.com/alp...
    Same project with Laravel only in one video: • Complete Laravel Blog ...
    Same project with laravel only in a playlist • Laravel 8 Blog Tutoria...
    #Laravel9 #vue3 #DisplayPosts
  • НаукаНаука

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

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

    I've followed your Laravel9 vue3 video series until 22 chapter. followed all the steps and your Github code. but getting below error when I get data through "PostResource".
    Attempt to read property "name" on null", exception: "ErrorException"
    seems to be 'user' => $this->user->name, taking null values. please help me

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

      Hey, sorry for the late reply. Were you able to fix the issue?

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

      @@alphayowakarindi I tried, but no luck.
      for catch the error I did
      dd($this->user->name); in PostResource.php
      it getting null value.
      I downloaded your github project files and copy to my environment but still it getting same null value error.
      is their something I need to enable in "Providers" section.

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

      also checked your previous series video. but couldn't find any issue in written code

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

      @@alphayowakarindi in your code I checked letter by letter but couldn't find ant mistake. Please help me to find this error.

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

      @@DissanayakeNuwan I think the issue is from your Post Model. Please check in your Post model if you have the following:
      public function user()
      {
      return $this->belongsTo(User::class);
      }
      If you have it, try to check if there is any typo.
      And by the way, do you have your project on GitHub?