當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。