本文整理汇总了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);
}
示例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} ");
}
示例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)]);
}
}
示例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');
}
示例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']);
}
示例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'));
}
}
示例7: store
/**
* Store a newly created product in storage.
*
* @return Response
*/
public function store()
{
Unit::create(Input::all());
return Response::json(array('success' => true));
}
示例8: Create
public static function Create($unit)
{
Unit::create(array('name' => $unit->name));
}
示例9: createUnit
public function createUnit($attributes = array())
{
$unit = new Unit($this->request, $this->getId());
$unit->create($attributes);
return $unit;
}
示例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.']);
}