nate.a.johnson

Experience

32,440

22 Best Reply Awards

  • Member Since 3 Years Ago
  • 556 Lessons Completed
  • 53 Favorites

13th October, 2017

nate.a.johnson left a reply on Preparing To Deploy - Cloudways Vs Forge Vs InmotionHosting • 5 days ago

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.

31st August, 2017

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

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) • 1 month ago

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) • 1 month ago

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!

24th May, 2017

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

@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? • 4 months ago

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

25th January, 2017

nate.a.johnson left a reply on Laravel Mix With HMR • 8 months ago

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 • 8 months ago

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?

27th September, 2016

nate.a.johnson left a reply on Getting Data From API For Multiple Resources • 1 year ago

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

21st September, 2016

nate.a.johnson left a reply on I Am Stuck In This Error • 1 year ago

Post your code.

nate.a.johnson left a reply on Virtual Box After Updating OS • 1 year ago

Sorry, I don't know.

nate.a.johnson left a reply on Virtual Box After Updating OS • 1 year ago

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 • 1 year ago

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 • 1 year ago

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' • 1 year ago

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" • 1 year ago

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 • 1 year ago

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 • 1 year ago

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 • 1 year ago

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.

20th September, 2016

nate.a.johnson left a reply on Forgive Me, Once Again.. • 1 year ago

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 • 1 year ago

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 • 1 year ago

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.

19th September, 2016

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

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? • 1 year ago

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.

17th September, 2016

nate.a.johnson left a reply on Can't Login After Upload To Forge • 1 year ago

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

15th September, 2016

nate.a.johnson left a reply on Gulp Command Fails Looking For Buble Package? • 1 year ago

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.

9th September, 2016

nate.a.johnson left a reply on Laravel Subscriptions • 1 year ago

Stripe is amazing for recurring payments.

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

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 • 1 year ago

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 • 1 year ago

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? • 1 year ago

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 • 1 year ago

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? • 1 year ago

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.

8th September, 2016

nate.a.johnson left a reply on App\Http\Controllers\Auth Not Found. • 1 year ago

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 • 1 year ago

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 • 1 year ago

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 • 1 year ago

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 • 1 year ago

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 • 1 year ago

@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.

nate.a.johnson left a reply on Replace Component OnClick • 1 year ago

Sounds like you might want something like v-show. Would be a lot easier than trying to dynamically bring in a new template/component (if that's even possible).

https://vuejs.org/guide/conditional.html

nate.a.johnson left a reply on Storing Users • 1 year ago

I was leaning more towards events, sorry, wrong hash:

https://laravel.com/docs/5.3/eloquent#events

Anyway, at the time the created event is fired, the model will be saved. You can look at it to determine if you need to send the email, right? If so, do it.

nate.a.johnson left a reply on Middleware For Multi Tenant Auth Using 5.3 • 1 year ago

It doesn't sound like this has anything to do with multi-tenancy, but rather restricting access to a subset of your pages so that only admins can access them.

Read through the middleware documentation:

https://laravel.com/docs/5.3/middleware

All you need to do is make a middleware that checks if the user is admin and wrap all the routes that are admin routes in that middleware.

7th September, 2016

nate.a.johnson left a reply on Storing Users • 1 year ago

You could hook into the created hook:

https://laravel.com/docs/5.3/eloquent#observers

At the that point the model will be saved and you will know if you should send the email or not.

nate.a.johnson left a reply on How To Add CsrfToken When Using Laravel And Vue-resource? • 1 year ago

It can go anywhere. I put mine in my app.js file, which is the entry point for web pack to build my app. It's an interceptor, so as long as it is defined somewhere, it will always be called on every request to add that token.

nate.a.johnson left a reply on Bye Bye Windows... Hm, Now What? • 1 year ago

Work bought mine or I wouldn't have spent that much myself either.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.