MattCroft

MattCroft

Member Since 4 Years Ago

Kent

Experience Points 13,690
Experience Level 3

1,310 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 251
Lessons
Completed
Best Reply Awards 4
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.

25 Sep
2 years ago

MattCroft left a reply on Pagination With Existing Paramethers In The URL?

ah in that case i believe you can do the same but with render instead in 5.0.

MattCroft left a reply on Pagination With Existing Paramethers In The URL?

Hey,

Can you not echo out the links in the view, somethings like this

{{ $users->appends(['sort' => 'votes'])->links() }}

08 Sep
2 years ago

MattCroft left a reply on Problems With Jenssegers Laravel MongoDB Eloquent

Hey,

I had a similar issue a few days ago, i solved this by using dev-master.

As per this PR the fix has been pushed to master but i dont think its in a stable tag yet.

https://github.com/jenssegers/laravel-mongodb/pull/925

Hope that helps.

17 Jun
3 years ago

MattCroft left a reply on Having Issues With Mixins - VueJS + Spark

Just in case anyone has the same issues, the solution i used figured out was this

var base = module.exports = {
    props: ['user'],

    data() {
        return {
            model: null
        };
    },

    ready() {
        this.getModel();
    },


    events: {
        updateModel() {
            this.getModel();
        }
    },


    methods: {
        /**
         * Get the current API tokens for the user.
         */
        getModel() {
            this.$http.get('/model').then(
                function(response) {
                    this.model = response.data;
                }
            );
        }

    }
};

var models = module.exports = {
    props: ['user'],

    mixins: [base],

    /**
     * The component's data.
     */
    data() {
        return {

            form: new SparkForm({
                name: '',
                lead_email: ''
            })
        };
    },


    watch: {
        model : function(value) {
            this.initialiseForm(value);
        }
    },

    methods: {

        initialiseForm(model) {
            this.form.name = model.name;
            this.form.lead_email = model.lead_email;
        },

        update() {
            Spark.put('/model/details', this.form)
                .then(response => {
                    this.$dispatch('updateModel');
                });

        }
    }
};


Vue.component('model', {
    props: ['user']
});

Vue.component('model-settings', {
    props: ['user'],
    mixins: [models]
});

MattCroft started a new conversation Having Issues With Mixins - VueJS + Spark

Hello,

I have limited exposure to VueJS and have been messing about with Spark and VueJS today and i have run into an wall with mixins.

Essentially rather than extend my Vue component, im trying to use a mixin to act as helper methods.

My Vue code is as follows

var model = module.exports = {

    data() {
        return {
            model: null
        };
    },

    created() {
        this.getModel();
    },

    methods: {
        getModel() {
            this.$http.get('/model')
                .then(function(response) {
                    //this.model = response.data;
                    this.$set('model',response.data);
                });
        }
    }
};


Vue.component('model', {
    props: ['user']
});

Vue.component('model-settings', {
    props: ['user'],

    mixins: [model],

    data() {
        return {
            form: new SparkForm({
                name: '',
                lead_email: ''
            })
        }
    },

    ready() {
        this.initialiseForm();
    },

    methods: {

        initialiseForm() {

            this.form.name = this.model.name;
            this.form.lead_email = this.model.lead_email;
        },

        update() {
            Spark.put('/model/details', this.form)
                .then(response => {
                    console.log(response);
                });

        }
    }
});

My View code for Laravel is

model.blade.php

<model :user="user" inline-template>
    <div>
        @include('leviathan.model.settings')
    </div>
</model>

model/settings.blade.php

<model-settings :user="user" inline-template>
    <div class="panel panel-default">
        <div class="panel-heading">Settings</div>

        <div class="panel-body">
            <!-- Success Message -->
            <div class="alert alert-success" v-if="form.successful">
                Your settings has been updated!
            </div>

            <form class="form-horizontal" role="form">
                <!-- Name -->
                <div class="form-group" :class="{'has-error': form.errors.has('name')}">
                    <label class="col-md-4 control-label">Name</label>

                    <div class="col-md-6">
                        <input type="text" class="form-control" name="name" v-model="form.name">

                        <span class="help-block" v-show="form.errors.has('name')">
                            @{{ form.errors.get('name') }}
                        </span>
                    </div>
                </div>

                <div class="form-group" :class="{'has-error': form.errors.has('lead_email')}">
                    <label class="col-md-4 control-label">Send Leads To</label>

                    <div class="col-md-6">
                        <input type="email" class="form-control" name="email" v-model="form.lead_email">

                        <span class="help-block" v-show="form.errors.has('lead_email')">
                            @{{ form.errors.get('lead_email') }}
                        </span>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-offset-4 col-md-6">
                        <button type="submit" class="btn btn-primary" @click.prevent="update" :disabled="form.busy">
                            Update
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</model-settings>

