예제 #1
0
<?php

$this->respond(['GET', 'POST'], '/create', function ($request, $response, $service, $app) {
    $data = ['available' => $request->param('available', ''), 'freeDate' => $request->param('freeDate', ''), 'price' => $request->param('price', ''), 'finishing' => $request->param('finishing', ''), 'signing' => $request->param('signing', ''), 'isImportant' => $request->param('isImportant', ''), 'isRejected' => $request->param('isRejected', ''), 'signingAgent' => $request->param('signingAgent', ''), 'signingDate' => $request->param('signingDate', ''), 'investor' => $request->param('investor', ''), 'tourAgent' => $request->param('tourAgent', ''), 'tourDate' => $request->param('tourDate', ''), 'negotiationsAgent' => $request->param('negotiationsAgent', ''), 'negotiationsDate' => $request->param('negotiationsDate', ''), 'closingAgent' => $request->param('closingAgent', ''), 'closingDate' => $request->param('closingDate', ''), 'status' => $request->param('status', ''), 'rentDemand' => $request->param('rentDemand', ''), 'asset' => $request->param('asset', '')];
    $id = RentProcesses::createRentProcess($data);
    if ($id > 0) {
        $response->json(Result::success('RentProcess Created.', ['id' => $id]));
    } else {
        $response->json(Result::error('RentProcess Creation Failed.'));
    }
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $result = RentProcesses::getRentProcess($id);
    if ($result) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('RentProcess not found'));
    }
});
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $data = json_decode($request->body(), true);
    $result = RentProcesses::updateRentProcess($id, $data);
    if ($result > 0) {
        $response->json(Result::success('RentProcess Updated.'));
    } elseif ($result === 0) {
        $response->json(Result::success('RentProcess not Updated.'));
    } else {
        $response->json(Result::error('RentProcess not found'));
    }
예제 #2
0
 public static function matchRentDemandAndAsset($rentDemandID, $assetID)
 {
     $data = ['rentDemand' => $rentDemandID, 'asset' => $assetID];
     $id = RentProcesses::createRentProcess($data);
     return $id;
 }