ignium

Member Since 2 Years Ago

Experience Points
69,570
Total
Experience

430 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
637
Lessons
Completed
Best Reply Awards
2
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 14
69,570 XP
Jan
12
1 week ago
Activity icon

Replied to View Laracasts Lessons By Date

Perfect! Thanks!

Activity icon

Started a new Conversation View Laracasts Lessons By Date

Is there a way to view Laracasts lessons by date? I typically start by going to the "What's new" page and this typically shows only the last 6 episodes. Most of the time I'm able to visit every weekday so it isn't a problem. On the rare occasion I am not able to visit for several days and all six episodes are new, I can't find a way to find a full list of episodes by date to make sure I didn't miss one.

Am I totally missing somewhere else this list might exist?

Nov
28
1 month ago
Activity icon

Started a new Conversation Livewire "casts" (hydrating And Dehydrating) A Value Object On A Related Model

I am in the process of adding Livewire functionality to the forms in my project. I've been successful so far, but have come across an issue with trying to get a value object to populate in an input. In my project a Funder has a polymorphic relationship to a Contact, and a contact has a phone_number attribute which the Contact class casts to a PhoneNumber value object.

I'm able to get the object itself into the input (i.e., the input reads [object Object]), but I'm having the hardest time getting the actual value to display and bind to the model.

FunderForm.php

<?php

namespace App\Http\Livewire;

use App\Funder;
use App\Rules\Phone;
use App\Traits\FlashesCRUDStatus;
use App\ValueObjects\PhoneNumber;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component;

class FundersForm extends Component
{
    use FlashesCRUDStatus, AuthorizesRequests;

    //Form Models
    public $funder;
    public $contact;
    public $address;

    //Form Fields
    public $name;
    public $is_active;

    public function rules()
    {
        return [
            'name' => ['required', 'max:90', 'min:5'],

            'contact.first_name' => ['required', 'max:45'],
            'contact.last_name' => ['required', 'max:45'],
            'contact.phone' => ['required', new Phone],
            'contact.email' => ['required', 'email'],

            'address.street' => ['required', 'max:100'],
            'address.city' => ['required', 'max:45'],
            'address.state' => ['required', 'max:2'],
            'address.postal_code' => ['required', 'min:5', 'max:10'],
        ];
    }

    public function mount(?Funder $funder = null)
    {
        $this->funder = $funder;
        $this->contact = $funder->contact;
        $this->address = $funder->address;

        $this->name = $funder->name;
        $this->is_active = $funder->is_active ?? true;
    }

    // ...

    public function hydrateContact($value)
    {
        $this->contact->phone = PhoneNumber::fromUnformatted($value);
    }

    public function dehydrateContact($value)
    {
        $this->contact->phone = $value->phone->asUnformatted();
    }
}

funders-form.blade.php (partial)


    <x-forms.section title="Funder Contact" subtitle="Enter contact information for this funder.">

           <x-forms.input
            wire:model.lazy="contact.email"
            required
            type="email"
            :placeholder="__('contacts.email_placeholder')"
            class="col-span-6 sm:col-span-3"
        >@lang('app.Email')</x-forms.input>

        <x-forms.input
            wire:model.lazy="contact.phone"
            required
            type="tel"
            :placeholder="__('contacts.phone_placeholder')"
            class="col-span-6 sm:col-span-3"
        >@lang('app.Phone')</x-forms.input>
    </x-forms.section>

In this excerpt I included the email field which is just a string and displays correctly in the form, to show the set up of the input component.

I'm not even sure if I've set up the mount() method correct for this situation. If I add the line <p>{{ $contact->phone->asUnformatted() }}</p> to the form, it does display correctly, but I can't figure out how to bind the data to the $contact attribute of the Livewire component. Any help would be appreciated.

Nov
24
1 month ago
Activity icon

Replied to Anonymous Component Props Always Equal To Default Value

Oof. When I said I didn't do anything else to the Input.php class other than rename the class, I meant it. I only changed the file name and not the class name. Sometimes you just want to bang your head against the desk when you make silly mistakes like that. Thanks @rodrigo.pedra! And thank you, @mvd for trying to help too!

Activity icon

Replied to Anonymous Component Props Always Equal To Default Value

I did use the artisan command to create it, but I've renamed the class from Input.php to OLDInput.php to break the link. I didn't do anything else though (like changing the namespace). I'll delete the file and try again. Unfortunately I won't have access to that computer for a couple of hours to try it, but you make a great point!

Activity icon

Replied to Anonymous Component Props Always Equal To Default Value

Recreating the file initially worked, but when I renamed the new component from test.blade.php to input.blade.php, it stopped working. I even swapped the file names (renamed test to input and input to test) then set some of the form's inputs to test and the others I left alone. Only the inputs that reference <x-forms.test /> (even though this was the original input.blade.php) show up correctly.

