dmhall0

Member Since 9 Months Ago

Experience Points
2,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
14
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 1
2,440 XP
Mar
24
2 weeks ago
Activity icon

Replied to Spatie Media Library Error - Call To A Member Function GetUrl() On String

The simple things always get me! I changed my table field, as suggested, to avatar_id.

Thank you!

Activity icon

Started a new Conversation Spatie Media Library Error - Call To A Member Function GetUrl() On String

I am trying to display the user avatar in my header. I have the latest standard Spatie Media Library package and Laravel 7. I have a avatar field in my users table that gets populated with the Media id when the avatar image is saved.

Users Model:

    public function avatar()
    {
        return $this->hasOne(Media::class, 'id', 'avatar');
    }

    public function getAvatarUrlAttribute()
    {
        return $this->avatar->getUrl('thumb');
    }

Header Blade File

<img src="{{ auth()->user()->avatarUrl }}" alt="" style="width:40px; height:40px; border-radius:50%">

Error is Error - Call to a member function getUrl() on string

I can't figure out how to fix. Thanks for the help!

Mar
18
3 weeks ago
Activity icon

Replied to Cancel Edit Button & Reload Component Error

I couldn't get that to work as it was now looking for any variable I was passing into the livewire component.

I found this solution instead...

<a href="javascript:history.go(0)"><button type="button" class="btn btn-secondary">Cancel Edit</button></a>

Not ideal as it reloads the entire page but it gets the job done for now.

Thanks for the help.

Mar
16
3 weeks ago
Activity icon

Replied to Cancel Edit Button & Reload Component Error

I managed to grab a screenshot. The error says, Unable to call component method. Public method [reset] not found on component.

Activity icon

Replied to Cancel Edit Button & Reload Component Error

It works, but it flashes an error modal on the screen so quickly I can read it, and then does a full page reload. Any other options?

Activity icon

Started a new Conversation Cancel Edit Button & Reload Component Error

I have a form in a livewire component that pulls information about a specific skill.

There is a checkbox that when clicked allows a user to edit that information.

This also shows two buttons: "Save" and "Cancel Edit".

Save works fine.

When the user clicks on "Cancel Edit" I want the livewire component to refresh the component, taking the skill information back to its original state.

I have tried <button wire:click="$refresh">Cancel Edit</button> but the changes remain.

I am sure this is something simple that I am just missing.

Thanks!

Mar
11
1 month ago
Activity icon

Replied to Target ... Is Not Instantiable While Building ...

To answer your questions:

  1. Yes, same version of php.
  2. Yes, same package version.
  3. I will give this a try.
  4. Yes, using Laravel 7.
  5. I did that yesterday before posting here and someone moved to Discussions without giving a reply. Still waiting there.
Mar
10
1 month ago
Activity icon

Started a new Conversation Target ... Is Not Instantiable While Building ...

I installed the Spatie Laravel Backup package. It works fine on my local machine but when I push to Laravel Forge / Digital Ocean I get the following error message.

Package operations: 3 installs, 0 updates, 0 removals
  - Installing spatie/temporary-directory (1.3.0): Loading from cache
  - Installing spatie/db-dumper (2.21.1): Loading from cache
  - Installing spatie/laravel-backup (6.15.0): Loading from cache
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Container.php line 1017:
                                                                               
  Target [Spatie\Backup\Tasks\Cleanup\CleanupStrategy] is not instantiable wh  
  ile building [Spatie\Backup\Commands\CleanupCommand].                        
                                                                               
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

I have tried all other solutions I could find to this problem and still no luck.

Solution Attempt 1: Remove the package: composer remove spatie/laravel-backup clear the cache and config: php artisan cache:clear php artisan config:clear install the package again: composer require spatie/laravel-backup then recache everything: php artisan optimize

Solution Attempt 2: Remove the config.php file located in bootstrap/cache

Doing each of these resulted in the same error. Any other solutions out there? Thanks for the help!

Mar
07
1 month ago
Activity icon

Replied to Trying To Get Property 'id' Of Non-object From Mount()?

I did exactly as you show and I get the, Trying to get property 'id' of non-object error on

                @foreach($skills as $skill)
                    <option value="{{ $skill->id }}">
                        {{ $skill->skill_name . (!is_null($skill->skill_number) ? ' ('. $skill->skill_number .')' : '') }}
                    </option>
                @endforeach

