/** * Store a newly created resource in storage. * POST /companies * * @return Response */ public function store() { $input = Input::all(); $v = Validator::make($input, Company::$rules); if ($v->passes()) { $this->company = $this->company->create($input); Configuration::updateValue('DEF_COMPANY', $this->company->id); return Redirect::route('companies.index')->with('info', 'El registro se ha creado correctamente: ' . $input['name_fiscal']); } return Redirect::route('companies.create')->withInput()->withErrors($v)->with('message_error', 'There were validation errors'); }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('addresses')->delete(); $aconfigurations = array(array('id' => '1', 'alias' => 'Main Address', 'model_name' => 'Company', 'name_commercial' => 'Wath, Ltd.', 'address1' => '123th Fake St.', 'address2' => 'duplicado', 'postcode' => '28001', 'city' => 'Alcafrán', 'state' => 'Madrid', 'country' => 'España', 'firstname' => '', 'lastname' => '', 'email' => '*****@*****.**', 'phone' => '911234567', 'phone_mobile' => '618121200', 'fax' => '', 'notes' => '', 'active' => '1', 'owner_id' => '1', 'created_at' => \Carbon\Carbon::createFromDate(2015, 03, 31)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString())); // Uncomment the below to run the seeder DB::table('addresses')->insert($aconfigurations); // Uncomment the below to wipe the table clean before populating DB::table('companies')->delete(); $configurations = array(array('id' => '1', 'name_fiscal' => 'Work at Home, Ltd.', 'name_commercial' => 'Wath, Ltd.', 'identification' => '12345678E', 'website' => '', 'notes' => '', 'address_id' => '1', 'currency_id' => '1', 'created_at' => \Carbon\Carbon::createFromDate(2015, 03, 31)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString())); // Uncomment the below to run the seeder DB::table('companies')->insert($configurations); Configuration::updateValue('DEF_COMPANY', 1); }