JGonsuron

Member Since 5 Months Ago

NEW IBERIA

Experience Points
7,440
Total
Experience

2,560 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
69
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 2
7,440 XP
Feb
09
2 months ago
Activity icon

Replied to Passing Data To A Modal

Happy to let you know that it is now working! I had forgotten to declare the $selectedUser variable in the controller, so it was a pretty stupid oversight on my part. Thanks again for taking the time to help me with this.

Feb
08
2 months ago
Activity icon

Replied to Passing Data To A Modal

I tried this solution. Still doesn't work. I am just going to ditch Livewire and implement another solution. As much as I wanted a modal for this feature, I just don't think it is possible using Livewire. I do appreciate your help.

Feb
06
2 months ago
Activity icon

Replied to Passing Data To A Modal

When I do this:

<x-slot name="title">
            {{ $selectedUser->name ?? ''}}
        </x-slot>

The modal doesn't pop up.

Activity icon

Replied to Passing Data To A Modal

I did it exactly as you outlined. Now the modal doesn't even pop up. Edit: I didn't change the blade directive.

<x-slot name="title">
            {{ $selectedUser->name }}
        </x-slot>

When I do it like this, I get this:

ErrorException
Trying to get property 'name' of non-object (View: C:\Users\User\Code\realtor\resources\views\livewire\users.blade.php)
http://127.0.0.1:8000/dashboard
Activity icon

Replied to Passing Data To A Modal

Here is the Component Blade

<div>
    <h3 class="font-bold text-xl mb-4">Active Users</h3>

    <ul>
        @foreach ($users as $user)
            @if ($user->role === "agent")
                <li class="mb-4">
                    <div class="flex items-center text-sm">
                        <img src="{{ $user->profile_photo_url }}" alt="{{ $user->name }}'s Profile picture" class="rounded-full h-10 w-10 object-cover mr-2">

                        <div wire:click="showModal" :users="$user" :key="$user" class="cursor-pointer">
                            {{ $user->name }} 
                        </div>
                        
                    </div>
                </li>
            @endif
        @endforeach
    </ul>

    <x-jet-dialog-modal wire:model="modalFormVisable">
        <x-slot name="title">
            {{ $selectedUser->name ?? '' }}
        </x-slot>

        <x-slot name="content">
            
            <div class="mt-4">
                <img src="{{ $user->profile_photo_url }}" alt="{{ $user->name }}'s Profile picture" class="rounded-full h-10 w-10 object-cover mr-2">  
            </div>
                        
            
        </x-slot>

            <x-slot name="footer">
                <x-jet-button class="ml-2" type="submit" wire:loading.attr="disabled">
                    {{ __('Follow Me') }}
                </x-jet-button>
        </x-slot>
    </x-jet-dialog-modal>
</div>

Here is the Livewire Controller

<?php

namespace App\Http\Livewire;

use App\Models\User;
use Livewire\Component;

class Users extends Component
{

    public $users;
    public $modalFormVisable = false;
    public $selectedUser;


    public function showModal(User $user) 
    {
        $this->selectedUser = $user;
        $this->modalFormVisable = true;
    }

    public function mount()
    {
        $this->users = User::where('id', '!=', auth()->id())->get();
    }

    public function render()
    {
        return view('livewire.users');
    }
}

As you can see, I added Type hinting to the showModal method. When just the $user variable is in, I get this error:

