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


PHP Restaurant::create方法代码示例

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


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

示例1: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Restaurant::create(['name' => $faker->company, 'latitude' => $faker->randomFloat(5, -90, 90), 'longitude' => $faker->randomFloat(5, -180, 180)]);
     }
 }
开发者ID:andrewhood125,项目名称:smart-buzzer,代码行数:7,代码来源:RestaurantsTableSeeder.php

示例2: intval

     $max_capacity += intval($_POST['numberCapacity2']) * 2;
 }
 if (isset($_POST['hasCapacity4']) && $_POST['hasCapacity4'] === 'true') {
     $max_capacity += intval($_POST['numberCapacity4']) * 4;
 }
 if (isset($_POST['hasCapacity6']) && $_POST['hasCapacity6'] === 'true') {
     $max_capacity += intval($_POST['numberCapacity6']) * 6;
 }
 if (isset($_POST['hasCapacity8']) && $_POST['hasCapacity8'] === 'true') {
     $max_capacity += intval($_POST['numberCapacity8']) * 8;
 }
 // echo $max_capacity;
 $fields = array('name' => $name, 'address' => $address, 'city' => $city, 'state' => $state, 'zipcode' => $zipcode, 'phone_number' => $phone_number, 'cuisine_type' => $cuisine_type, 'description' => $description, 'max_capacity' => $max_capacity, 'rating' => $rating, 'approved' => 0, 'owner_user_id' => $owner_user_id);
 try {
     $newRestaurant = new Restaurant();
     $newRestaurant->create($fields);
     $success = true;
     $message = 'Restaurant sign up complete!';
     $restaurant_id = $newRestaurant->get_restaurant_id();
     // after insert restaurant info without errors
     // add image to images table
     require_once '../lib/helper.functions.php';
     $image_client_path = $_FILES['file']['name'];
     $image_mime = $_FILES['file']['type'];
     $image_size = $_FILES['file']['size'];
     $image_error = $_FILES['file']['error'];
     $image_original_path = 'upload/original/';
     $image_medium_path = 'upload/medium/';
     $image_small_path = 'upload/small/';
     $tmp_file = $_FILES["file"]["tmp_name"];
     if ($image_error > 0) {
开发者ID:HuiSF,项目名称:FineTable-Class-Project,代码行数:31,代码来源:sign-up-restaurant.logic.php

示例3: testBehaviorValidateMethods

 /**
  * testBehaviorValidateMethods method
  *
  * @return void
  */
 public function testBehaviorValidateMethods()
 {
     $Apple = new Restaurant();
     $Apple->Behaviors->load('Test');
     $Apple->validate['color'] = 'validateField';
     $result = $Apple->save(array('name' => 'Genetically Modified Apple', 'color' => 'Orange'));
     $this->assertEquals(array('name', 'color', 'modified', 'created', 'id'), array_keys($result['Apple']));
     $Apple->create();
     $result = $Apple->save(array('name' => 'Regular Apple', 'color' => 'Red'));
     $this->assertFalse($result);
 }
开发者ID:nogikko,项目名称:yumyum,代码行数:16,代码来源:BehaviorCollectionTest.php


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