No clue why... Oh well, the other solution works I guess. Thank you.

Activity icon

Replied to Trying To Get Property 'id' Of Non-object From Mount()?

This did it. Man it is frustrating when the answer seems so easy! Thank you once again.

Mar
06
1 month ago
Activity icon

Replied to Trying To Get Property 'id' Of Non-object From Mount()?

I get the team_id by having @livewire('skill-trainer', ['team_id'=>$team->id]) in my blade file.

Activity icon

Started a new Conversation Trying To Get Property 'id' Of Non-object From Mount()?

I have skills that are unique to a team; and then those skills have trainers. I need to first filter the list of skills by the team, and then this dropdown updates the list of approved trainers.

Here is my component:

class SkillTrainer extends Component
{

    public $team_id;
    public $skills;
    public $selectedSkill = 'select';
    public $internalTrainers = null;

    public function mount($team_id)
    {
        //get the skills
        $this->skills = DB::table('skills')
            ->where('team_id', '=', $team_id)
            ->whereNull('skills.deleted_at')
            ->orderBy('skill_name')
            ->get();
    }

    public function render()
    {
        return view('livewire.skill-trainer');
    }

My view:

<div>
    <div class="form-group row">
        <label for="skill" class="col-md-4 col-form-label text-md-left">Skill Name (Number):</label>
        <div class="col-md-5">
            <select wire:model="selectedSkill" name="skill" class="form-control @error('skill') is-invalid @enderror">
                <option value="select">Select One...</option>
                @foreach($skills as $skill)
                    <option value="{{ $skill->id }}">
                        {{ $skill->skill_name . (!is_null($skill->skill_number) ? ' ('. $skill->skill_number .')' : '') }}
                    </option>
                @endforeach
            </select>
        </div>
    </div>

    <div class="form-group row">
        <label for="trainer_id" class="col-md-4 col-form-label text-md-left">Internal Trainer:</label>
        <div class="col-md-5">
            <select name="trainer_id" class="form-control @error('category') is-invalid @enderror">
                @if($selectedSkill == 'select')
                    <option value="">Select a Skill from the above dropdown.</option>
                @elseif(!is_null($selectedSkill) && ($internalTrainers->count() >= '1'))
                    <option value="">Select One...</option>
                    @foreach($internalTrainers as $internalTrainer)
                        <option value="{{ $internalTrainer->user_id }}">
                            {{ $internalTrainer->user_name }}
                        </option>
                    @endforeach
                @else
                    <option value="">There are no Team Members at an Advanced level of training for this skill.</option>
                @endif
            </select>
        </div>
    </div>
</div>

This works correctly for the initial load of the view, but when I select a skill I get the error Trying to get property 'id' of non-object.

I tested putting the skills query within the render but I cannot figure out how to get the $team_id passed in. Is this possible? If so, how?

If I remove the where statement for the $team_id within the render it works correctly, except that it shows every skill across all teams (which is incorrect).

public function render()
    {
        return view('livewire.skill-trainer', [

            //get the skills
            'skills' => DB::table('skills')
                // ->where('team_id', '=', $team_id)
                ->whereNull('skills.deleted_at')
                ->orderBy('skill_name')
                ->get(),

        ]);
    }

Thank you everyone. I am very knew to Livewire and I greatly appreciate the help.

Mar
05
1 month ago
Activity icon

Replied to Livewire Not Working

@deansatch

I am on Laravel 7

I ran the publish command as you recommend and now something crazy happens (a modal of my site pops up?!) when I change the dropdown, but at least I am getting a response... progress!

@snapey

Yes, workbus is for my local.

After getting a response to the dropdown change now let me check my code and I'll get back if I can't figure it out.

Thank you everyone! You all are great.

Activity icon

Replied to Livewire Not Working

Agree as well. I have moved it. I did not show the entire livewire blade file, there are div's. Thanks.

Activity icon

Replied to Livewire Not Working

Okay, looks like I have a series of errors on the console for livewire...

GET http://workbus/livewire/livewire.js?id=25f025805c3c370f7e87 net::ERR_ABORTED 404 (Not Found)

Uncaught ReferenceError: Livewire is not defined
    at new:1159
(anonymous) @ new:1159

I have the livewireScripts in my app file like instructed. Could it be in conflict with other javascript (I read that in some other places)?

Activity icon

Replied to Livewire Not Working

Sorry, missed your post when I replied.

Nothing happens on the Network tab.

How do I check to make sure livewireScripts is installed correctly?

Activity icon

Replied to Livewire Not Working

Something else to add...

When I go to the page and inspect; as I change the skill dropdown nothing is happening on the Network tab.

Activity icon

Replied to Livewire Not Working

Component is

namespace App\Http\Livewire;

use Carbon\Carbon;
use Livewire\Component;
use Illuminate\Support\Facades\DB;

class SkillTrainer extends Component
{

