当前位置: 首页>>代码示例>>PHP>>正文


PHP Checkout::save方法代码示例

本文整理汇总了PHP中Checkout::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Checkout::save方法的具体用法?PHP Checkout::save怎么用?PHP Checkout::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Checkout的用法示例。


在下文中一共展示了Checkout::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSave

 function testSave()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 1;
     $id = 1;
     $due_date = '2015-10-10';
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date, $id);
     $test_checkout->save();
     //Act
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals($test_checkout, $result[0]);
 }
开发者ID:bborealis,项目名称:library-1,代码行数:14,代码来源:CheckoutTest.php

示例2: Checkout

 function test_find()
 {
     //Arrange
     $due_date = "0001-01-01";
     $test_checkout = new Checkout($due_date);
     $test_checkout->save();
     $due_date2 = "2020-01-01";
     $test_checkout2 = new Checkout($due_date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::find($test_checkout->getId());
     //Assert
     $this->assertEquals($test_checkout, $result);
 }
开发者ID:jlbethel,项目名称:Library,代码行数:14,代码来源:CheckoutTest.php

示例3: Patron

 function test_getCheckouts()
 {
     //Arrange
     $name = "Jerald the crotchety grandpa";
     $test_patron = new Patron($name);
     $test_patron->save();
     $checked_in_status = 0;
     $due_date = "1234-12-12";
     $copy_id = 5;
     $new_checkout = new Checkout($checked_in_status, $due_date, $copy_id, $test_patron->getId());
     $new_checkout->save();
     //Act
     $result = $test_patron->getCheckouts();
     //Assert
     $this->assertEquals([$new_checkout], $result);
 }
开发者ID:kevintokheim,项目名称:Library,代码行数:16,代码来源:PatronTest.php

示例4: testAddCheckout

 function testAddCheckout()
 {
     $title = "Three Blind Mice";
     $test_book = new Book($title);
     $test_book->save();
     $test_copy = new Copy($amount = 1, $test_book->getId());
     $test_copy->save();
     $name = "Joe Bongtana";
     $test_patron = new Patron($name);
     $test_patron->save();
     $due_date = "01-01-2016";
     $status = 1;
     $test_checkout = new Checkout($test_copy->getId(), $test_patron->getId(), $due_date, $status);
     $test_checkout->save();
     $test_patron->addCheckout($test_checkout);
     $result = Checkout::getAll();
     $this->assertEquals($test_checkout, $result);
 }
开发者ID:nathanhwyoung,项目名称:Library-2,代码行数:18,代码来源:PatronTest.php

示例5: Checkout

 function test_deleteAll()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 4;
     $due_date = "2015-09-03";
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date);
     $test_checkout->save();
     $copy_id2 = 2;
     $patron_id2 = 1;
     $due_date2 = "2015-10-05";
     $test_checkout2 = new Checkout($copy_id2, $patron_id2, $due_date2);
     $test_checkout2->save();
     //Act
     Checkout::deleteAll();
     //Assert
     $result = Checkout::getAll();
     $this->assertEquals([], $result);
 }
开发者ID:alexdbrown,项目名称:library,代码行数:19,代码来源:CheckoutTest.php

