nate.a.johnson

nate.a.johnson

Fort Wayne, Indiana

Member Since 4 Years Ago

Experience Points 35,720
Experience
Level
Lessons Completed 586
Lessons
Completed
Best Reply Awards 21
Best Answer
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.

03 Dec
2 weeks ago

nate.a.johnson started a new conversation Proper Queue Usage?

Hi all -

I am pretty new to queues and jobs but need to start taking advantage of them given they are pretty great out of the box in Laravel. I run my apps with Forge and Envoyer and have Laravel Horizon set up and running great. The jobs appear to be working just fine.

My question: I need to send large numbers of slack messages to forum members quite regularly. Is it better to:

A) dispatch a job for every message or

B) use one job that will iterate over a bunch of accounts, firing off a bunch of slack messages in that single job.

As I am typing this (A) seems like the better approach as (B) could probably time out. It would mean my queues could have 1000s of jobs in them, but hey are all really tiny.

Anyone have advice for me?

Thanks, Nate

31 May
6 months ago

nate.a.johnson started a new conversation Favorite Testing Methodology?

Seems like there are always new ways to test. Anyone have a good set of rules they follow, set of libraries or frameworks they like, etc? My app is all Laravel on the backend (mainly just APIs) and a large single page app on the frontend built with Vue2, Vuex, and Vue Router. Only one blade file in the entire app as a starting point for Vue to take over.

Thanks!

09 May
7 months ago

nate.a.johnson left a reply on Refused To Execute Script From ''<js File> Because Its MIME Type ('text/html') Is Not Executable, And Strict MIME Type Checking Is Enabled.

I think I figured out my issue. Webpack, via code splitting, is trying to pull in a chunk from an previously released version of the site. I just happened to be on a page in my site, when to envoyer and deployed, and then clicked on a link that needed a chunck of js from the old release. A page refresh fixes it, but I'd like a cleaner solution, like presenting a modal to the user telling them that the app is out of date and the browser should be refreshed or something along those lines.

nate.a.johnson left a reply on Refused To Execute Script From ''<js File> Because Its MIME Type ('text/html') Is Not Executable, And Strict MIME Type Checking Is Enabled.

@Roni I am running into this now. Did you ever figure this out? It seems like a webpack thing with laravel mix running in production mode.

28 Nov
1 year ago

nate.a.johnson left a reply on Testing Vue Global Variables

A bit more. I think I need to figure out some way to mock or stub userEventTypeOptions so that the test framework knows about it.

nate.a.johnson started a new conversation Testing Vue Global Variables

Hello,

I am going through the Testing Vue series right now and things work great in there with small examples. Now I am trying to apply it to my current application, which has quite a few more moving pieces. I am running into an issue where Mocha can't find a global variable. The reason is that there is a script section at the bottom of my app.blade.php layout file that puts some variables into global memory for the Vue components to use once they get mounted. This code executes on the server using PHP, as any normal Laravel app does. Has anyone else figured out a good way to make this work?

 WEBPACK  Compiled successfully in 2082ms

 MOCHA  Testing...

 RUNTIME EXCEPTION  Exception occurred while loading your tests

