gcwilliams

gcwilliams

Member Since 5 Years Ago

Experience Points
55,670
Total
Experience

4,330 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
526
Lessons
Completed
Best Reply Awards
25
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.

Level 12
55,670 XP
Oct
18
2 days ago
Activity icon

Awarded Best Reply on Alpine JS Support For IE11 And Legacy Browsers

Try:

import 'alpinejs/dist/alpine-ie11';

Obviously that won't do the whole module/nomodule stuff that way (at least I don't think it will), but that should import the script.

Activity icon

Replied to Alpine JS Support For IE11 And Legacy Browsers

Try:

import 'alpinejs/dist/alpine-ie11';

Obviously that won't do the whole module/nomodule stuff that way (at least I don't think it will), but that should import the script.

Oct
08
1 week ago
Activity icon

Replied to Laravel Factory Design Question

@t0berius I assume is_seller is a field on the user table. If so you should be able to just set it within the create:

$user = User::factory()->level()->create(['is_seller' => true]);

Since the level state is using the afterCreating hook, it wouldn't run that until after creating the user with the is_seller field set to true.

Activity icon

Replied to Laravel Factory Design Question

I would try something like this article:

https://stefanzweifel.io/posts/2020/09/17/nested-states-in-laravel-8-database-factories/

So basically use a state and the "afterCreating" call. Within the afterCreating call, instead of calling another factory, just do a lookup of the UserLevel. So something like:

namespace Database\Factories;

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
    protected $model = User::class;

    public function definition()
    {
        return [
            'name' => $this->faker->name,
            'email' => $this->faker->unique()->safeEmail,
            'email_verified_at' => now(),
            'password' => 'yIXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
            'remember_token' => Str::random(10),
        ];
    }

    public function level()
    {
        return $this
            ->afterCreating(function (User $user) {
		// Select User Level or whatever you want
		$userLevel = App\Models\UserLevel::find(1);
                $user->userLevel()->save($userLevel);
            });
    }
}

Just an idea, but I think something like that will work.

Oct
04
2 weeks ago
Activity icon

Replied to Spark: When Is The Next Version Due For Release?

I don't know when it will be released, but Taylor talked about it at the last Laracon online conference and it sounds like a major rewrite. So I'd not be surprised if the "series" is incremented to the next major release.

Sep
14
1 month ago
Activity icon

Replied to Factory For Model With Custom Namespace In Laravel 8

By the way you can also just call ProductFactory::new() instead of using the trait on the model itself.

Sep
08
1 month ago
Activity icon

Replied to How To Validate That End Date Is Greater Than Start Date

What date picker library are you using? Most have ways to disable dates. Pikaday and flatpickr are two popular ones. I know with flatpickr you can disable dates, I’m sure Pikaday does too. But would need to know what you’re using.

Activity icon

Replied to How To Validate That End Date Is Greater Than Start Date

You should be validating it within the backend and not counting on javascript to validate the data. It is pretty easy with the validation "after".

https://laravel.com/docs/7.x/validation#rule-after

Jul
20
3 months ago
Activity icon

Awarded Best Reply on How To Overlook Case Sensitivity In Laravel Query

If the data in Nationality model / table is all lowercase, just do something like

$nationality = Nationality::where('nationality_code', strtolower($employee->nationality_code))->first();

If the data in Nationality is mixed too, you will need to do something like

$nationality = Nationality::whereRaw('LOWER(nationality_code) = ?', [strtolower($employee->nationality_code)])->first();
Activity icon

Replied to How To Overlook Case Sensitivity In Laravel Query

If the data in Nationality model / table is all lowercase, just do something like

$nationality = Nationality::where('nationality_code', strtolower($employee->nationality_code))->first();

If the data in Nationality is mixed too, you will need to do something like

$nationality = Nationality::whereRaw('LOWER(nationality_code) = ?', [strtolower($employee->nationality_code)])->first();
Activity icon

Replied to How To Overlook Case Sensitivity In Laravel Query

Is the data in Nationality table also mixed case or is it consistent upper or lowercase?

Activity icon

Replied to How To Overlook Case Sensitivity In Laravel Query

If in your database the string is always lowercase, the simplest solution is to just string lower your $employee->nationality_code in the comparison.

Jul
14
3 months ago
Activity icon

Replied to Log When A User Logs In

Unless your logging other things like bugsysha said, there really is no reason not to just override the authenticated() method. If at a later date you introduce more logging, then you can always refactor it then.

Here was a cool article by Jonathan Reinink about a good way to query the data for your dashboard.

https://reinink.ca/articles/dynamic-relationships-in-laravel-using-subqueries

Jun
14
4 months ago
Jun
02
4 months ago
Activity icon

Replied to Custom Cast Not Working With Null Values

Then instead of returning null in the set method, return 0.

Apr
29
5 months ago
Activity icon

Replied to How Do I Make A Policy With A Model Other Than "User"?³

More than likely your policy was just not running at all. If the names are not standard you will probably have to manually register the model/policy instead.

Apr
18
6 months ago
Activity icon

Replied to Legal Issue Relate Laravel Topic Book Publish

I'd suggest trying to contact Matt Stauffer https://mattstauffer.com He wrote "Laravel: Up and Running", so I would assume he would know. Might try to message him on twitter.