本文整理汇总了PHP中Transaction::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::create方法的具体用法?PHP Transaction::create怎么用?PHP Transaction::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Transaction::create([]);
}
}
示例2: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 5) as $index) {
// Receita
Transaction::create(array('user_id' => 1, 'type' => array_rand(['receita', 'despesa'], 1), 'description' => array_rand(['Hospedagem', 'Empréstimo', "Aluguel"], 1), 'amount' => (string) rand(1, 100000) * 0.01, 'done' => array_rand(['true', 'false'], 1), 'date' => $faker->date('Y-m-d'), 'recurring_type' => array_rand(['daily', 'weekly', 'biweekly', 'monthly', 'bimonthly', 'trimonthly', 'sixmonthly', 'yearly'], 1), 'recurring_times' => 3, 'recurring_cycle' => 2, 'owner_id' => 1, 'owner_type' => 'User'));
}
}
示例3: testBenefFields
public function testBenefFields()
{
$tx = Transaction::create((object) ['date' => new \DateTime(), 'amount' => 200.0, 'currency' => 'CAD', 'benefName' => 'Petr Kramar', 'benefStreet' => 'Andelova 12', 'benefCity' => 'Ostrava', 'benefCountry' => 'CZ']);
$this->assertEquals('Petr Kramar', $tx->getBenefName());
$this->assertEquals('Andelova 12', $tx->getBenefStreet());
$this->assertEquals('Ostrava', $tx->getBenefCity());
$this->assertEquals('CZ', $tx->getBenefCountry());
}
示例4: store
/**
* Store a newly created resource in storage.
* POST /transactions
*
* @return Response
*/
public function store()
{
$transactions = Transaction::create(Input::all());
if ($transactions) {
return ['status' => true, 'data' => $transactions];
} else {
return ['status' => false];
}
}
示例5: create
/**
* @param \stdClass $data Data from JSON API response
* @return TransactionList
*/
public static function create(\stdClass $data)
{
$account = new Account($data->info->accountId, $data->info->bankId, $data->info->currency, $data->info->iban, $data->info->bic);
$transactionList = new self($data->info->openingBalance, $data->info->closingBalance, new \DateTime($data->info->dateStart), new \DateTime($data->info->dateEnd), $data->info->idFrom, $data->info->idTo, $data->info->idLastDownload, $account);
foreach ($data->transactionList->transaction as $transaction) {
$transactionList->addTransaction(Transaction::create($transaction));
}
return $transactionList;
}
示例6: store
/**
* Store a newly created resource in storage.
* POST /transactions
*
* @return Response
*/
public function store()
{
//
$trans = Transaction::create(array('user_id' => Input::get('user_id'), 'amount' => Input::get('amount'), 'description' => Input::get('description')));
$brokers = array();
foreach (Input::get('brokers') as $row) {
$brokers[] = new Broker(array('broker' => $row));
}
$trans->brokers()->saveMany($brokers);
return Transaction::with('brokers')->find($trans->id)->toJson();
}
示例7: testAccountValuesAreProperlySet
public function testAccountValuesAreProperlySet()
{
$transaction = json_decode(file_get_contents(__DIR__ . '/data/example-transaction.json'));
$transaction = Transaction::create($transaction);
$this->assertSame(1111111111, $transaction->getId());
$this->assertEquals(new \DateTime('2015-03-30+0200'), $transaction->getDate());
$this->assertSame(127.0, $transaction->getAmount());
$this->assertSame('CZK', $transaction->getCurrency());
$this->assertSame('214498596', $transaction->getSenderAccountNumber());
$this->assertSame('2100', $transaction->getSenderBankCode());
$this->assertSame('0', $transaction->getVariableSymbol());
$this->assertSame(null, $transaction->getConstantSymbol());
$this->assertSame(null, $transaction->getSpecificSymbol());
$this->assertSame('Banka, a.s.', $transaction->getSenderBankName());
$this->assertSame('HUJER MARTIN', $transaction->getUserIdentity());
$this->assertSame('Platba eshop', $transaction->getUserMessage());
$this->assertSame('Bezhotovostní příjem', $transaction->getTransactionType());
$this->assertSame(null, $transaction->getPerformedBy());
$this->assertSame('Comment? Comment!', $transaction->getComment());
$this->assertSame(1111122222, $transaction->getPaymentOrderId());
}
示例8: createAddPart
public function createAddPart()
{
if (isset($_REQUEST['itemid']) && !empty($_REQUEST['wid'])) {
$worksheet = Worksheet::find_by_id($_REQUEST['wid']);
$myItem = Items::find_by_id($_REQUEST['itemid']);
$propart = new Prodpart();
$propart->part_name = $myItem->item_name;
$propart->qty = $_REQUEST['qty'];
$propart->works_id = $_REQUEST['wid'];
$propart->prod_id = $worksheet->prod_id;
$propart->item_id = $_REQUEST['itemid'];
$propart->datecreated = date("Y:m:d H:i:s");
$propart->des = "";
$propart->unit_cost = $_REQUEST['price'];
$propart->total_cost = (int) $_REQUEST['price'] * (int) $_REQUEST['qty'];
$Tlog = new Transaction();
$Tlog->com_id = $myItem->item_id;
$Tlog->trans_type = "WORKSHEET PART SUPPLY";
$Tlog->trans_description = "allocation of resources to worksheet";
$Tlog->datecreated = date("Y-m-d H:i:s");
$Tlog->user_id = $_SESSION['emp_ident'];
if ($propart->create()) {
$Tlog->create();
return $propart;
} else {
return false;
}
}
}
示例9: date
echo "invalid";
}
echo "test";
//echo date_format(date_add(DateTime::createFromFormat('d/m/Y', date("d/m/Y")),date_interval_create_from_date_string("5 years")),"d/m/Y");
echo date("d/m/Y");
$a = Item::search(["item_id" => 2]);
print_r($a);
$sql = "UPDATE item_copy SET item_copy_status=1;";
DB::getInstance()->directUpdate($sql);
$data = array("id" => null, "purpose" => "sdasd", "comment" => "asdsdf", "member_id" => 16);
$salt = '5&JDDlwz%Rwh!t2Yg-Igae@QxPzFTSId';
$enc_pass = md5($salt . 'admin');
echo "paswowkjhkfjw";
DB::getInstance()->directUpdate("UPDATE member SET member_password='{$enc_pass}' WHERE member_nic='000000000';");
$t = new Transaction();
$t->create($data);
$t->add();
print_r(DB::getInstance()->search("schedule", ["semester_no" => 2]));
print_r(Schedule::search(["semester_no" => 2]));
echo isset($_SESSION["basket"]);
?>
<html>
<script type="text/javascript">
function display(msg){
alert(msg);
}
</script>
</html>
示例10: store
/**
* Store a newly created resource in storage.
* POST /transactions
*
* @return Response
*/
public function store($id)
{
$visit = $this->getVisit($id);
if (!isset($visit) || $visit->done != 0) {
return Redirect::back()->with('global', 'Bill already settled or No Pending Bills!');
}
$data = ['patient_id' => $id, 'visit_id' => $visit->id, 'total' => $this->getTotal($id), 'payment_mode' => Input::get('payment_mode')];
$validator = Validator::make($data, Transaction::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator);
}
if ($trans = Transaction::create($data)) {
$bima = Bima::where('company', '=', $trans->payment_mode)->where('medical_insurance', '=', $this->getPatient($id)->medical_insurance)->first();
if ($bima) {
$bima_balance = $bima->balance;
if ($bima_balance < 0 && $bima_balance < $trans['total']) {
return Redirect::back()->with('global', 'You have an insufficient account to make this transaction!');
} else {
$balance = $bima_balance - $trans['total'];
$bima->balance = $balance;
$bima->save();
}
}
$visit = $this->getVisit($id);
$visit->done = 1;
$visit->save();
return Redirect::route('transaction-create-get')->with('global', 'Bill successfully settled with ' . $trans->payment_mode);
}
return Redirect::route('transaction-create-get')->with('global', 'Error, please try again!');
}
示例11: createSchedule_Detail
public function createSchedule_Detail($id = "")
{
header('Content-Type: application/json');
$data = json_decode(stripslashes($_POST['data']));
foreach ($data as $d => $value) {
$cntdata[] = $d;
}
if (!empty($data->taskdate) && !empty($data->cid) && !empty($data->empid)) {
$issuefield = get_object_vars($data);
// get the properties of an object into an array
$thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->cid));
$thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->empid));
$thisSchedule = new Schedule();
$thisSchedule->emp_id = $issuefield['empid'];
$thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname;
$thisSchedule->client_id = $thisclientproduct->client_id;
$thisClient = Client::find_by_id($thisclientproduct->client_id);
//print_r($thisclientproduct);
//print_r($thisClient);
//print_r($thisemployee);
$thisSchedule->prod_id = $issuefield['cid'];
$thisSchedule->prod_name = $thisclientproduct->prod_name;
/**
* this is to check if ticket
* is in existence
*/
//print_r($theUser);
global $session;
//$partTicket = ($id!="") ? Ticket::find_by_id($id) : ""; // get the ticket to get details needed for sending mail
$theUser = Employee::find_by_id($_SESSION["emp_ident"]);
// get cse detail to retrieve email
$thisSchedule->s_date = $data->taskdate;
/**
* section to configure and setup sms and email message
*/
$issue = array();
$objIssue = Issue::find_all();
// creating the issue log object
$message_issue = "";
//$thisemployee->emp_phone
foreach ($objIssue as $objI) {
foreach ($issuefield as $key => $value) {
if ($key == $objI->issue_accronym) {
$message_issue .= $objI->issue_name . ", ";
}
}
}
$cemail = array();
$cemail = isset($_POST['cemail']) && !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : array('iarowolo@robertjohsonholdings.com');
array_push($cemail, $thisemployee->emp_email, is_array($partTicket) ? $partTicket->contact_email : "", $theUser->emp_email, $thisClient->email);
//print_r($cemail);
$thisSchedule->status = "Open";
$thisSchedule->issue = $message_issue;
$thisSchedule->datecreated = date("Y-m-d H:i:s");
$thisSchedule->maint_type = $_POST['mtype'];
$subject = "Maintenance Alert";
$smsmsg = "Maintenance alert for {$thisclientproduct->prod_name} at";
$smsmsg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch;
$smsmsg .= "\r\n Issue:" . $message_issue . "\r\n";
$smsmsg .= "\r\n Comment:" . $issuefield["tissue"] . "\r\n";
$msg = "<h3>Maintenance Detail</h3> <hr />";
$msg .= "<p><strong>Machine: </strong>{$thisclientproduct->prod_name} </p>";
$msg .= "<p><strong>Client: </strong> {$thisClient->name}</p>";
$msg .= "<p><strong>Location: </strong>{$thisclientproduct->install_location} {$thisclientproduct->branch} {$thisclientproduct->install_city} </p>";
$msg .= "<p><strong>Issues: </strong>" . $message_issue . "</p>";
$msg .= "<p><strong>Comment: </strong>" . $issuefield["tissue"] . "</p>";
$msg .= "<br /><br /> <h4>Technician Details</h4> <hr />";
$msg .= "<p><strong>Name: </strong>" . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "</p>";
$msg .= "<p><strong>Email: </strong>" . $thisemployee->emp_email . "</p>";
$msg .= "<p><strong>Telephone: </strong>" . $thisemployee->emp_phone . "</p>";
$msg .= "<br /><br /><h4>Scheduled Date</h4> <hr />";
$msg .= "<p><strong>{$thisSchedule->s_date}</strong></p><br /><br /><br /><br />";
/**
* the transaction log is created
* to ensure that the product already
* has history and cannot be deleted
*/
$Tlog2 = new Transaction();
$Tlog2->com_id = $thisclientproduct->main_id;
$Tlog2->trans_type = "TASK ASSIGNMENT";
$Tlog2->trans_description = $issuefield["mtype"] . " task assigned to " . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "";
$Tlog2->datecreated = date("Y-m-d H:i:s");
$Tlog2->user_id = $_SESSION['emp_ident'];
// print_r($msg);
if ($thisSchedule->create()) {
$Tlog2->create();
/**
* this section is needed
* to post issues to database table
* issuelog for statistical analysis on
* issues
*/
//$thisemployee->emp_phone
foreach ($objIssue as $objI) {
foreach ($issuefield as $key => $value) {
if ($key == $objI->issue_accronym) {
$issueLog = new Issuelog();
$issueLog->ticket_id = 0;
$issueLog->issue_id = $objI->id;
$issueLog->issue_accronym = $objI->issue_accronym;
//.........这里部分代码省略.........
示例12: function
<?php
use Guzzle\Http\Client;
Route::get('/', 'PagesController@index');
Route::get('/answered_questions', 'PagesController@getAnsweredQuestions');
Route::get('/dashboard', 'PagesController@getDashboard');
Route::get('mobile/friends/{id}', function ($id) {
return User::where('id', '!=', $id)->orderByRaw('RAND()')->get();
});
Route::get('mobile/friends/{id}/{friendId}', function ($id, $friendId) {
return User::where('id', $friendId)->first();
});
Route::get('mobile/transactions/{userId}', function ($userId) {
return Transaction::with('sender')->where('user_id', $userId)->orderBy('id', 'DESC')->get();
});
Route::post('mobile/transactions', function () {
$transactionPayload = Input::only('sender_id', 'user_id', 'amount', 'message');
Transaction::create($transactionPayload);
$user = User::findOrFail(Input::get('user_id'));
$user->balance += Input::get('amount');
$user->save();
$sender = User::findOrFail(Input::get('sender_id'));
$sender->balance -= Input::get('amount');
$sender->save();
// publish to colu server the transaction details
// $client = new Client();
// $request = $client->post('http://168.63.245.167:9000/test', null, Input::all());
});
Route::get('mobile/transactions/{transactionId}/view', function ($transactionId) {
return Transaction::with('sender')->findOrFail($transactionId);
});
示例13: header
<?php
require_once 'core/init.php';
$member_role = $_SESSION['roles'];
if (in_array("Laboratory Assistant", $member_role)) {
} else {
header('location:restricted_page.php');
}
if (isset($_SESSION["basket"]) && isset($_SESSION["items"])) {
$state = true;
DB::getInstance()->startTr();
$newTransaction = new Transaction();
$rdate = $_POST["expected_return_date"];
$member = $_SESSION["member_details"]["id"];
$data = array("id" => null, "purpose" => $_POST["purpose"], "borrow_comment" => $_POST["comments"], "return_comment" => null, "member_id" => $_SESSION["member_details"]["id"], "borrowed_date" => date("Y-m-d"), "expected_return_date" => $_POST["expected_return_date"]);
$newTransaction->create($data);
if ($newTransaction->add()) {
$transaction_id = DB::getInstance()->getLastId();
foreach ($_SESSION["basket"] as $key => $value) {
$newItemTransaction = new ItemTransaction();
$data = array("item_copy_id" => $value["item_copy_id"], "transaction_id" => $transaction_id, "borrowed_quantity" => $value["quantity"], "returned_date" => null, "returned_quantity" => null, "status" => 0);
$newItemTransaction->create($data);
if ($newItemTransaction->add()) {
$sql = "UPDATE item_copy SET item_copy_status=0 WHERE item_copy_id='" . $value["item_copy_id"] . "';";
if (!DB::getInstance()->directUpdate($sql)) {
$state = false;
break;
}
} else {
$state = false;
break;
示例14: date
$userId = $user->data()->id;
$curDate = date("Y-m-d");
$curTime = date("h:i:sa");
//data from the session
$paymentType = $_SESSION['type'];
$de_transactionID = $transaction->decodeEasyID($transactionID);
$f = $user->data()->fname;
$l = $user->data()->lname;
$name = $f . " " . $l;
$index = $user->data()->indexNumber;
if (isset($_SESSION['payeeID'])) {
$payeeID = $_SESSION['payeeID'];
} else {
$payeeID = $userId;
}
$transaction->create(array('transactionID' => $de_transactionID, 'payeeID' => $payeeID, 'payerID' => $userId, 'date' => $curDate, 'time' => $curTime, 'statusCode' => $statusCode, 'walletRefID' => $walletReferenceID, 'statusDescription' => $statusDescription, 'amount' => $transactionAmount));
$type = "";
switch ($statusCode) {
case 2:
//Completed transaction
////Type success code here
$str = "<div class='alert alert-info'>Transaction is completed. Payment receipt will be sent to your email <i>{$email} </i>. You can also download it by clicking the download button below.</div>";
if ($paymentType === 1) {
$type = "UCSC registration fee";
//payment type = UCSC registration fee
$t = DB::getInstance()->query('UPDATE ucsc_registration SET paymentStatus = 1 WHERE transactionID = ?', array($de_transactionID));
} elseif ($paymentType === 2) {
$type = "New academic year fee";
//payment type = New academic year fee
$t = DB::getInstance()->query('UPDATE new_academic_year SET paymentStatus = 1 WHERE transactionID = ?', array($de_transactionID));
} elseif ($paymentType === 3) {
示例15: formObject
public function formObject()
{
$this->data->Transaction = Transaction::create($this->data->id)->getData();
$this->render();
}