Admin-Dash uses Admin LTE for Laravel 5.4

Access all articles in sprocket icon.

Published February 26, 2017 by Bill Keck.

Admin-Dash uses Admin LTE for Laravel 5.4

I built an admin panel implementation for Laravel 5.4 using Abdullah Almsaeed’s amazing  Admin LTE template.  I’ve made this starter application available for free on github:

Admin-Dash

On the admin panel itself, I’ve pulled in all the examples, including:

  • Layout Options
  • Widgets
  • Charts
  • UI Elements
  • Forms
  • Tables
  • Calendar
  • Page Examples
  • Documentation

You can reference everything from within the application.  This includes cool plugins like flot charts and map integrations.  Just go to the github page for a screen shot of the panel itself. You can learn a lot by playing with this template and looking at how things are implemented.

In addition to all the amazing plugins you get out of the box with Admin LTE, I’ve also incorporated one-click social sign in for Facebook and Github.  I also created some examples, using Vue.js for datagrids with paginated, sortable, and searchable data columns.

If you are familiar with my book, Laravel 5.4 For Beginners, you will recognize many of the implementations from there.  On the other hand, things are a little more complicated.  For example, we use 3 master pages:

  • guest
  • auth
  • admin

And there are lot of partials to go along with them.  Doing it this way gives us a lot of flexibility over managing assets and cuts down on a lot of if statements in the views that would otherwise check to see if the user was a guest, logged in, or logged in as admin.

I’ve become a big fan of view partials.  For example, even if a form is simple, I extract it out to a partial.  This really helps with code separation, since I can dedicate the main view files to layout instead of logic.  It also has the effect of making the code so much more readable, helping with maintainability.

Also in this implementation, I extracted out some child components for the datagrids in Vue.js, which cuts down on code repetition.   I got rid of the big ugly handler for all the queries and put in a utilities file.

Those are all extras, however, and you are free to use or not use them as you wish.  The main focus was in pulling in the main Admin LTE template in a Laravel starter application that is a great starting point for building something.

The github page includes github instructions for forking Admin-Dash, so you can pull the repo into your github account and play with it from there.  I also included installation instructions for the app key, .env file, and a few other settings that you will need.

Thanks again to everyone who is supporting my work by purchasing my book.  Also, I’m happy to report we got our first ratings, which all came in at 5 stars.

Please leave a rating or review at GoodReads.com, it will help get the word out for the book, I really appreciate it.

 

 

 

 

 

Advertisements

Dependent Dropdown Form Vue.js and Laravel 5.4 For Beginners

Access all articles in sprocket icon.

Published February 14, 2017 by Bill Keck.

Dependent Dropdown Form Vue.js and Laravel 5.4

I have officially released chapter 15 of Laravel 5.4 For Beginners today on Valentine’s Day.  This bonus material is free for anyone who has purchased the book.  Updates to the book are free for the life of the book, one of the great things about the leanpub.com platform.

With the release of chapter 15, it brings the page count to over 900 pages.  It may be 900 pages, but it’s a gentle 900 pages, generous with screenshots and code.

Chapter 15 focuses on a robust example of dependent dropdown lists on a form.  We set up all models, so the data for the lists can be pulled into the form, which uses a custom Vue.js component to enforce the dependency.

In the chapter we work on a Lesson model, which has a category and a subcategory.  The subcategory belongs to a specific category, so we only want to show the subcategories that belong to it in the form.  By explicitly naming the parent/child as category and subcategory, it makes it easy to follow and keep track of which one is the child.

We also want to enforce the dependency through server-side validation, which prevents the form from being spoofed.  Projects tend to eventually  have some kind of complicated validation, so we walk through the options for creating that.  It turns out it’s pretty simple to do.

A lot of my readers have bought my previous books, and this puts a lot of pressure on me, when I do a new release, to make the new book worth purchasing.

