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


PHP Property::create方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Property::$rules);
     if ($validation->passes()) {
         $this->property->create($input);
         return Redirect::route('admin.properties.index');
     }
     return Redirect::route('admin.properties.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.');
 }
开发者ID:jacobDaeHyung,项目名称:Laravel-Real-Estate-Manager,代码行数:15,代码来源:PropertiesController.php

示例2: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Property::create([]);
     }
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:7,代码来源:PropertiesTableSeeder.php

示例3: store

 /**
  * Store a newly created resource in storage.
  * POST /properties
  *
  * @return Response
  */
 public function store()
 {
     $property = Property::create(Input::all());
     if ($property) {
         return ['status' => true, 'property' => $property];
     } else {
         return ['status' => false];
     }
 }
开发者ID:sahilkathpal,项目名称:hackcoin,代码行数:15,代码来源:PropertiesController.php

示例4: postStore

 /**
  * Store a newly created property in storage.
  *
  * @return Response
  */
 public function postStore()
 {
     $validator = Validator::make($data = Input::all(), Property::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Property::create($data);
     return Redirect::action('PropertiesController@getIndex');
 }
开发者ID:jonagoldman,项目名称:channelmanager,代码行数:14,代码来源:PropertiesController.php

示例5: doInsertProperty

 public function doInsertProperty($contactID, $viewcountID)
 {
     $property = Property::create();
     $property->Latitude = '-37.786428';
     $property->Longitude = '175.278766';
     $property->Address = '3 Defoe Avenue, Hillcrest Hamilton, New Zealand';
     $property->LandArea = 615;
     $property->FloorArea = 95;
     $property->PropertyIDNumber = 'LH11070';
     $property->Status = 0;
     $property->BedRoomCount = 3;
     $property->LivingRoomCount = 1;
     $property->BathRoomCount = 1;
     $property->GarageCount = 1;
     $property->ListedDate = '2015-10-15';
     $property->ContactPersonID = $contactID;
     $property->ViewCountID = $viewcountID;
     $property->MapsPageID = $this->ID;
     $property->write();
 }
开发者ID:jz233,项目名称:SS_getpdf,代码行数:20,代码来源:MapsPage.php

示例6: __set

 /**
  * Using the setter method you can add properties or subcomponents
  *
  * You can either pass a Component, Property
  * object, or a string to automatically create a Property.
  *
  * If the item already exists, it will be removed. If you want to add
  * a new item with the same name, always use the add() method.
  *
  * @param string $name
  * @param mixed $value
  * @return void
  */
 public function __set($name, $value)
 {
     $matches = $this->select($name);
     $overWrite = count($matches) ? key($matches) : null;
     if ($value instanceof Component || $value instanceof Property) {
         $value->parent = $this;
         if (!is_null($overWrite)) {
             $this->children[$overWrite] = $value;
         } else {
             $this->children[] = $value;
         }
     } elseif (is_scalar($value)) {
         $property = Property::create($name, $value);
         $property->parent = $this;
         if (!is_null($overWrite)) {
             $this->children[$overWrite] = $property;
         } else {
             $this->children[] = $property;
         }
     } else {
         throw new \InvalidArgumentException('You must pass a \\Sabre\\VObject\\Component, \\Sabre\\VObject\\Property or scalar type');
     }
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:36,代码来源:Component.php

示例7: getResult


//.........这里部分代码省略.........
                             if ($this->end && $startTime > $this->end) {
                                 break;
                             }
                             $times[] = array($iterator->getDTStart(), $iterator->getDTEnd());
                             $iterator->next();
                         }
                     } else {
                         $startTime = $component->DTSTART->getDateTime();
                         if ($this->end && $startTime > $this->end) {
                             break;
                         }
                         $endTime = null;
                         if (isset($component->DTEND)) {
                             $endTime = $component->DTEND->getDateTime();
                         } elseif (isset($component->DURATION)) {
                             $duration = DateTimeParser::parseDuration((string) $component->DURATION);
                             $endTime = clone $startTime;
                             $endTime->add($duration);
                         } elseif ($component->DTSTART->getDateType() === Property\DateTime::DATE) {
                             $endTime = clone $startTime;
                             $endTime->modify('+1 day');
                         } else {
                             // The event had no duration (0 seconds)
                             break;
                         }
                         $times[] = array($startTime, $endTime);
                     }
                     foreach ($times as $time) {
                         if ($this->end && $time[0] > $this->end) {
                             break;
                         }
                         if ($this->start && $time[1] < $this->start) {
                             break;
                         }
                         $busyTimes[] = array($time[0], $time[1], $FBTYPE);
                     }
                     break;
                 case 'VFREEBUSY':
                     foreach ($component->FREEBUSY as $freebusy) {
                         $fbType = isset($freebusy['FBTYPE']) ? strtoupper($freebusy['FBTYPE']) : 'BUSY';
                         // Skipping intervals marked as 'free'
                         if ($fbType === 'FREE') {
                             continue;
                         }
                         $values = explode(',', $freebusy);
                         foreach ($values as $value) {
                             list($startTime, $endTime) = explode('/', $value);
                             $startTime = DateTimeParser::parseDateTime($startTime);
                             if (substr($endTime, 0, 1) === 'P' || substr($endTime, 0, 2) === '-P') {
                                 $duration = DateTimeParser::parseDuration($endTime);
                                 $endTime = clone $startTime;
                                 $endTime->add($duration);
                             } else {
                                 $endTime = DateTimeParser::parseDateTime($endTime);
                             }
                             if ($this->start && $this->start > $endTime) {
                                 continue;
                             }
                             if ($this->end && $this->end < $startTime) {
                                 continue;
                             }
                             $busyTimes[] = array($startTime, $endTime, $fbType);
                         }
                     }
                     break;
             }
         }
     }
     if ($this->baseObject) {
         $calendar = $this->baseObject;
     } else {
         $calendar = Component::create('VCALENDAR');
         $calendar->version = '2.0';
         $calendar->prodid = '-//Sabre//Sabre VObject ' . Version::VERSION . '//EN';
         $calendar->calscale = 'GREGORIAN';
     }
     $vfreebusy = Component::create('VFREEBUSY');
     $calendar->add($vfreebusy);
     if ($this->start) {
         $dtstart = Property::create('DTSTART');
         $dtstart->setDateTime($this->start, Property\DateTime::UTC);
         $vfreebusy->add($dtstart);
     }
     if ($this->end) {
         $dtend = Property::create('DTEND');
         $dtend->setDateTime($this->end, Property\DateTime::UTC);
         $vfreebusy->add($dtend);
     }
     $dtstamp = Property::create('DTSTAMP');
     $dtstamp->setDateTime(new \DateTime('now'), Property\DateTime::UTC);
     $vfreebusy->add($dtstamp);
     foreach ($busyTimes as $busyTime) {
         $busyTime[0]->setTimeZone(new \DateTimeZone('UTC'));
         $busyTime[1]->setTimeZone(new \DateTimeZone('UTC'));
         $prop = Property::create('FREEBUSY', $busyTime[0]->format('Ymd\\THis\\Z') . '/' . $busyTime[1]->format('Ymd\\THis\\Z'));
         $prop['FBTYPE'] = $busyTime[2];
         $vfreebusy->add($prop);
     }
     return $calendar;
 }
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:101,代码来源:FreeBusyGenerator.php

