public function run() { Business::create(['type' => 'Nhập', 'name' => 'Nhập hàng']); Business::create(['type' => 'Xuất', 'name' => 'Xuất hàng']); Business::create(['type' => 'Thu', 'name' => 'Thu tiền thanh toán hóa đơn']); Business::create(['type' => 'Thu', 'name' => 'Thu công nợ']); Business::create(['type' => 'Thu', 'name' => 'Thu tạm ứng khách hàng']); Business::create(['type' => 'Thu', 'name' => 'Thu khác']); Business::create(['type' => 'Chi', 'name' => 'Chi hoạt động']); Business::create(['type' => 'Chi', 'name' => 'Chi thanh toán công nợ']); Business::create(['type' => 'Chi', 'name' => 'Chi tạm ứng']); Business::create(['type' => 'Chi', 'name' => 'Chi khác']); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function storeBusiness() { $data = Input::all(); $validateUser = Validator::make($data, Business::$rules, Business::$messages); if ($validateUser->fails()) { $validationMessages = array_merge_recursive($validateUser->messages()->toArray()); return Redirect::back()->withErrors($validationMessages)->withInput(); } $data['business_id'] = DB::table('users')->insertGetId(['email' => $data['email'], 'password' => Hash::make(Input::get('password')), 'roll' => 'business']); Business::create($data); Mail::send('emails.business_registration', ['data' => $data], function ($message) use($data) { $message->to($data['email'])->subject('Thanks for signing up!'); }); return view('home'); }
public function new_businessAction() { if ($this->request->isPost()) { $countryId = $this->request->getPost('country_id'); $country = Countries::findFirst(array('columns' => '*', 'conditions' => 'id LIKE :id:', 'bind' => array('id' => $countryId))); $countryName = ''; if ($country) { $countryName = $country->country; } $address = str_replace(' ', '+', $this->request->getPost('street') . '+' . $this->request->getPost('city') . '+' . $countryName); $userSession = $this->session->get("userSession"); $content = file_get_contents('https://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&key=AIzaSyAbpLPfBH8sNdVSzMULD_BZN9qrAqbL3V8'); $json = json_decode($content, true); $lat = $json['results'][0]['geometry']['location']['lat']; $lng = $json['results'][0]['geometry']['location']['lng']; //error_log('LAT : '.$lat.' LONG : '.$lng); $business = new Business(); $business->created = date('Y-m-d H:i:s'); $business->modified = date('Y-m-d H:i:s'); $business->member_id = $userSession['id']; $business->name = $this->request->getPost('name'); $business->website = $this->request->getPost('website'); $business->telephone = $this->request->getPost('telephone'); $business->street = $this->request->getPost('street'); $business->city = $this->request->getPost('city'); $business->country_id = $this->request->getPost('country_id'); $business->lat = $lat; $business->lng = $lng; $business->average_rate = $this->request->getPost('rate'); if (!empty($this->request->getPost('review'))) { $business->total_review = 1; } $opened = ''; if (!empty($this->request->getPost('opened'))) { $opened = 'Opened'; } if (empty($this->request->getPost('opened'))) { $opened = 'Opening Soon'; } $business->opened = $opened; //$business->business_category_id = $this->request->getPost('business_category_id'); // $business->business_sub_category_id = $this->request->getPost('business_sub_category_id'); // $business->business_asub_category_id = $this->request->getPost('business_asub_category_id'); if ($business->create()) { $id = $business->id; if (!empty($this->request->getPost('business_category_ids'))) { $bCtegories = $this->request->getPost('business_category_ids'); $bCtegoryIds = explode(',', $bCtegories); foreach ($bCtegoryIds as $key => $bCtegoryId) { $businessCategoryLists = new BusinessCategoryLists(); $businessCategoryLists->created = date('Y-m-d H:i:s'); $businessCategoryLists->business_id = $id; $businessCategoryLists->business_category_id = $bCtegoryId; $businessCategoryLists->create(); } } $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>New business has been created'); if (!empty($this->request->getPost('review'))) { $review = new Reviews(); $review->created = date('Y-m-d H:i:s'); $review->modified = date('Y-m-d H:i:s'); $review->member_id = $userSession['id']; $review->business_id = $business->id; $review->content = $this->request->getPost('review'); $review->rate = $this->request->getPost('rate'); if ($review->create()) { $this->flash->success('<button type="button" class="close" data-dismiss="alert">×</button>You\'re review has been submitted.'); } } return $this->response->redirect('business/view/' . $id); } } $countries = Countries::find(); $this->view->setVar('countries', $countries); $businessCategories = BusinessCategories::find(); $this->view->setVar('businessCategories', $businessCategories); }
/** * Store a newly created product in storage. * * @return Response */ public function store() { Business::create(Input::all()); return Response::json(array('success' => true, 'message' => array('type' => 'success', 'msg' => 'Thêm nghiệp vụ thành công!'))); }
public function complete_store() { $rules = array('password' => 'required|min:6|confirmed', 'password_confirmation' => 'required|min:6'); $validator = Validator::make($data = Input::all(), $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $final_data = Session::get('data'); $data = array_merge($final_data, $data); $user_name = explode(' ', $data['full_name']); $data['fname'] = isset($user_name[0]) ? $user_name[0] : ''; $data['lname'] = isset($user_name[1]) ? $user_name[1] : ''; $plain_password = $data['password']; $data['password'] = Hash::make($data['password']); $user = User::create($data); $user->role = 2; $venu = Venue::create($data); $profile = Profile::create($data); $data['name'] = $data['business_name']; unset($data['business_name']); $business = Business::create($data); $business->user_id = $user->id; $profile->user_id = $user->id; $venu->business_id = $business->id; $user->save(); $business->save(); $profile->save(); $venu->save(); $where = array("email" => $user->email, 'password' => $plain_password); if (Auth::attempt($where)) { return Redirect::to('/business/dashboard/')->with('message', 'Successfully Login!'); } return Redirect::to('/')->with('message', 'Signed up succesflly'); }