I have mainly copied and pasted from Spark it self to attempt to get something working.

The issue i am having is that in the method initialiseForm model is not being set and Chrome complains of this Uncaught TypeError: Cannot read property 'name' of null which makes sense if its not set.

When i look use the Vue Chrome extension and click on the Model node then Model Settings, i can see my model object is set.

Can someone please tell/show me what i am doing wrong.

Thanks, Matt

04 Sep
3 years ago

MattCroft left a reply on Laravel Spark

Im not sure if it has been asked but does anyone know if the frontend for Spark is built with angularjs? With Forge and Envoyer being this way, i have a concern that this is the case which i won't be too keen on.

Also not too keen on having to edit the files to add config details in, i hope this gets extracted out into something a little more configurable, don't want to have to a deployment to add a new subscription :(.

Overall though, looks really promising and i look forward to digging into to it and using it for my future projects, hopefully it will save plenty of time in the future, which im sure it will :)

25 Jul
3 years ago

MattCroft started a new conversation DigitalOcean API Create Droplet Question?

This is a copy and paste from my original question over at the Digital Ocean Community, just looking to see if any of you talented people can help..

So here's my problem, i have looked around and can't seem to find a solution to it, or i may just be googling the wrong terms.

I'm trying to setup droplet creation via the API and i'm using the user-date( cloud-config ) to run command's. But no matter what i try and do the email associated with the account gets and email saying that the droplet is ready and the root password is "blah".

So my question is how do i suppress that email so that the email does not get sent to the associated email with that account.

I know i could attach an SSH key but I'm trying to avoid attaching a Key via the API to the account in question.

Original Question : https://www.digitalocean.com/community/questions/can-i-suppress-the-email-getting-sent-from-the-droplet-create-via-the-api

18 May
4 years ago

MattCroft started a new conversation Community Videos

Hello,

So i haven't thought this through 100% so its mainly just an idea and see where it goes.

The idea is the community would be able to upload videos to Laracasts, that it in its simplest form.

Of course we all know it wont be that simple, the way i would see it working is for example. A new subscription that Jeffery provides that would give a user rights to upload videos, this in turn restricts it down already and only the dedicated would go for such a subscription.

However videos would still need to be checked by someone, again this is were a problem would appear as we couldn't expect Jeffery to check all submitted videos. So i would suggest some form of Community Managers.

The user should be able to upload a single video or a collection following the same format that already appears here on Laracasts.

I personally feel like this could be a good move forward for Laracasts, but maybe this isnt a good idea, but as i mentioned i havent thought the feature through fully so it would require some weighting up against pro's and con's.

Thats the gist anyway.

14 May
4 years ago

MattCroft left a reply on Receiving Different Fields On An "API" From Multiple Companies

I would consider setting up some sort if transform class that will process the request data and return you the data set with the fields you expect, the transform class would looks for the possiable fields that they can supply and then map the one that is populated.

29 Apr
4 years ago

MattCroft left a reply on How Do You Paginate A Users Stripe Invoices?

Looks like it returns 10 by default, also looks like you can up this by passing the limit param.

I can't see any way to get a total from the github code, looks like the total param is wiped away because taylor formats the invoices into his own class.

Would be ideal if Taylor could alter this to return an Invoice collection maybe.

28 Apr
4 years ago

