scottzirkel

scottzirkel

Member Since 2 Years Ago

Medina, Texas

Creative Director at Alara Creative

Experience Points 46,070
Experience Level 10

3,930 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 458
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 Feb
1 month ago

scottzirkel left a reply on Laravel Validation - Check If A Column Exists

@CROSSMAR - I didn't in my code, must have been some weird copy & pasting thing.

17 May
10 months ago

scottzirkel left a reply on Laravel Validation - Check If A Column Exists

You could build an array of the names of the columns you want to drop, if they exist, then pass that through to dropColumn.

$columns = [];

if (Schema::hasColumn('users', 'email'));
    {
        array_push($columns, 'email');
    }

if (Schema::hasColumn('users', 'age'));
    {
        array_push($columns, 'age');
    }

Schema::table('users', function (Blueprint $table) use ($columns) {
    $table->dropColumn($columns);
});
19 Apr
11 months ago

scottzirkel left a reply on Phpunit Test Not Running With Multiple Database Setup

I haven't been able to work on it in a while (paying clients really get in the way of personal projects), but I'm pretty certain when I do revisit, I'm just going to start over with a different approach.

Here's my connect function, it's in a helpers.php file I created. Not the best spot for it, I just kind of stuck it there while trying it out.

if (!function_exists('tenant_connect')) {
    function tenant_connect($hostname, $username, $password, $database)
    {
        DB::purge('tenant');

        Config::set('database.connections.tenant.host', $hostname);
        Config::set('database.connections.tenant.database', $database);
        Config::set('database.connections.tenant.username', $username);
        Config::set('database.connections.tenant.password', $password);

        DB::reconnect('tenant');

        Schema::connection('tenant')->getConnection()->reconnect();
    }
}

The disconnect is just another purge of tenant and a reconnect to the default connection.

Like I said, pretty crude, but it does get the job done, outside of testing migrations that is.

08 Mar
1 year ago

scottzirkel left a reply on Phpunit Test Not Running With Multiple Database Setup

Ah! Yeah you can't have foreign keys referencing across two dbs.

After posting my solution, my sqlite tests started to fail, so that's fun. You can safely ignore me it seems.

scottzirkel left a reply on Phpunit Test Not Running With Multiple Database Setup

I have a similar setup, only in my RefreshDatabase I am explicitly connecting to my tenant's database.

This is my refreshInMemoryDatabase() method:

protected function refreshInMemoryDatabase()
    {
        $this->artisan('migrate');

        $tenants = TenantModel::all();

        $tenants->each(function ($tenant) {
            $tenant->connect();
            Artisan::call('migrate', [
                '--database' => 'testing',
                '--path'     => 'database/migrations/tenant'
            ]);
            $tenant->disconnect();
            $this->app[Kernel::class]->setArtisan(null);
        });
    }

I have a connect & disconnect method on my tenant model that sets the config for the tenant connection & resets it to the main respectively.

I do the same thing in the refreshTestDatabase() method.

22 Dec
1 year ago

scottzirkel left a reply on How To Use Google Nginx Pagespeed Module For Optimize CSS Delivery In Laravel 5.4 On Forge

I've been trying to get it working, but so far, all I've gotten are either errors or a successful install that still doesn't have the pagespeed module. I feel like I'm missing something. Not sure if it's related to the servers being on Forge or not.

29 Sep
2 years ago

scottzirkel left a reply on How To Use Dropzone.js When Creating A NEW Post In Laravel?

Here's what I did to make it work. Not sure if it'll work for every case, but it does what I need it to.

The user can upload images and fill out the form fields in any order. When they drop the images into dropzone, they aren't uploaded right away, they are just queued up. When they hit submit, the Vue component creates the post and sets the Post-Id as a header variable, which gets sent with the image file. That way I have the id & the file data all arriving to the same place at the same time.

The dropzone area does not have to be in the form element for this to work.

Just make sure to return the post from your PostController store method (or whatever you are using to save the Post).

Here's a mockup of the component:

var Dropzone = require('dropzone');
Vue.component('createPost', {
    data() {
        return {
            form: {},
            dropzone: '',
        }
    },
    ready() {
        this.initDropzone();
    },
    methods: {
        initDropzone() {
            Dropzone.autoDiscover = false;
            this.dz = new Dropzone("#addPost", {
                url: '/post',
                autoProcessQueue: false,
            });
        },
        create() {
            var self = this;
            this.$http.post('/post', this.form)
                .then(response => {
                    this.dz.options.headers = {'Post-Id': response.body.post_id};
                    this.dz.processQueue();
                });            
        }
    }
});