ReferenceError: userEventTypeOptions is not defined
    at Object.<anonymous> (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:47709:46)
    at __webpack_require__ (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:20:30)
    at Object.defineProperty.value (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:36935:16)
    at __webpack_require__ (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:20:30)
    at Object.<anonymous> (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:36798:22)
    at __webpack_require__ (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:20:30)
    at Object.disposed (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:36750:16)
    at __webpack_require__ (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:20:30)
    at run (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:18459:20)
    at Array.forEach (native)
    at Object.<anonymous> (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:18466:24)
    at Object.<anonymous> (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:18467:30)
    at __webpack_require__ (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:20:30)
    at /Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:63:18
    at Object.<anonymous> (/Users/nate/Code/bluesky/.tmp/mocha-webpack/1511894009397/bundle.js:66:10)
    at Module._compile (module.js:570:32)
    at Object._module2.default._extensions.(anonymous function) [as .js] (/Users/nate/Code/bluesky/node_modules/mocha-webpack/lib/util/registerRequireHook.js:147:12)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at /Users/nate/Code/bluesky/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (native)
    at Mocha.loadFiles (/Users/nate/Code/bluesky/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/Users/nate/Code/bluesky/node_modules/mocha/lib/mocha.js:514:10)
    at /Users/nate/Code/bluesky/node_modules/mocha-webpack/lib/runner/TestRunner.js:198:25
    at Compiler.<anonymous> (/Users/nate/Code/bluesky/node_modules/mocha-webpack/lib/webpack/compiler/registerReadyCallback.js:26:7)
    at Compiler.applyPlugins (/Users/nate/Code/bluesky/node_modules/tapable/lib/Tapable.js:61:14)
    at emitRecords.err (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:268:11)
    at Compiler.emitRecords (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:375:38)
    at emitAssets.err (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:262:10)
    at applyPluginsAsyncSeries1.err (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:368:12)
    at next (/Users/nate/Code/bluesky/node_modules/tapable/lib/Tapable.js:218:11)
    at Compiler.compiler.plugin (/Users/nate/Code/bluesky/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
    at Compiler.applyPluginsAsyncSeries1 (/Users/nate/Code/bluesky/node_modules/tapable/lib/Tapable.js:222:13)
    at Compiler.afterEmit (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:365:9)
    at require.forEach.err (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:354:15)
    at /Users/nate/Code/bluesky/node_modules/async/dist/async.js:421:16
    at iteratorCallback (/Users/nate/Code/bluesky/node_modules/async/dist/async.js:998:13)
    at /Users/nate/Code/bluesky/node_modules/async/dist/async.js:906:16
    at MemoryFileSystem.writeFile (/Users/nate/Code/bluesky/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
    at writeOut (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:343:28)
    at require.forEach (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:349:12)
    at /Users/nate/Code/bluesky/node_modules/async/dist/async.js:3083:16
    at eachOfArrayLike (/Users/nate/Code/bluesky/node_modules/async/dist/async.js:1003:9)
    at eachOf (/Users/nate/Code/bluesky/node_modules/async/dist/async.js:1051:5)
    at Object.eachLimit (/Users/nate/Code/bluesky/node_modules/async/dist/async.js:3145:5)
    at emitFiles (/Users/nate/Code/bluesky/node_modules/webpack/lib/Compiler.js:319:21)
    at Immediate.<anonymous> (/Users/nate/Code/bluesky/node_modules/memory-fs/lib/MemoryFileSystem.js:288:4)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

Thanks!

13 Oct
1 year ago

nate.a.johnson left a reply on Preparing To Deploy - Cloudways Vs Forge Vs InmotionHosting

Forge all the way. Cloudways is a shady company... just ask Adam Wathan or Matt Stauffer what they think of being misrepresented by the company.

31 Aug
1 year ago

nate.a.johnson left a reply on Deploys Via Envoyer Fail And Point To An Old Release (at Least Partially)

For anyone with this problem, in Envoyer you can edit your server, tell it what version of php you are using and if you want it restarted after a deploy. Mine was still set to an old version of PHP and upgraded since I built the box with Forge.

nate.a.johnson left a reply on Deploys Via Envoyer Fail And Point To An Old Release (at Least Partially)

I found that php was holding on to references to the old site in memory. Running this fixed it.

sudo service php7.1-fpm restart

I don't know if envoyer doesn't restart php 7.1 properly. I think it used to restart php 7.0 before the upgrade. Maybe the envoyer scripts need to be updated similarly?

nate.a.johnson started a new conversation Deploys Via Envoyer Fail And Point To An Old Release (at Least Partially)

I'm having a weird issue. My setup is on Linode via Forge and hot deployed with Envoyer -- so a complete Taylor-made stack.

Sometimes I deploy and the current symlink gets moved to the latest release as it should, but I refresh the page and my CSS and JS that gets compiled via Mix has the wrong hashes in the file names. They are from a previous release.

I've tried running all of the artisan clear commands and none of them help. I restart nginx with zero luck. I can even delete the current synlink and the site keeps on working, so that is concerning. The only thing I have found so far to fix it is to reboot the entire Linode and that is definitely not ideal. So it looks like something is getting stuck in memory somewhere, but I don't know where.

Anyone ever see anything like this?

Thanks!

24 May
1 year ago

nate.a.johnson left a reply on Creating An API Wrapper - How Would You Do It?

@tekmi thanks for the great advice! It looks like the Bill.com API has changed a good bit since the old package was released, so I don't think there is much to harvest there. I like the rest of your ideas though.

nate.a.johnson started a new conversation Creating An API Wrapper - How Would You Do It?

Hi all,

I need to build a wrapper on Bill.com's old rest API to do things like customer creation, credit card and ACH collection, invoicing, etc. We can't use Stripe and from what I can tell there isn't a library out there for this service other than a github repo from a few years back that has only a handful of commits.

I see options like using curl or guzzle in a nice Laravel wrapper, but I'd love to hear what others have done for something similar. I've done a bit of digging into the Stripe PHP library and a similar approach to what they have done is an option as well.

Thanks all!

Nate

25 Jan
1 year ago

nate.a.johnson left a reply on Laravel Mix With HMR

Well, this appears to work as long as you don't tell mix to version your files.

nate.a.johnson started a new conversation Laravel Mix With HMR

I am getting this error:

Cannot use [chunkhash] for chunk in '/js/[name].[chunkhash].js' (use [hash] instead)

I am just using it vanilla, so I'm not sure what is going on. Anyone else seeing this?

27 Sep
2 years ago

nate.a.johnson left a reply on Getting Data From API For Multiple Resources

Sounds like you might want to look into graphql. There's even a laravel backend for it.

21 Sep
2 years ago

nate.a.johnson left a reply on I Am Stuck In This Error

Post your code.

nate.a.johnson left a reply on Virtual Box After Updating OS

Sorry, I don't know.

nate.a.johnson left a reply on Virtual Box After Updating OS

Some people have had to reinstall virtual box and vagrant before Sierra works.

nate.a.johnson left a reply on Added Column, Not Being Registered By Create Method

Post your model here. My guess is you did not add author as a fillable field and Laravel is ignoring it for security reasons.

nate.a.johnson left a reply on Scaling

It could mean a lot of different things... here's one person's take on it:

https://www.scalingphpbook.com

nate.a.johnson left a reply on How To Load Assets Into Laravel 'properly'

Your question is pretty open and there are dozens of ways to do it. A fresh Laravel 5.3 application has it set up to build your css and javascript assets with gulp and elixir out of the box. Assuming you are a Laravel user, take a look at how it's done in there.

nate.a.johnson left a reply on Laravel 5.3 - Error With "npm Install Laravel-elixir"

Delete your node_modules. Make sure you have node 6 and npm 3. Reinstall your dependencies and try again.

nate.a.johnson left a reply on Authentication Guard With External Accounts Server

Sounds like you are trying to build your own SSO+AuthZ solution, similar to Auth0 (https://en.wikipedia.org/wiki/Auth0) -- there are literally 100's of offerings out there like it, some free and some not. You might take a look at how some of the other open source solutions accomplish what you are trying to do.

nate.a.johnson left a reply on Deployment Tools

Lots of good stuff here if you don't mind giving Chris a few bucks...

https://deploy.serversforhackers.com/

He also has free videos at https://.serversforhackers.com/ and quite a few cover deployment techniques as well.

nate.a.johnson left a reply on Laravel API Update Endpoint And Vue Resource

Open up dev tools in chrome and look at your network console. If you are getting into your error callbacks, you will typically see a red entry in the networks logs for it because it is returning a non-200 result. You can click on it to further see the error code and even the exact data being returned from your API.

20 Sep
2 years ago

nate.a.johnson left a reply on Forgive Me, Once Again..

And make sure you run that command from inside the directory you install laravel in.

nate.a.johnson left a reply on Every Vue Component Complied By Webpack Is A Fragment

That's when you need to break it into separate entry points, like admin.js, profile.js, page1.js, page2.js, etc but every file shouldn't be its own like you are doing above or you will completely miss the biggest benefits of using something like elixir and web pack all together. Or you can read up on webpack code splitting which is really cool and about as efficient as you can get, but it's complicated.

nate.a.johnson left a reply on Every Vue Component Complied By Webpack Is A Fragment

Looks like you are telling everything to be a fragment by compiling them individual. A typical app will just run webpack on entry points (test-app.js or app.js) and in the entry point just import/require your components. Webpack will do the rest of the magic for you. That said, I just write my own webpack config because there are so many dependancies in elixir that it breaks for my apps more than it works. I've posted my webpack config in other threads if you are looking for a different way to do it. I do still use elixir, but just for my sass.

19 Sep
2 years ago

nate.a.johnson left a reply on Do We Need To Require Minified Version Of Script?

You don't typically want to use min version to develop with in case you need to debug into them and you don't have proper source maps. The production flag should strip everything you don't need out of the files, concatenate them, and minify them. I don't use gulp for my javascript because it's very opinionated (not a bad thing in general) but I want full control of my javascript and will be adding things like code splitting via web pack.

Here's my web pack config if you want to play around with something similar and not have to deal with all the bugs that keep creeping into elixir.

var path = require('path')
var webpack = require('webpack')
var projectRoot = path.resolve(__dirname, '../')

module.exports = {
  entry: './resources/assets/js/app.js',
  output: {
    path: path.resolve(__dirname, './public/js'),
    publicPath: '/public/js/',
    filename: 'app.js'
  },
  resolveLoader: {
    root: path.join(__dirname, 'node_modules'),
  },
  module: {
    loaders: [
      {
        test: /\.vue$/,
        loader: 'vue'
      },
      {
        test: /\.js$/,
        loader: 'babel',
        exclude: /node_modules/,
        query: {
          compact: true,
          presets: ['es2015'],
        }
      },
      {
        test: /\.json$/,
        loader: 'json'
      },
      {
        test: /\.html$/,
        loader: 'vue-html'
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        loader: 'url',
        query: {
          limit: 10000,
          name: '[name].[ext]?[hash]'
        }
      }
    ]
  },
  devServer: {
    historyApiFallback: true,
    noInfo: true
  },
  devtool: '#eval-source-map'
}

if (process.env.NODE_ENV === 'production') {
  module.exports.devtool = '#source-map'
  // http://vue-loader.vuejs.org/en/workflow/production.html
  module.exports.plugins = (module.exports.plugins || []).concat([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"'
      }
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    }),
    new webpack.optimize.OccurenceOrderPlugin()
  ])
}