示例6: post_toolspj

 public function post_toolspj()
 {
     $date = Input::get('tanggal', date('Y-m-d'));
     ini_set('max_execution_time', 120);
     $timestamp = strtotime($date);
     //list armada on schedule
     $arrayschedule = array();
     $schedule = Schedule::where('month', '=', date('n', $timestamp))->where('year', '=', date('Y', $timestamp))->get(array('id', 'fleet_id'));
     foreach ($schedule as $sc) {
         $arrayschedule[] = $sc->id;
     }
     $fleets = array();
     if (is_array($arrayschedule) && !empty($arrayschedule)) {
         $fleets = Scheduledate::join('schedules', 'schedules.id', '=', 'schedule_dates.schedule_id')->join('fleets', 'fleets.id', '=', 'schedules.fleet_id')->join('ksos', 'ksos.fleet_id', '=', 'schedules.fleet_id')->where_in('schedule_dates.schedule_id', $arrayschedule)->where('schedules.pool_id', '=', Auth::user()->pool_id)->where('schedule_dates.date', '=', date('j', $timestamp))->where('schedules.month', '=', date('n', $timestamp))->where('schedule_dates.shift_id', '=', 1)->where('ksos.actived', '=', 1)->order_by('fleets.taxi_number', 'asc')->get(array('schedule_dates.id as id', 'schedule_dates.driver_id', 'schedules.fleet_id', 'fleets.taxi_number'));
     }
     if ($fleets) {
         foreach ($fleets as $f) {
             $scheduledate = Scheduledate::find($f->id);
             $scheduledate->fg_check = 1;
             $scheduledate->save();
             $schedule = Schedule::find($scheduledate->schedule_id);
             //$driverinfo = Driver::find($scheduledate->driver_id);
             //$fleetinfo = Fleet::find($schedule->fleet_id);
             $ksoinfo = Kso::where_fleet_id($schedule->fleet_id)->where_actived(1)->first();
             $dateopertion = mktime(0, 0, 0, $schedule->month, $scheduledate->date, $schedule->year);
             $checkouts = Checkout::where_fleet_id($schedule->fleet_id)->where_operasi_time(date('Y-m-d', $dateopertion))->first();
             //delete checkouts
             if ($checkouts) {
                 $checkouts->delete();
             }
             $codeops = 1;
             $status = 7;
             $keterangan = 'Print SPJ melalui Tools';
             if (!$checkouts) {
                 //insert into to checkouts step
                 $checkouts = new Checkout();
                 $checkouts->kso_id = $ksoinfo->id;
                 $checkouts->operasi_time = date('Y-m-d', $dateopertion);
                 $checkouts->fleet_id = $schedule->fleet_id;
                 $checkouts->driver_id = $scheduledate->driver_id;
                 $checkouts->checkout_step_id = $status;
                 $checkouts->shift_id = $scheduledate->shift_id;
                 $checkouts->user_id = Auth::user()->id;
                 $checkouts->pool_id = Auth::user()->pool_id;
                 $checkouts->printspj_time = date('Y-m-d H:i:s', Myfungsi::sysdate());
                 $checkouts->operasi_status_id = $codeops;
                 $checkouts->keterangan = $keterangan;
                 $checkouts->save();
                 $cinada = Checkin::where('operasi_time', '=', date('Y-m-d', $dateopertion))->where('fleet_id', '=', $schedule->fleet_id)->first();
                 if ($cinada) {
                     $cinada->delete();
                 }
                 if (!$cinada) {
                     $cin = Checkin::create(array('kso_id' => $ksoinfo->id, 'fleet_id' => $schedule->fleet_id, 'driver_id' => $scheduledate->driver_id, 'checkin_time' => date('Y-m-d H:i:s', Myfungsi::sysdate()), 'shift_id' => $scheduledate->shift_id, 'km_fleet' => 0, 'rit' => 0, 'incomekm' => 0, 'operasi_time' => date('Y-m-d', $dateopertion), 'pool_id' => Auth::user()->pool_id, 'operasi_status_id' => $codeops, 'fg_late' => '', 'checkin_step_id' => 2, 'document_check_user_id' => Auth::user()->id, 'physic_check_user_id' => '', 'bengkel_check_user_id' => '', 'finance_check_user_id' => '', 'keterangan' => $keterangan));
                     if ($cin) {
                         $docs = new Checkindocument();
                         $docs->checkin_id = $cin->id;
                         $docs->save();
                         //return Redirect::to('schedule');
                     }
                     //
                 }
             }
         }
         return Redirect::to('schedule');
     }
 }
开发者ID:acmadi,项目名称:diantaksi,代码行数:67,代码来源:tools.php

