thomas_inckx

thomas_inckx

Member Since 3 Years Ago

Experience Points 17,060
Experience Level 4

2,940 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 162
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

11 Sep
5 days ago

thomas_inckx left a reply on How To Test Laravel Nova Api Route Policies | TDD

Hi, I find this repo/nova testing guide very helpful: https://github.com/bradenkeith/testing-nova.

You could setUp() your test with $this->user->assignRole('the_role_you_want_to_test'); and then go on testing your resources and policies.

(I stumbled upon this issue because I myself am stuck with a 404 response testing the nova api routes)

08 Mar
1 year ago

thomas_inckx left a reply on Laravel Request $request->file() Is Always Blank

In case this could help someone: I injected the wrong dependency in the controller. Should have been Illuminate\Http\Request in my case.

16 Jan
1 year ago

thomas_inckx left a reply on Class 'Pusher' Not Found

And if you'd still got the same error, like me, then add

'Pusher'    =>  Pusher\Pusher::class

to the 'aliases' array in your config/app.

(Source: https://github.com/pusher/pusher-http-laravel/issues/26 )

12 Aug
2 years ago

thomas_inckx left a reply on Date Accessor Vs. Protected $dates (L5.2)

That's interesting. Thanks!

thomas_inckx left a reply on Date Accessor Vs. Protected $dates (L5.2)

Thanks for your reply, Paschal. I do think however that you might misunderstand me. What your describing, is the same in my case, obviously.

getCreatedAtAttribute() is overriding the conversion to a Carbon object. While I assumed that it would get called after the conversion.

Anyway, like I said, I managed to make things work without the $dates array.

thomas_inckx left a reply on Date Accessor Vs. Protected $dates (L5.2)

Laravel indeed converts the date to a Carbon object in case of the $dates array, but it isn't formatted like I want, and that's my point. But if you define an accessor, it gets called before the conversion.

thomas_inckx started a new conversation Date Accessor Vs. Protected $dates (L5.2)

Hi all,

I'm trying to figure out the best way to manage (get & set) dates in my app. The protected $dates array is a great tool. It automatically converts a date string to a Carbon object, and it makes storing the dates easy and uniform (I use mutators).

protected $dates = ['birth_date'];

I can now echo a date in my view like this:

{{ $user->birth_date->format(config('view.date_format')) }}

That's ok, but kinda redundant. It means I have to do this in every view, for every date attribute (I have a lot of 'em). So I was checking out the accessors. I assumed I could simply create an accessor:

public function getBirthDateAttribute($date) {
    return $date->format(config('view.date_format'));
}

and then in my view:

{{ $user->birth_date }}

and get a nicely formatted date. But this isn't working. The $date is still a simple string at this moment. It seems that it's only converted to a Carbon object after the accessor is called. My conclusion is that the accessors don't make sense in combination with the $dates array and I'll have to format each Carbon object manually in my views.

Am I right?

EDIT: as it turns out, in my case, I don't need the $dates array. I seems that I just need to define an accessor and a mutator:

public function getBirthDateAttribute( $date )
{
    $date = Carbon::createFromFormat(config('view.def_date_format'), $date);

    return $date->format(config('view.date_format'));
}


public function setBirthDateAttribute( $date )
{
    $this->attributes['birth_date'] = Carbon::createFromFormat( config( 'view.date_format' ),       
    $date );
}

, and everything works as it should. Don't hesitate to share your view though, if you see it differently.