public function store() { $rules = ['name' => 'required', 'vat_number' => 'required', 'address' => 'required', 'postal_code' => 'required', 'email' => 'required|email', 'phone' => 'required', 'category_id' => 'required', 'city_id' => 'required']; $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } else { $company = CompanyModel::find(Session::get('company_id')); $password = Input::get('password'); if ($password !== '') { $company->secure_key = md5($company->salt . $password); } $company->name = Input::get('name'); $company->vat_number = Input::get('vat_number'); $company->address = Input::get('address'); $company->postal_code = Input::get('postal_code'); $company->email = Input::get('email'); $company->phone = Input::get('phone'); $company->category_id = Input::get('category_id'); $company->city_id = Input::get('city_id'); $company->save(); $alert['msg'] = 'Account has been saved successfully'; $alert['type'] = 'success'; return Redirect::route('company.account')->with('alert', $alert); } }
public function doLogin() { $email = Input::get('email'); $password = Input::get('password'); $company = CompanyModel::whereRaw('email = ? and secure_key = md5(concat(salt, ?))', array($email, $password))->get(); if (count($company) != 0) { Session::set('company_id', $company[0]->id); return Redirect::route('company.dashboard'); } else { $alert['msg'] = 'Invalid Email and Password'; $alert['type'] = 'danger'; return Redirect::route('company.auth.login')->with('alert', $alert); } }
public function estimateReport($company_symbol, $second_title) { $second_title_found = Company::find_company_name_comp_id($company_symbol); if ($second_title_found) { if (!$second_title || $second_title == $company_symbol) { return Redirect::route('home-estimate', array($company_symbol, url_maker($second_title_found))); } } else { return Redirect::route('404'); } $interval = Input::get('interval'); $total = Input::get('total'); Company::update_chapter_view($company_symbol); //<---this updates the view count of chapter $previous_data = CompanyData::Check_recod_exists_by_company_symbol($company_symbol); $interval = isset($interval) && !empty($interval) ? $interval : 'd'; $precision = $previous_data ? $previous_data : 1; $stock_market = new StockMarket($company_symbol, $interval, $precision); //<---class declared here and passed the datas $company_name = $stock_market->find_company_name_from_symbol(); if ($company_name) { //<-- if company name given is not false go further $stock_records = $stock_market->get_the_market_data(); //<--function to collect Historical data for given company symbol } if (!$stock_records) { return Redirect::route('404'); } else { $buy_level = $stock_market->get_prediction_buy_level(); //<--this function helps to predict the buying level mark $sell_level = $stock_market->get_prediction_sell_level(); //<--this function helps to predict the selling level mark $compan_details = $stock_market->get_company_description(); //<--get the stored company Descriptions $prediction = Prediction::update_predicted_data($company_symbol, $precision); //<--class declaration/ find to update for prediction if ($prediction) { $company_id = Company::find_company_id_company_symbol($company_symbol); $ipLite = new ip2locationlite(); $ipLite->setKey('516921f89d86829aafa20f18ff7408fe4f2e974d114b53593f56a91ab7a286cc'); $locations = $ipLite->getCity($_SERVER['REMOTE_ADDR']); $ge_countryName = !empty($locations) && is_array($locations) ? $locations['cityName'] : "undeclared"; $prediction = Prediction::where('comp_id_fk', '=', $company_id)->delete(); $company = Prediction::create(array('comp_id_fk' => $company_id, 'buy_level' => trim($buy_level), 'sell_level' => trim($sell_level), 'accuracy' => $precision, 'updated' => date("Y-m-d H:i:s", time()), 'host' => $ge_countryName)); } } $meta_data = array('title' => ucwords($company_name) . " Stock Market Value Prediction Result :: StockLength.com To Check Your Risk Level On Stock Market", 'metaDescription' => ucwords($company_name) . ' find online Prediction Stock Market Informer, Online free tool to check stockmarket future ' . ucwords($company_name) . ', Online free selling buyer sujection, Featured Predict Stock Market, free fast Online Check and reviews ' . ucwords($company_name) . '. Latest updates on everything Predict Stock Market related.', 'company_symbol' => $company_symbol, 'precision' => $precision, 'fb_image' => return_image($company_symbol . '.jpeg')); return View::make('estimate', array('meta_data' => $meta_data, 'company_name' => $company_name, 'compan_details' => $compan_details, 'stock_records' => $stock_records, 'stock_market' => $stock_market, 'buy_level' => $buy_level, 'sell_level' => $sell_level, 'precision' => $precision, 'records' => parent::latestPredictions(), 'tickers' => parent::getTicker(), 'company_symbol' => $company_symbol, 'page_checker' => true)); }
public function sitemapCreater() { echo '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84">'; $articles = Company::Read_data_sitemap(); if ($articles) { foreach ($articles as $record) { $company_symbol = $record->company_symbol; $company_name = $record->company_name; $created = $record->created; $displaydate = date("Y-m-d", strtotime($created)); $url_product = URL::route('home-estimate', array($company_symbol, url_maker($company_name))); sitemapper($url_product, $displaydate); } } echo '</urlset>'; $contents = View::make('sitemap.view_sitemap'); // Create a response and modify a header value $response = Response::make($contents, 200)->header('Content-Type', 'text/xml'); return $response; }