Member Since 1 Year Ago

Experience Points

3,790 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
Best Reply Awards
Best Reply
  • start your 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-in-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 Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 1
1,210 XP
1 week ago
Activity icon

Started a new Conversation Late Binding On Typescript Vue Component (v-model)

Hi all,

I am trying to bind v-model to a component which contains an input, and have the v-model property be updated in both directions. 1) When I type in to the textbox, and 2) When I update the property on the parent component that holds the value in the v-model.

Say I have my component markup like this:

<amount-balance v-model.number="amount" :value="amount"></amount-balance>

I have a template and TS file handling an input. It's fairly simple, just a template tag with an input in it

        <input type="number" v-on:input="onInputChanged" v-bind:value="amount">

and my ts file:

import { Vue, Component, Prop, Watch } from 'vue-property-decorator'

export default class AmountBalance extends Vue {
    @Prop(Number) value?: number|null

    amount?: number|null = null;

    // input changed event
    onInputChanged (event:any): void {
        this.amount =;

    // value changed
    onValueChanged (value:number|null): void {
        this.amount = value;

I have to use two properties on the call to my component. v-model="amount" AND v-bind:value="amount". The reason being is that I can update v-model amount property on my parent component as much as I like, and the custom input component never gets the changes, so I have to write to a value property as well, and then do an @Watch on it to determine if the property changed.

The good news is, the $emit call as part of the v-on:input event works, and the parent amount property is correctly receiving the new value.

Have I missed something, and hugely over-engineered this, or is this really the simplest way to get a 2-way binding effect between a custom component and it's parent?

2 months ago
Activity icon

Replied to Large Amount Of Data. Best Way To Iterate Over, Without Getting Memory Exhaustion?

I do have a few things, There are 5 or 6 columns which "bcmath" values based on a few other properties on the model. I actually checked removing them and it cut the time down a fair bit but still took the process about 6 or 7 minutes. For 5000 rows that's more acceptable, although I think it's going to be a fair bit of work to not have to calculate those every time. I'll consider adding it to the database when the data is saved so we can save some time.

Everything else is raw data from the database, un-altered. I'm going to dump some timestamps around each statement inside the loop and really get an idea of whats taking time :)

Activity icon

Replied to Large Amount Of Data. Best Way To Iterate Over, Without Getting Memory Exhaustion?

@snapey thanks i'll try commenting out CSV line and checking speed. However I think you misunderstand the loops. You say I don't need to clear it because I write every attribute to $row. What do you mean? Because each $row is JUST the attributes for 1 model, so if I don't clear it in the outer loop, then the next row will contain double the attributes, and then the one after will triple. It has to be cleared.

Activity icon

Replied to Large Amount Of Data. Best Way To Iterate Over, Without Getting Memory Exhaustion?

Already using the queue. Chunking as stated above helps, but the queue takes 10 minutes to process. Im trying to speed that up so our support team don't have to wait 10 minutes for their CSV!

2 months ago
Activity icon

Replied to Large Amount Of Data. Best Way To Iterate Over, Without Getting Memory Exhaustion?

Each $row array does need to be reset to empty inside the loop before it pulls the attributes so it can read the single row in to CSV. Would initializing it outside make any noticeable difference? I suspect something else is causing it to slow.

Chunking the query as @martinbean said above actually worked to stop the memory limits being hit. But it's still a very slow process. Even with 20 columns of basic un-manipulated data from the DB it's still taking 12s per chunk (with a chunk-size of 200)

So either \data_get() is slow, or \fputscsv is slow, or some combination of the two. Maybe fetching the property directly instead of going through data_get would be better.

@snapey what do you mean write the record straight to CSV? Pulling the results and writing it to CSV like this is pretty much doing that, is there another way Laravel can do it without needing these loops?

Activity icon

Replied to Large Amount Of Data. Best Way To Iterate Over, Without Getting Memory Exhaustion?

@martinbean Ok will try this! The collection itself is fine when loaded. The collection is fully populated with 5000 models and that seems to happen quickly, it's just the looping over each one that appears to cause the memory to run out.

Will chunking alleviate this issue, what is it that's causing the memory to build up so much if we assume the models are already loaded?

Activity icon

Started a new Conversation Large Amount Of Data. Best Way To Iterate Over, Without Getting Memory Exhaustion?

So I have a lot of data to process. Roughly 5000 rows, and so when fetching, this generates a Collection of 5000 models. Now each of those models has maybe 20 attributes that need to be read.

Is there a fast way to do this? I currently have an array of the attributes I want to read, and then loops set up like this:

foreach ($models as $model) {
            $row = [];
            foreach ($this->attributes as $attr) {
                $row[] = \data_get($model, $attr);
	    \fputcsv($fh, $row);

For 5000 rows, each row loops 20 attributes, this can take a very long time to process, and in ever case this actually throws a FatalErrorException: Allowed memory size of 134217728 bytes exhausted

So what is the fastest way to retrieve the set of attributes for each row? I can't think of a faster one than this nested loop personally.

Additionally, seeing as \fputcsv() is writing each line to file, and the $row variable is being overwritten each loop, why am I still getting Allowed memory size exhausted?

Would a LazyCollection be the solution here?


Activity icon

Replied to Job Not Creating File With Storage::put()

@sinnbeck this did not work. I'm using a different method on storing the file now anyway (just a simple fputcsv) instead of the League CSV Writer. It can't seem to handle large sets of data.

But the same problem did persist with Storage::put(). I was never able to solve it. No variation of file paths worked for me. Every other native file writing method works. Weird.

3 months ago
Activity icon

Replied to What The Heck Is With The New Human Check On Laracasts?

Yea its a pretty major issue, and an incredibly unfriendly way to check for robots. I too struggled to post on another question because the text was cut off. Was forced to go in to developer console and check the placeholder attribute on the textbox, and then when I entered the correct answer, it still said it was wrong!

This idea is mad!

Activity icon

Started a new Conversation What The Heck Is With The New Human Check On Laracasts?

Seriously, I get JS errors and can only post but cannot update any question.

Using Chrome:


Uncaught TypeError: Cannot read property 'created_at' of undefined
    at app.js?id=47f57b366e0bd7348065:1:1 Failed to load resource: the server responded with a status of 422 ()

I answered "$" for "What is the first character of any PHP variable?", and it tells me that answer is wrong.

It also says "font-weight" is wrong when asking "Which CSS property will make text bold?".


Activity icon

Started a new Conversation Job Not Creating File With Storage::put()

Laravel 6.x

I have a long string being written to file "test.csv" using \Storage::put($path, $csv); inside a queued job. I dispatch the job and run it, and the job completes, but nothing happens.

$path = /var/www/html/storage/temp/test.csv

The put() function returns true, no errors, nothing, and also no file being created. :( All defaults are as standard on storage under the config/filesystem.php.

'local' => [
    'driver' => 'local',
    'root' => storage_path('app'),

driver isn't set in .env file so it will default to local disk.

I cannot get the file to create, I'm not sure whats happening.

I tried the file creation with:

file_put_contents($path, $csv)

and this works fine.

Any ideas? I'd rather use \Storage, in case we move the disk to an external CDN of some sorts.

5 months ago
Activity icon

Replied to Passport Access Tokens Too Long?

When a user goes to the API settings page, they generate a new token, and they copy paste a 1000 character string in to their application to use? Can it not be used with a client_id instead? They are 32 characters and much more like I'd expect.

5 months ago
Activity icon

Started a new Conversation Password Grant Type - Can This Be Exploited? Laravel Passport

When building an API that is using Password Grant Type through Laravel Passport, If someone knew the client_id, could they could brute force usernames and passwords?

Default API access is 60 calls per min. We wouldn't want to restrict them any more than this, so that means someone could just try username/password combinations 60 / min without any other restrictions.

Can you lock a user_id to the client? We tried simply adding the user_id to the corresponding row in oauth_clients table but I think it must only utilize it for Personal Access Tokens as this did nothing to restricting which users could access the API.

Any suggestions?