chrispage1

chrispage1

Member Since 2 Years Ago

Experience Points
34,980
Total
Experience

20 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
337
Lessons
Completed
Best Reply Awards
0
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 7
34,980 XP
Feb
15
2 days ago
Activity icon

Commented on What I Learned About Cypress On Day 2

Great video as always. Would love to see a full series 👍👍 Such a powerful tool, I've just had a play in my current project and can see the potential!

Nov
07
3 months ago
Activity icon

Started a new Conversation Creating Google Drive Style Sharing

Hi,

I'm trying to build a 'Google Drive style' platform, but I'm having some issues with how to structure this.

Here are my models -

Folder

- id
- author_id
- parent_id (nullable)
- name
- created_at
- updated_at

User

- id
- name
- email
- created_at
- updated_at

FolderUser (pivot table linking user to folders)

- folder_id
- user_id
- shared (boolean)

The above works great, for a very basic folder/user structure, and I know that if I grab all of the users folders, then I can confidently display the users index, along with whether the folder is shared or not.

But what about when I drill down deeper, how do I make sure this user has the permission to access this folder? The only way I can think is to get the folder ID, get all parent ID's, and then check if this record is present in the folder_users table? However, this isn't exactly efficient and I cant think of an easy way to query it!

Additionally, what about when I want to generate breadcrumbs? I hope you can understand my problem and have some good ideas!

Cheers, Chris.

Oct
02
4 months ago
Activity icon

Replied to Check If RelationShip Exists Between Two Specific Models

Just a note to anyone looking for a solution on this. @tykus solution would enforce the loading of all users, which on some systems could be thousands.

If you want to check the presence of a relationship, without loading all the records, I'd recommend running it as a query -

public function hasUser($user)
{
  return $project->users()
    ->where('user_id', $user->getKey())
    ->exists();
}
Aug
22
5 months ago
Activity icon

Commented on Play With Confidence

Awesome video as usual thank you! What's the shortcut to rerun the last test again and again while you're in the code view?

Thanks!

Aug
19
5 months ago
Activity icon

Replied to Best Way To Render Markdown In Views

Just to add to this, if you are using Markdown in lots of places, I'd recommend creating a custom directive...

In the boot method of your AppServiceProvider (or any other provider if you have custom ones) -

Blade::directive('markdown', function ($expression) {
  return "<?php echo (new Parsedown)->text($expression); ?>";
});

You can then render markdown using @markdown($content) within your views. Thanks to @joaozitopolo for the suggestion on how to render Markdown within Laravel.

Make sure to clear your View cache with php artisan view:clear before testing otherwise chances are it won't work.

Just to add another level to this, if you are using it a lot rather than instantiating a new instance of Parsedown every time, I'd recommend creating a singleton and referencing that instead -

class BladeServiceProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        app()->singleton('parsedown', function () {
            return new Parsedown();
        });
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        Blade::directive('markdown', function ($expression) {
            return "<?php echo app('parsedown')->text($expression); ?>";
        });
    }
}

As you can see above, I've abstracted this out into my own BladeServiceProvider service provider. I hope this helps someone!