burlresearch

burlresearch

Consultant at https://burlresearch.com

Member Since 6 Years Ago

Ottawa

Experience Points
147,060
Total
Experience

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
938
Lessons
Completed
Best Reply Awards
115
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.

Level 30
147,060 XP
Jan
09
1 week ago
Activity icon

Replied to Check If Array Of Slugs Exists In A Model

Seems like you're doing an array-to-string comparison. That's perhaps why whereIn might work (you're detecting the single string in the array. But what you want is different.

In order to compare the arrays - you could measure their intersect:

$isect = User::pluck('slug')->intersect($slugs);
$user_has_all_slugs = count($isect) == count($slugs);

could be one approach...

Dec
03
1 month ago
Activity icon

Replied to Calculating Retirement Date

This is pretty simple:

        $retire_appointment = Carbon::parse($first_appointment)->addYears(35);
        $retire_birth = Carbon::parse($retire_birth)->addYears(60);
        $retire = $retire_appointment->min($retire_birth);
Nov
28
1 month ago
Activity icon

Awarded Best Reply on Auth With Multiple Tables For Storing Data

if your user can be several of these, at once, the you are definitely in the space of well documented many:many:

http://laravel.com/docs/5.6/eloquent-relationships#updating-many-to-many-relationships

If the user can be just 1, then you could have a User:

$table->enum('type', [admin, business, personal]);

in your migration and then just: switch(user->type){...}

Nov
14
2 months ago
Activity icon

Awarded Best Reply on Add Foreign Key In Migration

Make sure to use unsignedBigInteger('category_id'), as the indexes in Laravel are bigInts. I just ran a migration with:

public function up() {
  Schema::create('posts', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->unsignedBigInteger('category_id')->unsigned()->index();
    $table->foreign('category_id')->references('id')->on('categories');
    $table->string('title');
    $table->string('author');
    $table->string('image');
    $table->text('short_desc');
    $table->longtext('description');
    $table->timestamps();
  });
}

and it ran just fine. If you're using SQLite, remember:

SQLite disables foreign key constraints by default. When using SQLite, make sure to enable foreign key support in your database configuration before attempting to create them in your migrations.

Nov
13
2 months ago
Activity icon

Replied to Add Foreign Key In Migration

Make sure to use unsignedBigInteger('category_id'), as the indexes in Laravel are bigInts. I just ran a migration with:

public function up() {
  Schema::create('posts', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->unsignedBigInteger('category_id')->unsigned()->index();
    $table->foreign('category_id')->references('id')->on('categories');
    $table->string('title');
    $table->string('author');
    $table->string('image');
    $table->text('short_desc');
    $table->longtext('description');
    $table->timestamps();
  });
}

and it ran just fine. If you're using SQLite, remember:

SQLite disables foreign key constraints by default. When using SQLite, make sure to enable foreign key support in your database configuration before attempting to create them in your migrations.

Nov
12
2 months ago
Activity icon

Awarded Best Reply on How To Get The Hottest Categories In Blog Which Have Highest Numbers Of Posts ?

I think your key declarations may be reversed. The category_id ought to be on the Post table, so:

class PostCategory extends Model {

public function posts() {
    return $this->hasMany('App\Post', 'category_id', 'id');
    // or shorter, the category_id is on the foreign `posts` table
    return $this->hasMany('App\Post', 'category_id');  
}

And then you may count the most popular categories just by counting the usage of keys:

Post::pluck('category_id')->countBy()->sort()->reverse()->keys()->take(5)
Nov
11
2 months ago
Activity icon

Replied to How To Get The Hottest Categories In Blog Which Have Highest Numbers Of Posts ?

I think your key declarations may be reversed. The category_id ought to be on the Post table, so:

class PostCategory extends Model {

public function posts() {
    return $this->hasMany('App\Post', 'category_id', 'id');
    // or shorter, the category_id is on the foreign `posts` table
    return $this->hasMany('App\Post', 'category_id');  
}

And then you may count the most popular categories just by counting the usage of keys:

Post::pluck('category_id')->countBy()->sort()->reverse()->keys()->take(5)
Nov
07
2 months ago
Activity icon

Replied to How To Properly Divide An Amount?

>>> $amt = 2543
=> 2543
>>> round( (float)$amt/3, 2)  // to 2 decimal places
=> 847.67
Oct
04
3 months ago
Activity icon

Replied to How Do You Standardize Your JSON Responses?

API Resources are a good place to start for an approach that is built-in to laravel. There is also an artisan command-line generator for them, so that's handy.