示例7: Checkout

 function test_updateDueDate()
 {
     //Arrange
     $due_date = "0001-01-01";
     $copy_id = 1;
     $patron_id = 2;
     $test_checkout = new Checkout($due_date, $copy_id, $patron_id);
     $test_checkout->save();
     $new_due_date = "2015-11-11";
     $test_checkout->updateDueDate($new_due_date);
     //Act
     $id = $test_checkout->getId();
     $result = new Checkout($new_due_date, $copy_id, $patron_id, $id);
     //Assert
     $this->assertEquals(Checkout::findDueDate($id), $result);
 }
开发者ID:jlbethel,项目名称:library-1,代码行数:16,代码来源:CheckoutTest.php

示例8: Patron

 function test_updateDueDate()
 {
     //Arrange
     // Make a Patron
     $name = "Dan Brown";
     $phone = "3";
     $email = "a@a.com";
     $test_patron = new Patron($name, $phone, $email);
     $test_patron->save();
     // Make a Checkout and save
     $patron_id = $test_patron->getId();
     $copy_id = 1;
     $due_date = "2015-08-09";
     $test_checkout = new Checkout($patron_id, $copy_id, $due_date);
     $test_checkout->save();
     $new_due_date = "2015-08-27";
     //Act
     $test_checkout->updateDueDate($new_due_date);
     //Assert
     $result = $test_checkout->getDueDate();
     $this->assertEquals($new_due_date, $result);
 }
开发者ID:r-hills,项目名称:Library,代码行数:22,代码来源:CheckoutTest.php

示例9: Patron

 function test_getAll()
 {
     // for now, feed a dummy copy_id just for testing
     // later, we will need to use getNextCopy() in Book class
     // to get a copy for a given book
     //Arrange
     // Make a Patron
     $name = "Dan Brown";
     $phone = "3";
     $email = "a@a.com";
     $test_patron = new Patron($name, $phone, $email);
     $test_patron->save();
     // Make a Checkout and save
     $patron_id = $test_patron->getId();
     $copy_id = 1;
     $date = "2015-08-09";
     $test_checkout = new Checkout($patron_id, $copy_id, $date);
     $test_checkout->save();
     // Make a 2nd Checkout and save under the same patron
     $copy_id2 = 1;
     $date2 = "2015-08-09";
     $test_checkout2 = new Checkout($patron_id, $copy_id2, $date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::getAll();
     //Assert
     $this->assertEquals([$test_checkout, $test_checkout2], $result);
 }
开发者ID:ashlinaronin,项目名称:library,代码行数:28,代码来源:CheckoutTest.php

示例10: testCheckIn

 function testCheckIn()
 {
     $patron_name = "Randy Mclure";
     $test_patron = new Patron($patron_name);
     $test_patron->save();
     $due_date = "2015-09-10";
     $copy_id = 1;
     $patron_id = 1;
     $checkin_status = 1;
     $test_checkout = new Checkout($due_date, $copy_id, $test_patron->getId(), $checkin_status);
     $test_checkout->save($test_patron);
     $test_checkout->checkIn();
     $result = $test_checkout->getCheckinStatus();
     $this->assertEquals(1, $result);
 }
开发者ID:umamiMike,项目名称:library-1,代码行数:15,代码来源:CheckoutTest.php

示例11: testFind

 function testFind()
 {
     //Arrange
     $id = null;
     $patron_id = 1;
     $copy_id = 1;
     $due_date = "2012-12-12";
     $test_checkout = new Checkout($id, $patron_id, $copy_id, $due_date);
     $test_checkout->save();
     $patron_id2 = 1;
     $copy_id2 = 1;
     $due_date2 = "1989-09-04";
     $test_checkout2 = new Checkout($id, $patron_id2, $copy_id2, $due_date2);
     $test_checkout2->save();
     //Act
     $result = Checkout::find($test_checkout->getId());
     //Assert
     $this->assertEquals($test_checkout, $result);
 }
开发者ID:kellimargaret,项目名称:2015.08.26.Library,代码行数:19,代码来源:CheckoutTest.php

示例12: array

    $author = $book->getAuthors();
    $copies = Copy::findCopies($id);
    return $app['twig']->render('book.html.twig', array('book' => $book, 'author' => $author, 'copies' => $copies, 'patrons' => Patron::getAll(), 'checkouts' => Checkout::getAll()));
});
$app->post("/add_copy", function () use($app) {
    $book_id = $_POST['book_id'];
    $book = Book::find($book_id);
    $author = $book->getAuthors();
    $copy = new Copy($book_id);
    $copy->save();
    $copies = Copy::findCopies($book_id);
    return $app['twig']->render('book.html.twig', array('book' => $book, 'author' => $author, 'copies' => $copies, 'patrons' => Patron::getAll(), 'checkouts' => Checkout::getAll()));
});
$app->patch("/checkout_copy/{id}", function ($id) use($app) {
    $checkout = new Checkout($_POST['copy_id'], $_POST['patron_id'], $_POST['due_date']);
    $checkout->save();
    $book_id = $_POST['book_id'];
    $book = Book::find($book_id);
    $author = $book->getAuthors();
    return $app['twig']->render('book.html.twig', array('book' => $book, 'author' => $author, 'copies' => Copy::getAll(), 'patrons' => Patron::getAll(), 'checkouts' => Checkout::getAll()));
});
// $app->patch("/checkout_copy/{id}", function($id) use ($app) {
//     $book = Book::find($id);
//     $author = $book->getAuthors();
//     $copy_id = $_POST['copy_id'];
//     $copy = Copy::find($copy_id);
//     //$checkout = new Checkout($copy_id, $)
//     $copy->update($_POST['due_date']);
//     $copies = Copy::findCopies($id);
//     return $app['twig']->render('book.html.twig', array('book'=>$book, 'author'=>$author, 'copies'=> $copies, 'patrons'=>Patron::getAll()));
// });
开发者ID:bborealis,项目名称:library-1,代码行数:31,代码来源:app.php