I've cleared my view cache and cleared the browser cache several times, is there a cache somewhere I'm missing?

Nov
23
1 month ago
Activity icon

Replied to Anonymous Component Props Always Equal To Default Value

@mvd, thanks for the reply! Below is the entire input.blade.php file.

input.blade.php

@props([
    'prepend' => null,
    'append' => null,
    'type' => 'text'
])

<div class="{{ $attributes->get('class') }}">
    <label for="{{ $attributes->wire('model')->value() }}-input" class="block text-sm font-medium leading-5 text-gray-700">{{ $slot }}</label>
    <div class="mt-1 relative rounded-md shadow-sm">
        @if($prepend)
            <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
                <span class="text-gray-500 sm:text-sm sm:leading-5">
                    {{ $prepend }}
                </span>
            </div>
        @endif
        <input
            {{ $attributes->except('class') }}
            id="{{ $attributes->wire('model')->value() }}-input"
            type="{{ $type }}"
            data-lpignore="true"
            @error( $attributes->wire('model')->value() )
                class="form-input block w-full {{ $append ? 'pr-22' : 'pr-10'}} {{ $prepend ? 'pl-7' : '' }} border-red-300 text-red-900 placeholder-red-300 focus:border-red-300 focus:shadow-outline-red sm:text-sm sm:leading-5"
                aria-invalid="true"
                aria-describedby="{{ $attributes->wire('model')->value() }}-error"
            @else
                class="form-input block w-full sm:text-sm sm:leading-5 {{ $prepend ? 'pl-7' : '' }} {{ $append ? 'pr-12' : '' }} disabled:bg-gray-100"
            @enderror
            />
        @if($append)
            <div class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
                <span class="text-gray-500 sm:text-sm sm:leading-5" id="price-currency">
                {{ $append }}
                </span>
            </div>
        @endif
        @error( $attributes->wire('model')->value())
            <div wire:key="{{ $attributes->wire('model')->value() }}_error_svg" class="absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none">
                <svg class="h-5 w-5 text-red-500" fill="currentColor" viewBox="0 0 20 20">
                    <path fill-rule="evenodd"
                        d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z"
                        clip-rule="evenodd" />
                </svg>
            </div>
        @enderror
    </div>
    @error( $attributes->wire('model')->value() )
        <p wire:key="{{ $attributes->wire('model')->value() }}_error" class="mt-2 text-sm text-red-600" id="{{ $attributes->wire('model')->value() }}-error">{{ $message }}</p>
    @enderror
</div>
Activity icon

Started a new Conversation Anonymous Component Props Always Equal To Default Value

I have an anonymous component and every @prop is set to either the default (if set) or null (if not set).

input.blade.php (snippet)

@props([
    'prepend' => null,
    'append' => null,
    'type' => 'text'
])

contracts-form.blade.php (snippet)


<x-forms.input
	wire:model.lazy="initial_payment"
	min="0"
	step="0.01"
	type="number" 	//**prop set**
	prepend="$"		//**prop set**
        :placeholder="__('contracts.initial_payment_placeholder')"
        class="col-span-6 sm:col-span-3"
>@lang('app.Initial Payment')</x-forms.input>
	

Dev tools output

<input wire:model.lazy="initial_payment" min="0" step="0.01" placeholder="Enter contract initial payment" id="initial_payment-input" type="text" class="form-input block w-full sm:text-sm sm:leading-5   disabled:bg-gray-100">

You'll see in the dev tools output type="text" and the prepend prop is missing.

Not sure if this is a result of converting a full component (view and class) to an anonymous component or if I'm just missing something. Any help would be appreciated.

Nov
13
2 months ago
Activity icon

Commented on Weak Maps

Just pointing this out for people who haven't upgraded to PHP 8 yet, but the null coalescing assignment operator (??=) was introduced in PHP 7.4, so you can use that tip from the video prior to upgrading to PHP 8

Thanks for these videos as new versions of PHP or Laravel come out, they're super helpful providing concrete examples and explaining the history of how things were done vs how they can be done.

Sep
17
4 months ago
Activity icon

Commented on How It Works

Livewire is still a Javascript frame work. But you (as the developer) don't have to write javascript. You get to write everything in PHP and Livewire wires up the JS behind the scenes. It's less for "lazy" people and more for people who are very familiar with PHP and less with JS.

Sep
16
4 months ago
Activity icon

Commented on How It Works

I can't find it, but Caleb (the creator of Livewire) said, "if you want to use Vue, use Vue. If you want to use Livewire, use Livewire".

There are certain aspects of Livewire that get overridden by Vue and there isn't an easy way on the Livewire end to deal with that.

That being said, I have a project with both in it, and I don't have any problems (other than some extra console warnings and errors). But eventually I'll be refactoring my Vue components to Livewire components.