Laravel 5.3 For Beginners Updated for Vue 2

Access all articles in sprocket icon.

Published October 23, 2016 by Bill Keck.

Laravel 5.3 For Beginners Updated for Vue 2

I’m happy to announce that Laravel 5.3 has been updated to use Vue 2.0.1, which is the current release of Vue.js. I’ve also added a couple of chapters that cover basic and advanced use of Foundation Maker, a free artisan plugin, giving you new artisan commands for code generation.

Updates to the book are free for the life of the book, just log in to your account, and pull down the latest copy.

The update to Vue 2 was a hectic one for me, it came just as I released the first version of Foundation Maker, so I really had to scramble to not only update the plugin, but also the book.

One issue that came up was that I was unsuccessful in trying to update an earlier version of Laravel, 5.3.10. For some reason I couldn’t get that to work with Vue 2, so I ended up pulling a new install of Laravel, which was on version 5.3.18. Laravel started shipping Vue 2.01 as of Laravel version 5.3.16.

I have quite a few readers who will be caught in the transition, which is why I’m talking about it here. If you are not yet to chapter 11, and you are working with an install of Laravel that is below 5.3.16, then I would recommend doing a fresh install, and quickly copying the work you have already done into the new version. Otherwise the code from chapter 11 on will not work. Sometimes updating is a bit of a pain, but it’s worth it and you will not be disappointed. In the book, we build a fully searchable, sortable, and paginated data grid using Vue 2.

If you want to check the version of Laravel you are using, you can run the following artisan command:

php artisan -V

Staying current on a new release like Vue 2 is very important, in my opinion. There’s no sense in learning a new javascript framework if you are learning on a version that is already outdated. So that was a huge motivator for me to put in the long days and nights to get this update out to you.

The book is now over 700 pages in length. For those unfamiliar with the book, we cover the basics of REST with a front-end and back-end sample app, Socialite and Facebook one-click registration and login, Image management, admin access control, data grids with Vue 2, Foundation Maker, and charts with Charts.js and Vue.js. The book starts at the beginner level and moves towards a more intermediate level with Elixir, node.js and vue.js.

Thanks to everyone who has and is supporting my work. I don’t have a donate button, but if you would like to contribute, you may do so by buying one of my books, I would really appreciate it. Shares, comments, likes, and book reviews are also greatly appreciated. See you soon.

Foundation Maker for Laravel 5.3 Officially Released

Access all articles in sprocket icon.

Published Ocotber 8, 2016 by Bill Keck.

Foundation Maker for Laravel 5.3 Officially Released

Foundation Maker is a free package for Laravel 5.3 that adds 15 new artisan commands, including make:foundation, which let’s you stand up an entire working CURD model and views, with an ajax-powered, searchable, sortable and paginated data grid, written in Vue.js.

Adding Foundation Maker to your Laravel project is a snap. Just use call the following on your command line:

composer require evercode1/foundation-maker

Then add the following to your providers array in config/app.php:


To see the new artisan commands, run the following from the command line:

php artisan list

Then you can parse through and see all the new make commands:

  • make:assets
  • make:master
  • make:crud
  • make:views
  • make:foundation
  • make:child-of
  • make:parent-child

There’s also corresponding remove commands for all commands except make:assets.

Please note, if you are unfamiliar with Foundation Maker, read the docs and tutorial, and note that it works best with a fresh install of Laravel due to the setup of assets. Run npm install after running the make:assets command.

For those of you who have purchased my book, Laravel 5.3 For Beginners, you will recognize the data grid from the book. The big difference is that the book is written using Vue.js 1.0.26, and the Foundation Maker code generator uses Vue.js 2.0.1.

I will be adding a chapter to the book to introduce Foundation Maker and the migration to Vue.js 2, and that update will be free to everyone who has purchased the book. I will be emailing out an announcement when that is ready and then you will be able to pull the latest version of the book.

Previously, for Laravel 5.2, I created a different tool, View Maker, which got over 600 downloads on Creating View Maker was a lot of fun and I learned a lot. But instead of updating that tool, I decided to make a clean break, since the application structure of Laravel 5.3 is different, and Foundation Maker utilizes Elixir and the code it produces is actual production-level code. Foundation Maker is much more efficient and production-ready than View Maker was.

Foundation Maker also has some advanced features that View Maker does not. For example, you have the ability to make your own custom templates and have Foundation Maker use those templates instead of the native ones it ships with. This can be really handy if you want to setup your templates with your own style, which is probably going to be the way to do it most cases.

Let’s say for example, you want to setup your Foundation templates, so that the controller flashes an alert to the view when you create a new record. The native templates don’t have that for the obvious reason that not everyone might want it. Personally, I might use Sweet Alert for that, someone else may choose something else entirely. With the custom templates, you can decide which one to use and simply write it into the template, so every time you create a foundation, it is included automatically.

So you get complete control over the templates, and also, you get to inject custom tokens if you wish, which is another new advanced feature. The tokens get replaced into the template with the actual value of the token. For example, the :::model::: token would return Widget if Widget was the name of your model. You don’t have to worry about the model token, that one is baked in, but if you do have something you want that is not included in the native token list, then you can create your own, which is a very handy feature.

Although Foundation Maker is incredibly easy to use, I’m going to create a video tutorial series for it. I’m also going to be adding a lot more to it, so look for exciting announcements on that.

There are 2 ideas driving my development on Foundation Maker. One is that I want to use artisan commands to manipulate my templates. I like having the code where I would normally put it, instead of a vendor folder. Some of us already use our IDE to create templates. But while you could create templates through your IDE, you can’t really chain them together in the way that Foundation Maker can. When you run make:foundation with Foundation Maker, for example, with that one command, you are creating the following files:

  • model
  • controller
  • api controller (if it does not yet exist)
  • migration
  • unit test
  • Queries folder (if it does not yet exist)
  • GridQueries folder (if it does not yet exist)
  • GridQueries/Contracts folder (if it does not yet exist)
  • GridQuery.php (if it does not yet exist)
  • DataQuery.php (if it does not yet exist)
  • appropriately named model query file
  • appropriately-named view folder
  • index view
  • create view
  • edit view
  • show view
  • Vue.js component file

The make:foundation command also appends to the following files:

  • routes.php
  • ModelFactory.php
  • ApiController (if it already exists)
  • components.js

That’s a lot of power wrapped up in one command. If you use the make:parent-child command, you get double that, one for both the parent and the child.

So the other idea driving my development on Foundation Maker is that I want to reduce the amount of time it takes to create an app. Laravel is an awesome framework, but there are still a lot of things you find yourself doing over and over that could be automated. Towards that end, I’ve only just begun. I want Foundation Maker to be able to help you stand up a full frontend, backend CRUD app in under an hour. It’s kind of a lofty goal, but that’s what I’m aiming for.

I have a lot of work ahead of me. I also plan to support Foundation Maker with free videos on how to use it, so keep an eye out for that announcement.

Thanks to everyone who has and is supporting my work. I don’t have a donate button, but if you would like to contribute, you may do so by buying one of my books, I would really appreciate it. Shares, comments, likes, and book reviews are also greatly appreciated. See you soon.