示例13: Patron

 function test_getPatron()
 {
     //Arrange
     $name = "Phyllis the kind Grandma";
     $test_patron = new Patron($name);
     $test_patron->save();
     $checked_in_status = 0;
     $due_date = "2000 BC";
     $copy_id = 1;
     $test_checkout = new Checkout($checked_in_status, $due_date, $copy_id, $test_patron->getId());
     $test_checkout->save();
     //Act
     $result = $test_checkout->getPatron();
     //Assert
     $this->assertEquals($test_patron, $result);
 }
开发者ID:kevintokheim,项目名称:Library,代码行数:16,代码来源:CheckoutTest.php

示例14: Checkout

 function test_updateReturned()
 {
     //Arrange
     $copy_id = 1;
     $patron_id = 4;
     $due_date = "2015-09-03";
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date);
     $test_checkout->save();
     //Act
     $new_returned = true;
     $test_checkout->updateReturned($new_returned);
     //Assert
     $result = Checkout::getAll();
     $this->assertEquals($new_returned, $result[0]->getReturned());
 }
开发者ID:r-hills,项目名称:library-1,代码行数:15,代码来源:CheckoutTest.php

示例15: testGetCurrentCheckouts

 function testGetCurrentCheckouts()
 {
     $patron_name = "Randy Mclure";
     $test_patron = new Patron($patron_name);
     $test_patron->save();
     $due_date = null;
     $copy_id = 1;
     $checkin_status = 1;
     $test_checkout = new Checkout($due_date, $copy_id, $test_patron->getId(), $checkin_status);
     $test_checkout->save($test_patron, $due_date);
     $test_checkout->checkIn();
     $due_date2 = null;
     $copy_id2 = 2;
     $checkin_status2 = 0;
     $test_checkout2 = new Checkout($due_date2, $copy_id2, $test_patron->getId(), $checkin_status2);
     $test_checkout2->save($test_patron);
     $result = $test_patron->getCurrentCheckouts();
     $this->assertEquals([$test_checkout2], $result);
 }
开发者ID:umamiMike,项目名称:library-1,代码行数:19,代码来源:PatronTest.php


注:本文中的Checkout::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。