Illuminate\Contracts\Container\BindingResolutionException
Unable to resolve dependency [Parameter #0 [ <required> $user ]] in class App\Http\Livewire\Users
Feb
05
2 months ago
Activity icon

Replied to Passing Data To A Modal

The modal comes up without the error, but the name doesn't come in. Sorry, I have been trying for several weeks to make this work. I usually give up for a few days and work on another feature, but I am being held up at this point by this issue.

Activity icon

Replied to Passing Data To A Modal

Thanks for the reply. I tried this out and then got the Trying to get property 'name' of non-object error. I looked at a few examples on StackOverflow and tried a few solutions with no success.

Activity icon

Started a new Conversation Passing Data To A Modal

I am working on a project where in the right column a list of current users is lopped through and displayed. When the User's name is clicked, a modal is triggered and pops up so the current user can follow that person. The issue I am having is that the info displayed in the modal reflects only the last user registered in the database instead of the user clicked. How can I pass the information correctly to the modal?

Blade File

<div>
    <h3 class="font-bold text-xl mb-4">Active Users</h3>

    <ul>
        @foreach ($users as $user)
            @if ($user->role === "agent")
                <li class="mb-4">
                    <div class="flex items-center text-sm">
                        <img src="{{ $user->profile_photo_url }}" alt="{{ $user->name }}'s Profile picture" class="rounded-full h-10 w-10 object-cover mr-2">

                        <div wire:click="showModal" :users="$user" :key="$user" class="cursor-pointer">
                            {{ $user->name }} 
                        </div>
                        
                    </div>
                </li>
            @endif
        @endforeach
    </ul>

    <x-jet-dialog-modal wire:model="modalFormVisable">
        <x-slot name="title">
            {{ $user->name }}
        </x-slot>

        <x-slot name="content">
            
            <div class="mt-4">
                <img src="{{ $user->profile_photo_url }}" alt="{{ $user->name }}'s Profile picture" class="rounded-full h-10 w-10 object-cover mr-2">
                
            </div>
                        
            
        </x-slot>

            <x-slot name="footer">
                <x-jet-button class="ml-2" type="submit" wire:loading.attr="disabled">
                    {{ __('Follow Me') }}
                </x-jet-button>
        </x-slot>
    </x-jet-dialog-modal>
</div>

Livewire Controller

<?php

namespace App\Http\Livewire;

use App\Models\User;
use Livewire\Component;

class Users extends Component
{

    public $users;
    public $modalFormVisable = false;
    
    

    public function showModal() 
    {
        $this->modalFormVisable = true;
    }

    public function mount()
    {
        $this->users = User::where('id', '!=', auth()->id())->get();
    }

    public function render()
    {
        return view('livewire.users');
    }
}
Feb
04
2 months ago
Activity icon

Replied to Redirect To Intended URL Jetstream Fortify

This worked great for me. Thanks

Jan
10
3 months ago
Activity icon

Replied to Please Help With My Relationships.

I apologize. I have changed the code so much because I am trying to get past this issue that I am totally lost now.

Activity icon

Replied to Please Help With My Relationships.

I have changed the code in the controller so many times I am kinda lost now.

Activity icon

Replied to Please Help With My Relationships.

Thank you for replying.

This is my band model - band.php

<?php

namespace App\Models;

use App\Models\User;
use App\Models\slot1;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class Band extends Model
{
    use HasFactory;

    public $table = 'band';

    public $timestamps = false;

    protected $fillable = [
        'bandName',
        'bandBlurb',
        'bandDescription'
    ];

    public function users()
    {
        return $this->hasMany(User::class);
    }

    public function slot1()
    {
        return $this->hasOne(Slot1::class);
    }
}

And this in my slot1 Model - Slot1.php

<?php

namespace App\Models;

use App\Models\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class slot1 extends Model
{
    use HasFactory;

    public $table = 'bandslot1';

    public $timestamps = false;

    protected $fillable = [
        'firstSlot_Date',
        'firstSlot_BandId'
    ];

    public function User()
    {
        return $this->hasMany(User::class, 'name');
    }

    public function band()
    {
        return $this->hasOne(Band::class);
    }

}
Activity icon

Started a new Conversation Please Help With My Relationships.

I am having some trouble. I have made a backend for a website in which I am trying to make a feature where a restaurant can: A) Enter a band with a blurb and a description that will be saved into a database. B) Utilize a dropdown populated with those band names to enter a date that band (identified by the band's ID) will be playing. And that will be stored in another table. C) Update the HTML on the site to reflect those updates.

The Models I have built to represent the dates are Slot1, Slot2, and Slot3 (because there are 3 slots on the websites for bands.)

I have the functions to save the band, populate the dropdown, and save the date built and working. However, I am having alot of problems accessing the relationship between the Slot Models and the Band Model. Please help, what am I doing wrong here?

public function render(Slot1 $slot1, Band $band)
    {
        
        $slot1 = $band->with(['bandName', 'bandBlurb', 'bandDescription'])->get();

        return view('livewire.displayed-bands', [
            'date' => $slot1,
            'bandName' => $band,
            'bandBlurb' => $band,
            'bandDescription' => $band
        ]);   
    }
Nov
19
4 months ago
Activity icon

Commented on Expanding The Timeline

I can put /tweets in the URL and it works but the store() function in the tweetsController redirects the URL to /home which causes the 404.

Activity icon

Commented on Expanding The Timeline

When I moved the public function index from the homecontroller to the tweetcontroller, I started getting a 404 error. Can anyone help with this?

Nov
09
5 months ago
Activity icon

Commented on Build A Registration System In Mere Minutes

Does anyone have a solution to the login and register links disappearing at small breakpoints?