nate.a.johnson left a reply on Do We Need To Require Minified Version Of Script?

If you are using gulp and elixir out of the box, just run:

gulp --production

and all of your js and css will be concatenated and minified.

17 Sep
2 years ago

nate.a.johnson left a reply on Can't Login After Upload To Forge

Have you registered an account in the database that forge is managing?

15 Sep
2 years ago

nate.a.johnson left a reply on Gulp Command Fails Looking For Buble Package?

Be careful installing anything globally. You will probably run into issues in other projects down the line that you forgot you installed an old dependency globally. The only thing I would install globally is a command line install tool, and that can still lead to issues.

Don't just run commands blindly, you will regret it later if you don't know what you are doing. Also don't run them with sudo... if you need sudo, you probably just don't have your permissions set up appropriately.

09 Sep
2 years ago

nate.a.johnson left a reply on Laravel Subscriptions

Stripe is amazing for recurring payments.

nate.a.johnson left a reply on I Was Wondering What Your Experience Was Like Switching To Zurb?

Love it, but every resource seems to be ready for bootstrap, even the out of the box laravel views. It's too bad because I think it's way better than bootstrap. I used it for a project for over two years. Rewriting it now since it's stuck on laravel 4 and just gave in to using bootstrap this time around.

nate.a.johnson left a reply on Console Command Called From The Web Dies Early