    public $skills;
    public $selectedSkill;
    public $internalTrainers = [];
    public $selectedTrainer;

    public function render()
    {
        return view('livewire.skill-trainer', [

            //get the skills
            'skills' => DB::table('skills')
                ->whereNull('skills.deleted_at')
                ->orderBy('skill_name')
                ->get(),

        ]);
    }

The list of skills shows up correctly in the Skill dropdown, but when I select a give skill nothing happens, even with I have {{ $selectedSkill }} just to see it change.

Activity icon

Replied to Livewire Not Working

I compared that against mine and there is no difference between the structure.

Strange...

Could it be an issue with other JS on my page?

Activity icon

Started a new Conversation Livewire Not Working

I am trying to have a dependent dropdown. The user selects the skill and then livewire pulls the list of appropriate trainers.

In my app file I have @livewireStyles and <script src="{{ asset('js/app.js') }}" ></script> in the head and @livewireScripts at the bottom of my body.

My livewire blade file:

    <div class="form-group row">
        <label for="skill" class="col-md-4 col-form-label text-md-left">Skill Name (Number):</label>
        <div class="col-md-5">
            <select wire:model="selectedSkill" name="skill" class="form-control">
                <option value="">Select One...</option>
                @foreach($skills as $skill)
                    <option value="{{ $skill->id }}">{{ $skill->skill_name  }}</option>
                @endforeach
            </select>
        </div>
    </div>

    <div class="form-group row">
        <label for="trainer_id" class="col-md-4 col-form-label text-md-left">Internal Trainer:</label>
        <div class="col-md-5">
            @if(is_null($selectedSkill))
                Select a Skill from the above dropdown.
            @elseif(!is_null($selectedSkill) && !is_null($internalTrainers))
                <select wire:model="selectedTrainer" name="trainer_id" class="form-control">
                    <option value="">Select One...</option>
                    @foreach($internalTrainers as $internalTrainer)
                        <option value="{{ $internalTrainer->user_id }}">{{ $internalTrainer->user_name }}</option>
                    @endforeach
                </select>
            @else
                There are no Team Members at an Advanced level of training for this skill.
            @endif
        </div>
    </div>

I even try getting {{ $selectedSkill }} to display on the screen and nothing happens.

Jan
11
3 months ago
Activity icon

Replied to Deployment Aborting?

Correct... first line in my deployment script on Forge. I am using BitBucket. I have been deploying for months and then literally this came out of nowhere. I didn't touch this file or its associated files at all. I appreciate your help. I have someone looking into it.

Jan
08
3 months ago
Activity icon

Replied to Deployment Aborting?

I did it local and nothing happened. Then I put `git reset --hard HEAD' in my deploy script as suggested and I got this error

Fri Jan 8 20:53:02 UTC 2021
fatal: not a git repository (or any of the parent directories): .git

along with saying there is an issue with my SSH key.

Activity icon

Replied to Deployment Aborting?

I did git reset --hard and git clean -df and then git push --force and I am still having the same issue.

Any ideas?

Jan
07
3 months ago
Activity icon

Started a new Conversation Deployment Aborting?

I am using Bitbucket, DigitalOcean, and LaravelForge. Recently went I went to push some changes I received the following error:

error: Your local changes to the following files would be overwritten by merge:
	storage/fonts/dompdf_font_family_cache.php
Please commit your changes or stash them before you merge.
Aborting

I have deleted the files from my local machine, forced the push, and am still getting the same error. I have even checked the git file list and the file is not there. What is going on? How can I fix this?

Thanks for the help!