marcorieser

marcorieser

Member Since 4 Years Ago

Wil SG

Experience Points
44,680
Total
Experience

320 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
404
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.

Level 9
44,680 XP
Oct
13
2 weeks ago
Activity icon

Commented on Use Stubs To Set The Tenant ID

If you still get the error Field 'tenant_id' doesn't have a default value after setting the tenant_id from the session in the booted method on the Department model. Make sure you are logged in. 🙈

Sep
25
1 month ago
Activity icon

Replied to Laravel 8, Jetsteam, Inertia Change Login View

@perdanjam can you please post your code snippet?

Activity icon

Replied to MorphTo With Specific Methods

Does anyone have any further ideas?

Sep
23
1 month ago
Activity icon

Replied to MorphTo With Specific Methods

@michaloravec Thanks anyway 🙂

Activity icon

Replied to MorphTo With Specific Methods

@michaloravec Thanks, I tried your suggestions.

When calling \App\Models\User::first()->employee()->toSql() I get

"select * from `employees` where `employees`.`id` = ? and `role_type` = ?"

It doesn't work because the role_type is on the users table and not on the employees table.

Activity icon

Replied to MorphTo With Specific Methods

I now have a solution for my problem:

public function getGuardianAttribute()
{
    if ($this->role_type === Guardian::class) {
        return $this->role;
    }
    return null;
}

public function getEmployeeAttribute()
{
    if ($this->role_type === Employee::class) {
        return $this->role;
    }
    return null;
}

public function guardian()
{
    if ($this->role_type === Guardian::class) {
        return $this->role();
    }
    return null;
}

public function employee()
{
    if ($this->role_type === Employee::class) {
        return $this->role();
    }
    return null;
}

But maybe it can be improved / simplified?

It would be nice if the guardian method would not return null but kind of an empty Relations object.

Sep
22
1 month ago
Activity icon

Started a new Conversation MorphTo With Specific Methods

Hi

I have a User model which morphs to Employee and Guardian (like parent).

protected function role()
    {
        return $this->morphTo();
    }

Now \App\Models\User::first()->role returns either a guardian or an employee, which is great.

But I'd prefer to call e.g.\App\Models\User::first()->guardian which would return me the linked Guardian model or null / empty collection (not sure about this) if it is an employee. The same with \App\Models\User::first()->employee.

On the one hand I want to do this to make sure that the right role is available instead of first checking $user->isGuardian(). On the other hand to get autocompletion in PhpStorm.

I tried to link it explicit by using

public function guardian()
    {
        return $this->belongsTo(Guardian::class, 'role_id');
    }

But now \App\Models\User::first()->guardian gives me the relation to the guardian (even if the user is of role Employee) instead of an empty collection.

Is there a way to make $this->morphTo() link to a specific model and otherwise return an empty collection?

Sep
14
1 month ago
Activity icon

Commented on Cleaner Closure-Based Event Listeners

@mmwinchande Yes I am working myself trough the Vim Master Series but I look specially for a video where I can see Jeffrey working in PhpStorm while using the Vim bindings.

Sep
12
1 month ago
Activity icon

Commented on Vundle And Better File Browsing

After Installing the NERDTree plugin the shortcuts in Vinegar (e.g. % for new file or d for new directory) don't work anymore. Does somebody can give me a hint to solve this?

Sep
09
1 month ago
Activity icon

Commented on Cleaner Closure-Based Event Listeners

@jeffreyway Just started with VIM emulation in PhpStorm and it would be cool if you could make a video about how your workflow works with the VIM and IDE shortcuts. Maybe just the display as an overlay of the pressed characters would be a big help while we watch you doing a regular video.

Sep
01
1 month ago
Activity icon

Commented on Top Navs

Seems like the episode description is wrong?

Jul
23
3 months ago
Activity icon

Replied to Is Ide-helper Really Needed?

Here is a good overview of the current available methods to improve the workflow in phpstorm https://www.youtube.com/watch?v=HB2T0iWiW50

Jul
22
3 months ago
Activity icon

Commented on Composition API: Logic Extraction And Reuse

@drehimself it would be possible to just pass the initial value to the toggle function like this, right?

export function useToggle(state = true) {
  const isVisible = ref(state)

  function toggleVisible() {
    isVisible.value = !isVisible.value
  }

  return {
    isVisible,
    toggleVisible
  }
}
Jul
20
3 months ago
Activity icon

Replied to CSS Animations On Components In V-For

@mattb Maybe try v-show instead of v-if on your component? Just guessing.

Jul
19
3 months ago
Activity icon

Commented on The Composition API

@edoc I was thinking the same.

Jun
20
4 months ago
Activity icon

Commented on Two-Way Data Binding

@hsosa look here: https://caniuse.com/#feat=fetch you can also filter down the results to your country