コード例 #1
0
ファイル: GuestController.php プロジェクト: andrinda/myhotel
 public function getEdit($id)
 {
     $data = guest::find($id);
     $regions = Regions::all();
     $country = Countries::where('region_id', '=', $data->city->province->country->region->id)->get();
     $province = Provinces::where('country_id', '=', $data->city->province->country->id)->get();
     $city = Cities::where('province_id', '=', $data->city->province->id)->get();
     $options = array('data' => $data, 'regions' => $regions, 'country' => $country, 'province' => $province, 'city' => $city, 'identity' => Identity::all(), 'job' => Jobs::all());
     return View::make('home/dashboard', array())->nest('content', 'guest/edit', $options);
 }
コード例 #2
0
 public function listRecords()
 {
     $start = 0;
     $number = 50;
     if (isset($_POST['rStart'])) {
         $start = $_POST['rStart'];
     }
     if (isset($_POST['rNumber'])) {
         $number = $_POST['rNumber'];
     } else {
         $number = Identity::rowCount();
     }
     $identities = Identity::all($start, $number);
     require_once 'views/identity/list.php';
 }
コード例 #3
0
 public function home()
 {
     $identities = Identity::all();
     require_once 'views/identity/home.php';
 }
コード例 #4
0
ファイル: routes.php プロジェクト: dannyvink/rocketstore
    $args["identity"] = $identity;
    return $this->renderer->render($response, 'identity.phtml', $args);
});
$app->get('/admin/inventory', function ($request, $response, $args) {
    $items = InventoryItem::all();
    $args["items"] = $items;
    return $this->renderer->render($response, 'inventory.phtml', $args);
});
$app->get('/admin/inventory/{id}', function ($request, $response, $args) {
    $item = InventoryItem::findOrFail($args["id"]);
    $args["item"] = $item;
    return $this->renderer->render($response, 'item.phtml', $args);
});
$app->get('/api/v1/identities', function ($request, $response, $args) {
    $names = [];
    $identities = Identity::all();
    foreach ($identities as $identity) {
        $names[] = $identity->name;
    }
    $response->write(json_encode($names));
    return $response->withHeader('Content-type', 'application/json');
});
$app->post('/api/v1/checkin', function ($request, $response, $args) use($app) {
    $params = $request->getParsedBody();
    $json = ["success" => false, "message" => "There was an issue checking in the item (" . $params["sku"] . "). Please contact the tech team!"];
    if (Identity::where('name', $params["identity"])->count() < 1) {
        $json["message"] = "You are not authorized to use the inventory system! Contact your supervisor for access.";
        $response->write(json_encode($json));
        return $response->withHeader('Content-type', 'application/json');
    }
    // Retrieve the item by its SKU or create a new record if one does not exist.