Пример #1
0
 /**
  * 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
0
 /**
  * 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
0
 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
0
 /**
  * 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
0
 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
0
 /**
  * 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
0
 /**
  * Store a newly created product in storage.
  *
  * @return Response
  */
 public function store()
 {
     Unit::create(Input::all());
     return Response::json(array('success' => true));
 }
Пример #8
0
 public static function Create($unit)
 {
     Unit::create(array('name' => $unit->name));
 }
Пример #9
0
 public function createUnit($attributes = array())
 {
     $unit = new Unit($this->request, $this->getId());
     $unit->create($attributes);
     return $unit;
 }
Пример #10
0
 /**
  * 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.']);
 }