MattCroft left a reply on Homestead Is Bother Me Have To Halt And Up Ever Time To Get Updated :(

Are you mounting your code to homestead or copying it across?

MattCroft left a reply on Dispatch Command From Within Another Command's Handler?

I have done this on many occasions, a cut down example being.

  /**
     * Execute the command.
     *
     */
    public function handle()
    {

        /** @var Squire\Entity\Property $property */
        $property = ($this->slug)
            ? Squire\Entity\Property::findBySlug($this->slug)
            : new Squire\Entity\Property;


        $existed = $property->exists;

        if( $this->slug )
        {
            $this->address['id'] = $property->address->id;
            $this->schema['id'] = $property->schema->id;
        }

        /** @var Squire\Entity\Address $address */
        $address = $this->dispatchFromArray(Squire\Commands\Processor\Entity\Address::class, $this->address);

        /** @var Squire\Entity\Property\Schema $schema */
        $schema = $this->dispatchFromArray(Squire\Commands\Processor\Entity\Property\Schema::class, $this->schema);

        $property->name = $this->name;
        $property->address_id = $address->id;
        $property->schema_id = $schema->id;

        $property->save();

        /** @var Squire\Entity\Portfolio $portfolio */
        $portfolio = Squire\Entity\Portfolio::findBySlug(session('portfolio.slug'));

        if( !$existed ){
            $portfolio->properties()->attach($property);
        }

        return $property;
    }

As long as the commands are not set to queue then you shouldnt have any async issues.

14 Apr
4 years ago

MattCroft left a reply on What To Buy As A Phone?

I personally don't use my phone for web development, i would just use chrome dev tools unless a client tells me of a specific issue on a specific phone and then i may consider looking on an actual phone.

09 Apr
4 years ago

MattCroft left a reply on How To Extend Guard Class Logout Function

I have extended the logout function within the AuthController to flush the Session's as it didnt appear to do this by default.

   /**
     * Log the user out of the application.
     *
     * @return \Illuminate\Http\Response
     */
    public function getLogout()
    {
        $this->auth->logout();
        \Illuminate\Support\Facades\Session::flush();
        return redirect('/');
    }
07 Apr
4 years ago

MattCroft left a reply on Laravel 5: Multiple User Authentication System

Do you have the controller setup in the routes.php?

MattCroft left a reply on Laravel 5: Multiple User Authentication System

Sounds like you have a table called administrator and a plural version referenced in the model?

Can you check to make sure the names of the tables match?

01 Apr
4 years ago

MattCroft left a reply on Service Providers Not Loading In Web State

No i never figured out why it didn't work, i think it was down to the 5.0.16 update and the file path changes for services.json etc.

http://laravel.com/docs/5.0/upgrade#upgrade-5.0.16

It magically started working for me when i was trying to figure out the issue.

26 Mar
4 years ago

MattCroft left a reply on Whats Your Preferred Pattern For Lists In A String

You could also use "join", although its an alias of implode; just think of those 3 extra characters you can type else where... :)

17 Mar
4 years ago

MattCroft left a reply on Service Providers Not Loading In Web State

Also on another note, when i use artisan tinker my service provider is loaded. I can access it through the container.

MattCroft left a reply on Service Providers Not Loading In Web State

I have the deferred set to false which should force it to load if I'm not mistaken.

All the service provider is at the moment is foo bar nonsense.

There is nothing i can see that would stop it from loading in the web state, its a fresh laravel project nothing else has changed. No Kernal alterations or anything.

MattCroft started a new conversation Service Providers Not Loading In Web State

Hello,

I have a bit of a issue with Service Providers and I'm now stumped...

So i have an external package that I'm developing and i have composer'd it into my project fine, that part is all working as it should, i have set my autoload psr-4 namespaces in my composer.json etc.

The issue I'm having is Laravel is not loading my Service Provider in the Web State, its registered in the app.php in the providers array.

However if i was to put a "dd" in my boot or register method in the Service Provider i get nothing displayed within the browser. But if i then run "php artisan" the "dd" then appear and stop the application and i see output.

Any ideas on what could be causing these issues? Did i miss something?

11 Mar
4 years ago

MattCroft left a reply on [Off Topic] Mac Or PC For Development

I had developed on PC for a number of years, but i think i only stood for it for so long because i had access to a dev server. Therfor only required certain tools on windows and everything else could be done through Putty.

I bought a MBP last year and have been developing on that for the majority of my personal stuff since, the difference between the two platforms i didnt find that much of a big deal, however the Mac does seem to have an easier flow to development, so i would always suggest one or atleast a unix based system.

07 Mar
4 years ago

MattCroft left a reply on Forge Isn't Creating My Site Directory

Hi, Thanks for the reply.

I rebuilt the box and tried to replicate the scenario to see if i could get it to happen again with no luck, something weird must of happened.

However rebuilding the box seemed to resolve the issue.

06 Mar
4 years ago

MattCroft started a new conversation Forge Isn't Creating My Site Directory

Hello,

I have an account on Forge, i have set up a server on Linode and it has provisioned etc, however i'm now trying to deploy my site, but when i create the site inside Forge it does not create the directory on the box.

The site does get created in Forge itself and i can attempt to deploy my project but when i view the deployment log it shows this.

/home/forge/.forge/provision-1118012.sh: line 1: cd: /home/forge/sub.domain.co.uk: No such file or directory fatal: Not a git repository (or any of the parent directories): .git Composer could not find a composer.json file in /home/forge To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section Could not open input file: artisan

The only thing i did when the box booted was delete the default site. I have done this before on my other boxes and not had an issue.

Quite stuck, i don't want to manually create the site on the box. I am currently re-provisioning the box, maybe it was a dodgy build.

Anyone encountered this before or have any Ideas?