A laravel validation rules – Check user age with laravel validation rules

Here is the example code for checking the age of an user.

Validator::extend('olderThan', function($attribute, $value, $parameters)
{
    $minAge = ( ! empty($parameters)) ? (int) $parameters[0] : 13;
    return (new DateTime)->diff(new DateTime($value))->y >= $minAge;

    // or the same using Carbon:
    // return Carbon\Carbon::now()->diff(new Carbon\Carbon($value))->y >= $minAge;
});

Usage:

$rules = ['dob' => 'olderThan']; // checks for 13 years as a default age
$rules = ['dob' => 'olderThan:15']; // checks for 15 years etc

Source:

http://stackoverflow.com/questions/23081654/check-age-with-laravel-validation-rules

Some of the jQuery / BootStrap Datepicker datetime input

Customizable Dropdown Birthday Picker Plugin with jQuery

This one's with 3 input fields.

http://www.jqueryscript.net/time-clock/Customizable-Dropdown-Birthday-Picker-Plugin-with-jQuery.html

Customizable Dropdown Birthday Picker Plugin with jQuery

Datepicker for Bootstrap

The best part for this one is the start and end date / check in and check out date control

http://www.eyecon.ro/bootstrap-datepicker/

Datepicker for Bootstrap

DateTime Picker Bootstrap - form component to handle date and time data.

http://www.malot.fr/bootstrap-datetimepicker/

DateTime Picker Bootstrap - form component to handle date and time data.

 

Pikaday A refreshing JavaScript Datepicker JS Lib

This is a simple yet fully functional datetime picker

Pikaday A refreshing JavaScript Datepicker

Link: https://github.com/dbushell/Pikaday

PHP date function: http://php.net/manual/en/function.date.php

I've found an issue when the instance is not bound to the filed value, eg. I'd like to preload the field value value="{{ SELF.userDob }}", this will cause the picker not work.

In order to solve this, try to bind the instance to the field value:

change the onSelect line

onSelect: function()

to

picker = new Pikaday({
    onSelect: function(date) {
        field.value = picker.toString();
    }

Then it should work.

Formatting Timestamps in Laravel and OctoberCMS

If you create a table with timestamp() via a migration, you'll actually get a timestamp that is matching the one created by date('Y-m-d H:i:s').

So in order to get the output correctly displayed with your local time format, or you'd like to format it and have an input to the database, then you'll need to format it before the output:

Created on: {{ date('F d, Y', strtotime($list->created_at)) }}

For formatting the input, eg. format a DOB datetime input:

$data = post();

$data['dob'] = date('Y-m-d H:i:s', post('dob'));

reference:  http://www.easylaravelbook.com/blog/2015/02/11/formatting-timestamps-in-laravel/

A custom Google Map Prototype based on Google Map API v3 / BootStrap / Custom tiles overlay

This custom Google Map prototype demonstrates my capability of building highly customized interactive maps based on Google Map API with custom tiles (map slices from a static image).

Prototype Link (new window)

Features of the custom Google Map prototype:

  • Google Map API to integrate map functions like map Zoom/Drag
  • Google Map API v3 to integrate custom markers and polygons
  • Static Deakin Burwood Campus map to provide custom tiles overlay
  • BootStrap to provide mobile friendly interface
  • jQuery to provide interactivity such as popup info box
  • HTML5

Software Used

  • Adobe Dreamweaver CC for editing HTML and JavaScript
  • Adobe Illustrator CC for editing and slicing the static map
  • Map Tiler for creating custom tiles overlay

 

Custom Google Map Prototype screenshots:

Map with custom marker and popup info box

Google Map API custom tiles and  polygon

Google Map API customer message box

Path Finder – SIT302 Team Project – 2015 iAwards Nomination

This is the proof that I'm an award-winning IT pro!   😀

Project introduction

PathFinder is a peer-to-peer web-based guide featuring video tutorials, an online interactive map, timetables to assist in your scheduling and an incredible game experience – all in the palm of your hand. Our development team, in conjunction with the IT staff, have taken the complexity out of finding information by designing a simple, yet engaging experience for all IT students.

Project Intro Video

 

Project site URL

http://project-survival.w3c-lab.com/

Technology Used
  • Highly customized WordPress theme
  • Over 30+ WordPress plugins
  • Flash for interactive map
  • Adobe Premiere CC
  • Adobe After Effects CC
  • YouTube for video hosting
  • HTML5 for interactive game
My role and contributions

I was the team leader (of a 7-member team), system analyst and web developer.

My major tasks and contributions for the project were:

  • Task planning and allocation
  • Meeting arrangement for both the team and stakeholders and supervisors
  • Initial project analysis report
  • Developed the base of the system
  • Web hosting management / WP Installation and configuration / Theme customization
  • Over 300+ pages of documentation produced

Sample of project Gantt chart

Achievement
2015 iAwards Nomination (Team) - iAwards Link (new window)

The iAwards honours companies at the cutting edge of technology innovation and recognises the achievements of home-grown Australian innovators.

2015 Deakin University School of IT Project Award (Personal Award)

Achieved the highest mark overall for SIT302 Project

2015 Deakin University School of IT Project Award