Example #1
0
 public function propertiesJsonQuery($string)
 {
     $propertiesClient = new Properties();
     if (!$this->validateProperties($string)) {
         return "";
     }
     $response = $propertiesClient->find($string);
     return $response;
 }
 public function postAddRepairHistory()
 {
     $property = Properties::find(Input::get('properties_id'));
     if (!$property) {
         App::abort(404);
     }
     $validator = Validator::make(Input::all(), ['transaction' => 'required|in:REPLACEMENT,ADDITION', 'details' => 'required|max:50', 'effectdate' => 'required|date_format:Y-m-d', 'cost' => 'required|numeric']);
     if ($validator->fails()) {
         return Redirect::route('add-repair-history', $property->id)->withErrors($validator)->withInput();
     }
     $repair = new Repair();
     $repair->transaction = Input::get('transaction');
     $repair->details = Input::get('details');
     $repair->effectdate = Input::get('effectdate');
     $repair->cost = Input::get('cost');
     $repair->property()->associate($property);
     $repair->save();
     return Redirect::route('repair-history', $property->id)->with('alert', 'success|Repair history entry created successfully.');
 }
<?php

/*
* Copyright 2015 Axibase Corporation or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* https://www.axibase.com/atsd/axibase-apache-2.0.pdf
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace axibase\atsdPHP;

require_once '../atsdPHP/models/Properties.php';
require_once '../atsdPHP/HttpClient.php';
require_once '../atsdPHP/Utils.php';
$type = "System";
$entity = "awsswgvml001";
$queryClient = new Properties();
$json = '{"queries":[{"type":"' . $type . '","entity":"' . $entity . '"}]}';
$response = $queryClient->find($json);
$viewConfig = new ViewConfiguration("Properties for entity: " . $entity . "; type: " . $type, "properties");
$propertiesTable = Utils::propertyAsHtmlTable($response, $viewConfig);
Utils::render(array($propertiesTable));
 public function getViewUserProperty($id)
 {
     $prop = Properties::find($id);
     $histories = PropertiesHistory::where('properties_id', $id)->orderBy('created_at', 'desc')->get();
     if (!$prop) {
         App::abort(404);
     }
     return View::make('view-property')->with('histories', $histories)->with('prop', $prop);
 }