patgilmour

patgilmour

Member Since 1 Year Ago

Experience Points 14,330
Experience Level 3

670 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 141
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 May
6 days ago

patgilmour left a reply on Easy Way To Check If Laravel App Has Connection With Existing MySQL DB

Laravel 5.8.* — the following quick and dirty database connection test works. In your fresh Laravel install, temporarily replace the default route with the following then hit the homepage:

use Illuminate\Database\Connection;

Route::get('/', function () {

    // Test database connection
    try {
        DB::connection()->getPdo();
        echo "Connected successfully to: " . DB::connection()->getDatabaseName();
    } catch (\Exception $e) {
        die("Could not connect to the database.  Please check your configuration. error:" . $e );
    }

    return view('welcome');
});
05 Aug
1 year ago

patgilmour left a reply on Build Collection Subset Of Related One-to-many Results

@Snapey - thanks a million!

That is exactly what I wanted but didn't know the name.

My page Waiting (TTFB) has gone from 5 seconds to 200ms!

Lesson: don't call models from loops inside Blade is you can use eager-loading instead.

Anyone with the same issue, read more here: https://laravel.com/docs/5.4/eloquent-relationships#eager-loading

04 Aug
1 year ago

patgilmour started a new conversation Build Collection Subset Of Related One-to-many Results

I'm trying to build a collection with related results as a subset. As in...

I have two models: Leaflets and Pages. The relationship is: Leaflet one-to-many Page.

Imagine I have 3 Leaflets and each has 6 Pages. What I want is 3 Leaflet collections that have the 6 Page ids within them.

But when I try a leftJoin, I get 18 results instead of 3:

$leaflets = Leaflet:: leftJoin('pages', 'pages.leaflet_id', '=', 'leaflets.id') ->select('leaflets.*', 'pages.id') ->get();

Obviously, I am missing something very fundamental, but I've tried every Google search I can think of to no avail.

As a side note, the reason why I want to build a large collection like this is because with my real models I'm hitting performance issues in the blade rendering. As in: @foreach ($leaflet->$Page as $page) etc... (there are further sub-related datasets. I have to dump a huge amount of data into the page - ajax isn't an option – so I'm hoping that by iterating collections, rather than running `$leaflet->$Pa (which I assume is running a query) things will run faster. I might be totally wrong but I can't test it until I have the above working.)

Thanks for any help or insights on this.

17 Jun
1 year ago

patgilmour left a reply on Valet - 404 - Not Found

None of the above worked for me, but this did:

cd to your home directory in Terminal and remove the hidden .valet folder. So, in my case:

pat$ rm -r .valet

Now reinstall valet with:

valet install

Then cd to your sites/code/wherever your laravel sites are directory and:

valet park

You can cd into one of your site folders and type this to open the site in your browser with valet:

valet open