With that said, here is some of what is covered in this book that is new to this book:

  • Laravel Mix (Replaces Elixer)
  • Events
  • Sending Mail and the new Markdown features
  • Service Container
  • Service Providers
  • Dynamic Facades
  • Query Scopes
  • Real-time Chat with Laravel Echo, Vue.js, and Pusher
  • Custom command to run as cron to cleanup old chat messages
  • Dependent Dropdown list on form with Vue.js

If you add to that list the data grids we build in Vue.js, you can see that you get a fair amount of Vue.js included in this book.  That’s a trend I see continuing for the foreseeable future, since Vue.js is so easy to work with and an application without javascript is not likely to be very interesting.

Laravel 5.4 For Beginners is no substitute for a dedicated book on Vue, my favorite for that is The Majesty of Vue 2, but Laravel 5.4 For Beginners can help you get up and running, teach you the basics, and help you take advantage of some of the really cool reactivity we can create with Vue.

Other fundamentals we cover are image management, access control, middleware, and one-click Facebook sign in and registration with Socialite.  My goal is to help you advance your programming knowledge, so that if you start the book as a beginner, you end it being more intermediate.

I’ve always felt that programming is a journey that Laravel makes more pleasant and productive, and I’m happy to share that journey with you.

Thanks again to everyone who is supporting my work by purchasing the book.  Please leave a rating or review at GoodReads.com, it will help get the word out for the book, I really appreciate it.

 

 

 

 

 

 

 

 

Laravel 5.4 For Beginners Bonus Chapters Released

Access all articles in sprocket icon.

Published February 6, 2017 by Bill Keck.

Laravel 5.4 For Beginners Bonus Chapters Released

Chapters 13 and 14 have been added to the Laravel 5.4 for Beginners book.  The book is now 745 pages in length.

Anyone who has purchased the book can download the updated version for free, by logging into their Leanpub.com account.  All updates are free for the life of the book.

In chapter 13, we cover sending mail and events.  We work up an email that we send to registered users, when they complete registration.  We also explore the different composition tools for creating mail, including the new markdown features, which really help us make a pretty email, with almost no effort.

We also cover events and listeners, and to demonstrate, we convert our simple mail message to an event, using artisan’s event:generate command.  Eventing is a powerful design pattern and we cover it a way that is easy to grasp for beginners.

Finally in Chapter 13, we talk a little about Laravel’s amazing architecture.  As I was going through some of the material, I found the following comment from Taylor Otwell, the creator of Laravel, in public/index.php:

We need to illuminate PHP development, so let us turn on the lights. — Taylor Otwell

I liked that quote so much, I made it the dedication to the book.

We learn just how well thought out the architecture is when we start looking at the service container, service providers, and automatic injection.

In chapter 14, we build a working chatroom, using Laravel Echo, Vue.js, and Pusher.  It’s not super fancy, but it does have realtime updates, changing the room count when people enter and leave, and of course updating all messages for all users in realtime.

This chapter introduces us to Laravel Echo and Pusher, which we have not used previously, but also gives us the opportunity to work with nested Vue components.

We also start to work with ES6, also known as EchmaScript 2015, which is the latest version of javascript.  If you are not familiar with ES6, don’t let that put you off.  I take it line by line to explain that syntax when we use it.  Turns out it’s pretty intuitive.

In chapter 14, we also build a console command that deletes database records, so our chat application doesn’t overwhelm our DB with too many records.  We need to maintain it, so we learn how to schedule the command twice a day, so a cron can run them.

For those who follow my work, these are additions that were not covered in previous versions of the book.  Every time there is a new release of Laravel, I have to rewrite the book because of the many small changes that happen.  It’s a lot of work.  And sometimes there is a big change, like the move to Laravel Mix and dropping Elixir.

I strive to make the new versions of the book appealing to both readers who are just starting with Laravel and for those who have read the previous versions.

Thanks again to everyone who has supported my work, I really appreciate it.  I look forward to continuing the learning journey with you.