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


PHP Unit::create方法代码示例

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


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

示例1: testCreateShouldReturnEmptyData

 /**
  * Test create should return empty $data with view
  *
  * @test
  */
 public function testCreateShouldReturnEmptyData()
 {
     $response = \Unit::create();
     $property = $this->getPrivateProperty('Illuminate\\View\\View', 'data');
     $array = $property->getValue($response);
     $this->assertObjectHasAttribute('data', $response);
     $this->assertEmpty($array);
 }
开发者ID:microffice,项目名称:units,代码行数:13,代码来源:UnitHandlerTest.php

示例2: store

 /**
  * Store a newly created unit in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Unit::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $unit = Unit::create($data);
     return Redirect::route('admin.unit.index')->with("successMessage", "Berhasil menyimpan {$unit->nama} ");
 }
开发者ID:inseo201,项目名称:simkinerja,代码行数:14,代码来源:UnitsController.php

示例3: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $size = rand(100, 300);
         $user_id = rand(1, 10);
         Unit::create(['block' => $faker->word(), 'unit_type_id' => rand(1, 9), 'additional_land_area' => $size, 'additional_facility' => rand(0, 1), 'created_by' => $user_id, 'changed_by' => $user_id, 'change_reason' => $faker->realText(100)]);
     }
 }
开发者ID:syafdia,项目名称:PAS,代码行数:9,代码来源:UnitsTableSeeder.php

示例4: store

 /**
  * Store a newly created resource in storage.
  * POST /units
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Unit::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['created_by'] = Auth::user()->id;
     $data['changed_by'] = Auth::user()->id;
     Unit::create($data);
     return Redirect::route('admin.units.index');
 }
开发者ID:syafdia,项目名称:PAS,代码行数:17,代码来源:UnitsController.php

示例5: run

 public function run()
 {
     Unit::create(['name' => 'Kg']);
     Unit::create(['name' => 'Gram']);
     Unit::create(['name' => 'Lít']);
     Unit::create(['name' => 'Mililit']);
     Unit::create(['name' => 'Chai']);
     Unit::create(['name' => 'Gói']);
     Unit::create(['name' => 'Bao']);
     Unit::create(['name' => 'Thùng']);
     Unit::create(['name' => 'Hộp']);
     Unit::create(['name' => 'Lon']);
 }
开发者ID:jimmyhien,项目名称:dailyhuuhoc,代码行数:13,代码来源:UnitsTableSeeder.php

示例6: store

 /**
  * Guarda una nueva unidad en la base de datos
  *
  * @return Response
  */
 public function store($admin)
 {
     $validator = Validator::make($data = Input::all(), Unit::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if (Unit::create($data)) {
         $this->log_action('Unidad Creada', 'La Unidad "' . Input::get('name') . '" ha sido creada.');
         Session::flash('msj', 'La unidad ha sido creada exitosamente');
         return Redirect::route('admin.index', compact('admin'));
     } else {
         Session::flash('msj', 'La unidad ha sido creada exitosamente');
         return Redirect::route('admin.index', compact('admin'));
     }
 }
开发者ID:betancourtfran,项目名称:tep,代码行数:20,代码来源:UnitsController.php

示例7: store

 /**
  * Store a newly created product in storage.
  *
  * @return Response
  */
 public function store()
 {
     Unit::create(Input::all());
     return Response::json(array('success' => true));
 }
开发者ID:jimmyhien,项目名称:dailyhuuhoc,代码行数:10,代码来源:UnitsController.php

示例8: Create

 public static function Create($unit)
 {
     Unit::create(array('name' => $unit->name));
 }
开发者ID:krasaler,项目名称:FamilyStore,代码行数:4,代码来源:UnitService.php

示例9: createUnit

 public function createUnit($attributes = array())
 {
     $unit = new Unit($this->request, $this->getId());
     $unit->create($attributes);
     return $unit;
 }
开发者ID:dadeg,项目名称:php-crowdflower,代码行数:6,代码来源:Job.php

示例10: addNewUnit

 /**
  * Add new unit on the units table
  */
 public function addNewUnit()
 {
     $name = Input::get('name');
     $symbol = Input::get('symbol');
     $save = Unit::create(['name' => $name, 'symbol' => $symbol]);
     return Response::json(['response' => 200, 'msg' => 'Unit has been added.']);
 }
开发者ID:fagray,项目名称:fposs,代码行数:10,代码来源:SettingsController.php


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