Lastly, all you'd need to do is create a table, and when the admin starts a job, insert a flag in the table. Then the task can just look at that table every minute, and if the flag is set, go! When done remove the flag. Basically just simple job queuing.

nate.a.johnson left a reply on Console Command Called From The Web Dies Early

I run the scheduler with jobs all the time but I've never once used a queue. It's just a cron job that kicks of one of your commands.

nate.a.johnson left a reply on Where Should I Deploy My New App?

AWS will give you the most flexibility and almost instantaneous scaling but it's complex. I tend to go with linode. You can resize your server, etc but it usually takes 20 minutes or so.

nate.a.johnson left a reply on Console Command Called From The Web Dies Early

I don't know why you'd want to rush it timing out or why you'd want a browser to hang for 30 minutes. Your begging for all kinds of trouble. Just let the admin click a button that puts a job in the queue to run immediately. The have the schedule look for those types of jobs every minute. You could even have a page that lets the admin know the job is running or send an email/slack notification when done.

nate.a.johnson left a reply on Do You Use XDebug?

In a past life I lived in a debugger while doing Java for about 10-12 years. Couldn't live without it. I gave PHP Storm and xdebug a go for awhile but just gave up on it... just wasn't as polished as Java debugging tools. I personally love sublime too much to go back to a big IDE for PHP.

08 Sep
2 years ago

nate.a.johnson left a reply on App\Http\Controllers\Auth Not Found.

You need to add a use statement at the top or use the helper function auth() in place of the facade.

nate.a.johnson left a reply on Session In The Constructor

There's not really enough info here to demonstrate your problem. I've built fully multi-tenant apps without ever needing to touch a constructor, so it is possible. It all depends on how you architect your application.

nate.a.johnson left a reply on Laravel Collective Form Inside Vue Components

I don't think it's possible, not a true SPA in the traditional definition. Vue is a client side solution (though you can do universal apps with Vue 2) and Blade/Laravel Collective is server side.

nate.a.johnson left a reply on Real Time Web App Listen To Typing Event

This book might be of use... the example app, directly linked below, is a real time chat app with pusher and laravel.

https://pusher-community.github.io/real-time-laravel/chat/chat.html

nate.a.johnson left a reply on Laravel Framework File Permission - Security

It's never safe to make things world writeable and world executable. I'd try to avoid that unless absolutely necessary. For example, even if you are on a private server, if you allow uploads to a folder that is 777, a hacker could upload a script, execute it and really do just about anything they wanted to do.

Just be safe when setting up your permissions.

nate.a.johnson left a reply on Replace Component OnClick

@edoc nice example. That said, I'd probably use something like vue-router when you get to that point. It does lots of nice things for you rather than you writing a bunch of custom code, component transition animations being just one.