示例8: test_associated_uniqueness

 public function test_associated_uniqueness()
 {
     $Property = new Property();
     $PropertyType = new PropertyType();
     $this->assertTrue($RanchoMaria =& $Property->create(array('description' => 'Rancho Maria')));
     $this->assertTrue($Rancho =& $PropertyType->create(array('description' => 'Rancho')));
     $Rancho->property->load();
     $this->assertEqual($Rancho->property->count(), 0);
     $Rancho->property->add($RanchoMaria);
     $this->assertEqual($Rancho->property->count(), 1);
     $this->assertTrue($RanchoMaria =& $Property->findFirstBy('description', 'Rancho Maria'));
     $this->assertTrue($Rancho =& $PropertyType->findFirstBy('description', 'Rancho', array('include' => 'properties')));
     $Rancho->property->add($RanchoMaria);
     $this->assertEqual($Rancho->property->count(), 1);
     $Rancho->set('description', 'Rancho Type');
     $this->assertTrue($Rancho->save());
     $this->assertTrue($Rancho =& $PropertyType->findFirstBy('description', 'Rancho Type', array('include' => 'properties')));
     $this->assertEqual($Rancho->property->count(), 1);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:19,代码来源:AkHasAndBelongsToMany.php

示例9: createProperty

 /**
  * Factory method for creating new properties
  *
  * This method automatically searches for the correct property class, based
  * on its name.
  *
  * You can specify the parameters either in key=>value syntax, in which case
  * parameters will automatically be created, or you can just pass a list of
  * Parameter objects.
  *
  * @param string $name
  * @param mixed $value
  * @param array $parameters
  * @return Property
  */
 public function createProperty($name, $value = null, array $parameters = array())
 {
     return Property::create($name, $value, $parameters);
 }
开发者ID:TamirAl,项目名称:hubzilla,代码行数:19,代码来源:Document.php

示例10: readLine

 /**
  * Reads and parses a single line.
  *
  * This method receives the full array of lines. The array pointer is used
  * to traverse.
  *
  * This method returns null if an invalid line was encountered, and the
  * IGNORE_INVALID_LINES option was turned on.
  *
  * @param array $lines
  * @param int $options See the OPTIONS constants.
  * @return Node
  */
 private static function readLine(&$lines, $options = 0)
 {
     $line = current($lines);
     $lineNr = key($lines);
     next($lines);
     // Components
     if (strtoupper(substr($line, 0, 6)) === "BEGIN:") {
         $componentName = strtoupper(substr($line, 6));
         $obj = Component::create($componentName);
         $nextLine = current($lines);
         while (strtoupper(substr($nextLine, 0, 4)) !== "END:") {
             $parsedLine = self::readLine($lines, $options);
             $nextLine = current($lines);
             if (is_null($parsedLine)) {
                 continue;
             }
             $obj->add($parsedLine);
             if ($nextLine === false) {
                 throw new ParseException('Invalid VObject. Document ended prematurely.');
             }
         }
         // Checking component name of the 'END:' line.
         if (substr($nextLine, 4) !== $obj->name) {
             throw new ParseException('Invalid VObject, expected: "END:' . $obj->name . '" got: "' . $nextLine . '"');
         }
         next($lines);
         return $obj;
     }
     // Properties
     //$result = preg_match('/(?P<name>[A-Z0-9-]+)(?:;(?P<parameters>^(?<!:):))(.*)$/',$line,$matches);
     if ($options & self::OPTION_FORGIVING) {
         $token = '[A-Z0-9-\\._]+';
     } else {
         $token = '[A-Z0-9-\\.]+';
     }
     $parameters = "(?:;(?P<parameters>([^:^\"]|\"([^\"]*)\")*))?";
     $regex = "/^(?P<name>{$token}){$parameters}:(?P<value>.*)\$/i";
     $result = preg_match($regex, $line, $matches);
     if (!$result) {
         if ($options & self::OPTION_IGNORE_INVALID_LINES) {
             return null;
         } else {
             throw new ParseException('Invalid VObject, line ' . ($lineNr + 1) . ' did not follow the icalendar/vcard format');
         }
     }
     $propertyName = strtoupper($matches['name']);
     $propertyValue = preg_replace_callback('#(\\\\(\\\\|N|n))#', function ($matches) {
         if ($matches[2] === 'n' || $matches[2] === 'N') {
             return "\n";
         } else {
             return $matches[2];
         }
     }, $matches['value']);
     $obj = Property::create($propertyName, $propertyValue);
     if ($matches['parameters']) {
         foreach (self::readParameters($matches['parameters']) as $param) {
             $obj->add($param);
         }
     }
     return $obj;
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:74,代码来源:Reader.php

示例11: testCreateParams

 function testCreateParams()
 {
     $property = Property::create('X-PROP', 'value', array('param1' => 'value1', 'param2' => array('value2', 'value3')));
     $this->assertEquals(1, count($property['PARAM1']));
     $this->assertEquals(2, count($property['PARAM2']));
 }
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:6,代码来源:PropertyTest.php

示例12: testValidateBadPropertyName

 function testValidateBadPropertyName()
 {
     $property = Property::create("X_*&PROP*", "Bla");
     $result = $property->validate(Property::REPAIR);
     $this->assertEquals($result[0]['message'], 'The propertyname: X_*&PROP* contains invalid characters. Only A-Z, 0-9 and - are allowed');
     $this->assertEquals('X-PROP', $property->name);
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:7,代码来源:PropertyTest.php

示例13: analyzeJSON

 /**
  * @param $object
  * @param $filename
  * @param bool $multiple
  * @return static
  */
 static function analyzeJSON($object, $className)
 {
     $normalizedClassName = normalizeClassName($className);
     if (is_object($object) == false && is_array($object) == false) {
         throw new \Exception("Neither object or array in class {$className}");
     }
     //Assume arrays only have one type of content.
     if (is_array($object)) {
         $instance = self::createClass($className, $normalizedClassName);
         foreach ($object as $key => $valueElement) {
             $name = $className . "_child";
             if (is_object($valueElement) || is_array($valueElement)) {
                 $childInstance = AnalyzedClass::analyzeJSON($valueElement, $name);
                 $childInstance->multiple = true;
                 $instance->properties[] = $childInstance;
             } else {
                 $instance->multiple = true;
             }
             return $instance;
         }
         $instance->multiple = true;
         return $instance;
     }
     $instance = self::createClass($className, $normalizedClassName);
     foreach ($object as $name => $value) {
         if (is_object($value)) {
             $childInstance = AnalyzedClass::analyzeJSON($value, $name, false);
             $instance->properties[] = $childInstance;
         } else {
             if (is_array($value)) {
                 $childInstance = AnalyzedClass::analyzeJSON($value, $name, false);
                 $instance->properties[] = $childInstance;
                 //$childInstance = AnalyzedClass::analyzeJSON($value, $name);
                 //                foreach ($value as $key => $valueElement) {
                 //                    if (is_object($valueElement) ||
                 //                        (is_array($valueElement))) {// && is_numeric_array($valueElement) == false)) {
                 //                        $childInstance = AnalyzedClass::analyzeJSON($valueElement, $name, true);
                 //                        $instance->properties[] = $childInstance;
                 //                        break;
                 //                    }
                 //                    else {
                 //                        if (is_object($valueElement) || is_array($valueElement)) {
                 //                            $childInstance = AnalyzedClass::analyzeJSON($valueElement, $name."_child", true);
                 //                            $instance->properties[] = $childInstance;
                 //                        }
                 //                        else {
                 //                            $instance->properties[] = Property::create($key, true);
                 //                        }
                 //                    }
                 //                }
             } else {
                 $instance->properties[] = Property::create($name, false);
             }
         }
     }
     $sortByPropertyName = function (Property $a, Property $b) {
         return strcasecmp($a->name, $b->name);
     };
     usort($instance->properties, $sortByPropertyName);
     return $instance;
 }
开发者ID:danack,项目名称:githubartaxservice,代码行数:67,代码来源:genModel.php

示例14: addproperty

 public function addproperty()
 {
     if (!Owner::isAuthenticated()) {
         $this->redirect('/');
     } else {
         if ($_SERVER['REQUEST_METHOD'] === 'POST') {
             $property = Property::create(['address' => $_POST['address'], 'payment_schedule' => $_POST['payment_schedule'], 'rent_amount' => $_POST['rent_amount'], 'owner_id' => $_SESSION['user']->id, 'photo' => DUMMY_IMAGE]);
             Flash::set('message', 'You added a new property!');
             $this->redirect('/propertyowner/manage');
         } else {
             $this->view('owner/addpropertyform');
         }
     }
 }
开发者ID:superflyz,项目名称:wallfly-mvc,代码行数:14,代码来源:PropertyOwner.php


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