Member Since 2 Years Ago

Experience Points 18,000
Experience Level 4

2,000 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 174
Best Reply Awards 0
Best Reply
  • 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    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 Aug
1 week ago

patgilmour left a reply on Embed Laravel App/Component In External Website

Thanks @aurawindsurfing - useful, and just what I was considering. Neither are great choices, admittedly, but at least it can be done.

08 Aug
1 week ago

patgilmour started a new conversation Embed Laravel App/Component In External Website

Hi - I'm wondering if anyone could give me pointers on how best to integrate my Laravel app into other front end websites.

In short I want to show a user who has just submitted a PDF through a form on an external website what is happening with the PDF (we analyse and report on quality) on my Laravel website.

The steps I have working to date are something like this:

Vanilla Website form/PDF submit <--> Laravel Website <--> PDF Analysis/Reporting tool.
  • The user submits the form/PDF to a PHP (or other) script.
  • cURL sends the id/URL of PDF to Laravel before redirecting the user's browser to the Laravel site. On the Laravel site, the user can watch (via Broadcasting/Pusher) the download, analysis and reporting of the PDF analysis (it happens on another app that sends http update requests to Laravel).
  • When complete, the user clicks a button and is redirected back to their originating website.

The advantage of the above it is relatively easy to write some vanilla PHP for the user website to get the id and URL across to Laravel and to redirect the browser. The disadvantage is they are redirected out of their site and back into it. Not seamless and if I do this for, say, five clients, I'm going to have to create five views to appromiately match the brand of the originalting site.

10 years ago, I might have kluged something with an iFrame so the user wouldn't have to leave their site.

Today, I'm not sure how to proceed. Do I stick with redirects? Or is there a better way? I've just started tinkering with Vue (I use it with Laravel Echo for the progress bars on the above). Is there some way to achieve something similar to an iFrame with a relatively portable view componont that the website owner could easily embed in the code of their site?

Thanks for any insights anyone can offer!

03 Aug
2 weeks ago

patgilmour left a reply on Is EnableForeignKeyConstraints Required?

Thanks Tykus!

I guess the checks must be enabled because Schema::enableForeignKeyConstraints() doesn't appear to make any difference.

Are the default database foreign key checks enabled/disabled in the database manager (MySql) or in the Laravel configs?

patgilmour left a reply on Is EnableForeignKeyConstraints Required?

This recent video by Jeffrey does a great job of explaining Foreign Key Constraints:

Though it doesn't answer my question about whether including Schema::enableForeignKeyConstraints(); is necessary.

patgilmour started a new conversation Is EnableForeignKeyConstraints Required?

I've created the following migration with a foreign key constraint:

    public function up()
        Schema::create('reports', function (Blueprint $table) {



     * Reverse the migrations.
     * @return void
    public function down()

In the Laravel documentation, I read, you may enable foreign key constraints within your migrations by using Schema::enableForeignKeyConstraints(); so I inserted it into the up() function.

Is Schema::enableForeignKeyConstraints(); required and, if yes, how can I assess what it does?


02 Aug
2 weeks ago

patgilmour left a reply on Telescope In Hell (read "WordPress")

Thanks Snapey, and you are right.

However, I am able to move anything I want to keep secure from .env to the various PHP files in /config

Do you think that would be enough?


Actually, after considering your answer, I think I should move the whole thing to a subdomain and completely out of WordPress, so only the Laravel /public folder is exposed. Thanks.

01 Aug
2 weeks ago

patgilmour left a reply on Telescope In Hell (read "WordPress")

Okay, here is a fix that works. In the .htaccess file in root of the WordPress install, add this before all other directives:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^telescope/(.*)$ /wp-content/plugins/MY_PLUGIN/MY_LARAVEL_INSTALL/public/index.php/telescope [L,NS]

Leave your config/telescope.php TELESCOPE_PATH as the default.

patgilmour started a new conversation Telescope In Hell (read "WordPress")

I appreciate this is unconventional and likely unadvised but, at my wit's end trying to wrangle a WordPress plugin square peg into a round hole, I have given up and installed Laravel inside a WordPress plugin (yep!). For those not familiar with WordPress (lucky you), Laravel resides here:

Incredibly, it worksand brings instant relief for what I need to do.

To hit my Laravel site home page, I visit:

Pretty much everything works, make:auth, migrations, php artisan, etc.

I can make a new route like Route::get('my_route', '[email protected]'); and that works if I hit it at:

Encouraged by this, I installed Telescope and I can visit it too at the default path:

This successfully loads the Telescope interface, but when I click on one of the sidebar categories, the path is wrong on the click and so I get an eternal "Scanning..." message. For example, if I click on 'Requests' the URL is not:


So, I know I'm trying to mix oil and water, and I know I'm bringing disgrace on our noble house etc., but can anyone think of a way to get Telescope to work in this scenario?

I've tried adding TELESCOPE_PATH=various_different_paths but to no avail

And by the way, this Laravel app will only ever have two routes: a redirect from WordPress and an endpoint form an external service... so it's not that bad.


30 Jul
3 weeks ago

patgilmour left a reply on Telescope Data Pruning Outside Of Php Artisan

Thank you, Audunru! Very useful answers.

I've been trying to go through the entire documentation but hadn't looked into scheduling yet. Seems that the missing pieceso will give it a look over on your recommendation.

patgilmour started a new conversation Telescope Data Pruning Outside Of Php Artisan

php artisan help telescope:prune explains that, for example, the following will delete all telescope entries older than 12 hours: php artisan telescope:prune --hours=12

In the online Laravel manual, there is something similar, only set with a variable: $schedule->command('telescope:prune')->daily(); or, similar to above with hours, $schedule->command('telescope:prune --hours=48')->daily();

My questions:

  • When I run php artisan telescope:prune --hours=12 is this a one-time event? Or does this mean that, for this Laravel project, all entries older than 12 hours will be pruned going forwards?
  • I'm assuming the above is a one-time event and that I need to include $schedule->command('telescope:prune --hours=12'); somewhere in my Laravel code is I want pruning to happen when the app is run. If this is the case, where should I include the code?
  • In the code with the $schedule variable, I have excluded ->daily() because I am running the "prune" at intervals of less than daily. Is this correct?

Thanks for any insights!

04 Jun
2 months ago

patgilmour left a reply on Naming Convention For "Reference" Table

Thanks for replying, siangboon!

Makes sense on the table naming.

As for "lookup" table, of course! Now you mention it, I remember lookups from my long-gone FileMaker days.

03 Jun
2 months ago

patgilmour started a new conversation Naming Convention For "Reference" Table

Hi - I want to create a table to store status values of the type:

  • Submitted
  • Received
  • Processing
  • Reporting
  • Complete

The text values may change so I want them in a separate table like this so the values can be referenced by id.

The values above with relate to a separate File model, so a File will be "Submitted", "Received" etc.

My question is: what should I call my "reference" model/table? Is there a convention? I'd thought of "StatusFile" but wondered if there is a standard way of naming this type of table to distinguish them from "normal" tables where rows are continually being added.

Also, is there a name for this type of table?

Thanks for any insights!


16 May
3 months 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 {
        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
2 years 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:

04 Aug
2 years 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', '=', '') ->select('leaflets.*', '') ->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
2 years 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$ is my bash user):

pat$ rm -r .valet

Now reinstall valet with:

pat$ valet install

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

pat$ valet park

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

pat$ valet open

Or just try the default url in your browser.