<?php
 namespace VnChocola\Module\Customer\CustomerVisitHistory;
 use TCMS\Controller;
 use Model;
 use Request;
 use TCMS\TException;
 class IndexController extends Controller {
 public function index() {
 $this->layout = false;
 $searchPlateNumber = $this->formatPlateNumber(Request::get('plate_number'));
 if(!$searchPlateNumber) throw new TException("Plate number not found");
 view()->searchPlateNumber = $searchPlateNumber;
 view()->plateNumber = trim(Request::get('plate_number'));
 return view();
 }
 private function formatPlateNumber($plate) {
 if ($plate) {
 $plate = trim(strtolower($plate));
 $plate = str_replace('-', "", $plate);
 $plate = str_replace('.', "", $plate);
 $plate = str_replace(' ', "", $plate);
 return $plate;
 }
 return '';
 }
 }
