/** * Show the application dashboard to the user. * * @return Response */ public function index() { echo 'id:' . Auth::user()->id . '<br>'; echo 'username:'******'<br>'; dd(Auth::user()); //return view('frontend.index'); }
public function redirect(Request $r) { $credentials = PagSeguro::credentials()->get(); $transaction = PagSeguro::transaction()->get('123', $credentials); $information = $transaction->getInformation(); dd($information); }
public static function testSQL() { $options = []; $q = Processor::table('Customer_lubri')->where('member_id', 'NOT LIKE', 'CT%')->where(self::getOr($options))->orderBy('member_id', 'DESC'); pr(get_class($q)); dd(Processor::toSql($q)); }
public function loginWithFacebook() { // get data from input $code = Input::get('code'); // get fb service $fb = OAuth::consumer('Facebook'); // check if code is valid // if code is provided get user data and sign in if (!empty($code)) { // This was a callback request from facebook, get the token $token = $fb->requestAccessToken($code); // Send a request with it $result = json_decode($fb->request('/me'), true); $message = 'Your unique facebook user id is: ' . $result['id'] . ' and your name is ' . $result['name']; echo $message . "<br/>"; //Var_dump //display whole array(). dd($result); } else { // get fb authorization $url = $fb->getAuthorizationUri(); // return to facebook login url return Redirect::to((string) $url); } }
public static function setWSImoveis() { set_time_limit(160); foreach (WSImoveis::getWSImoveis() as $i) { if (Imovel::find($i['id']) == null) { Imovel::create($i); } else { $imovel = Imovel::find($i['id']); dd($i); $imovel->nome = $i['nome']; $imovel->uf = $i['uf']; $imovel->valor = $i['preco_venda']; $imovel->quartos = $i['quartos']; $imovel->vagas = $i['vagas_garagem']; $imovel->negociacao = $i['negociacao']; $imovel->bairro = $i['bairro']; $imovel->cidade = $i['cidade']; $imovel->cep = $i['cep']; $imovel->observacao = $i['obs']; foreach ($i['foto'] as $f) { if (!is_null($f['arquivo'])) { $imagem['nome'] = $f['arquivo']; $imagem['url'] = "http://mariano.softcomsistemas.com.br/uploaded/images/" . $f['arquivo']; $imagem['imovel_id'] = $i['id']; ImovelImagem::create($imagem); } } $imovel->save(); } } }
/** * Display a listing of the resource. *This method will show all the users within this webbapplication * @return \Illuminate\Http\Response */ public function index() { $users = User::all(); dd($users); // $data = array('users' => $users); // return view('projectresult', compact('users')); }
public function adddata($data) { dd($data); $str = ''; if ($data['category_id']) { $arr = explode("-", $data['category_id']); $data['category_id'] = (int) $arr[1]; } if (is_array($data['trading'])) { foreach ($data['trading'] as $v) { $str .= $v . ","; } $data['trading'] = $str; $str = ""; } if (is_array($data['tags'])) { foreach ($data['tags'] as $v) { $str .= $v . ","; } $data['tags'] = $str; $str = ""; } // $result = $this->save($data); if ($this->create($data)) { return true; } else { return false; } }
public function index() { $requests = $this->subscriptionRepository->getAll(['user,event']); dd($requests); $requests = $this->status->with(array('user', 'event'))->latest()->get(); return View::make('admin.requests.index', compact('requests')); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $client = false; if ($this->method() == 'PATCH') { $routeAction = $this->route()->getAction(); $routeParameters = $this->route()->parameters(); $tid = false; if (isset($routeParameters['ticketId'])) { $tid = $routeParameters['ticketId']; } else { if (isset($routeParameters['one'])) { $tid = $routeParameters['one']; } } $ticket = \App\Ticket::find($tid); if (!$ticket) { dd('error'); } } switch ($this->method()) { case 'GET': case 'DELETE': return []; case 'PUT': return ['title' => 'required', 'status_id' => 'required', 'priority' => 'required']; case 'PATCH': return ['title' => 'required', 'status_id' => 'required', 'priority' => 'required']; default: return []; break; } }
public function postLogin() { $input = Input::all(); $rules = array('username' => 'required', 'password' => 'required'); $validator = Validator::make($input, $rules); if ($validator->fails()) { return Redirect::to('account/login')->withErrors($validator); } try { // Set login credentials $credentials = array('username' => $input['username'], 'password' => $input['password']); // Try to authenticate the user $user = Sentry::authenticate($credentials, Input::get('remember', false)); Event::fire('user.login', array($user)); $redirect = Session::get('redirect'); if ($redirect) { return Redirect::to($redirect); } else { return Redirect::to('/'); } } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { dd($e); return Redirect::to('account/login')->withErrors(array('Login field is required.')); } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { return Redirect::to('account/login')->withErrors(array('Password field is required.')); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { return Redirect::to('account/login')->withErrors(array('User was not found.')); } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) { return Redirect::to('account/login')->withErrors(array('User is not activated.')); } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) { return Redirect::to('account/login')->withErrors(array('User is suspended.')); } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) { return Redirect::to('account/login')->withErrors(array('User is banned.')); } }
public function getBuild() { // Get list of maps $zones = file_get_contents('http://xivdb.com/modules/maps/js/zones.js'); $zones = explode("\n", $zones); // First two and last two are junk $junk = []; $junk[] = array_shift($zones); $junk[] = array_shift($zones); $junk[] = array_pop($zones); $junk[] = array_pop($zones); $regions = []; foreach ($zones as $z) { $z = trim($z); preg_match('/^gmap\\.MapDefines\\[(\\d+)\\] = (.*)$/', $z, $matches); $id = $matches[1]; $json = json_decode($matches[2]); if (!is_array($json)) { dd($json); } $regions[$id] = $json; } foreach ($regions as &$region) { foreach ($region as &$map) { $map = $this->get_map($map); } } file_put_contents(FileHandler::path() . 'maps.json', json_encode($regions)); flash()->message('Map JSON Builder finished'); return redirect('/osmose'); }
protected function _finish($code, $originalRedirectUri) { // This endpoint requires "Basic" auth. $clientCredentials = $this->appInfo->getKey() . ":" . $this->appInfo->getSecret(); $authHeaderValue = "Basic " . base64_encode($clientCredentials); $response = RequestUtil::doPostWithSpecificAuth($this->clientIdentifier, $authHeaderValue, $this->userLocale, $this->appInfo->getHost()->getApi(), "1/oauth2/token", array("grant_type" => "authorization_code", "code" => $code, "redirect_uri" => $originalRedirectUri)); if ($response->statusCode !== 200) { throw RequestUtil::unexpectedStatus($response); } $parts = RequestUtil::parseResponseJson($response->body); if (!array_key_exists('token_type', $parts) || !is_string($parts['token_type'])) { throw new Exception_BadResponse("Missing \"token_type\" field."); } $tokenType = $parts['token_type']; dd($token_type); if (!array_key_exists('access_token', $parts) || !is_string($parts['access_token'])) { throw new Exception_BadResponse("Missing \"access_token\" field."); } $accessToken = $parts['access_token']; if (!array_key_exists('uid', $parts) || !is_string($parts['uid'])) { throw new Exception_BadResponse("Missing \"uid\" string field."); } $userId = $parts['uid']; if ($tokenType !== "Bearer" && $tokenType !== "bearer") { throw new Exception_BadResponse("Unknown \"token_type\"; expecting \"Bearer\", got " . Util::q($tokenType)); } return array($accessToken, $userId); }
public function getVeryfied() { //$users = User::paginate(4); //return view('usuarios.index',compact('users'));; dd('controlador registro metodo verificado'); //return view('usuario.verif'); }
/** * */ public function login() { $user = $this->provider->user(Input::get('code')); dd($user); Auth::login($user); return Redirect::home(); }
public function store() { //存储数据 $market = new Market(); $market->title1 = $this->request->get('title1'); $market->sc_price = $this->request->get('sc_price'); $market->cb_price = $this->request->get('cb_price'); $market->desc = $this->request->get('desc'); $market->amount = $this->request->get('amount'); $market->rank = $this->request->get('rank'); $market->alibaba1 = $this->request->get('alibaba1'); $market->alibaba2 = $this->request->get('alibaba2'); $market->investigators = $this->request->get('investigators'); $market->save(); //获取图片 $images = $this->request->file('images'); foreach ($images as $image) { //获取图片名称 $fileName = md5(uniqid(str_random(10))); // try { \Image::make($image)->resize(100, 100)->save('uploads/images/' . $fileName . '.jpg'); //存储图片 $marketImage = new MarketImage(); $marketImage->image = 'uploads/images/' . $fileName . '.jpg'; $marketImage->market_id = $market->id; $marketImage->save(); } catch (\Exception $e) { //图片上传失败 dd($e->getMessage()); } } //通过循环存储照片 }
public function testMethodCalls() { $id = uniqid('testMethodCallId'); $pass = [$id]; $expect = [$id, $this]; $this->applicationMock->expects($this->any())->method('make')->will($this->returnCallback(function ($make) { switch ($make) { case 'request': return $this->requestMock; case 'commode.common.resolver': return $this->resolver; case 'LaravelCommode\\Common\\Controllers\\CommodeControllerTest': return $this; } dd(func_get_args()); })); $this->requestMock->expects($this->at(0))->method('ajax')->will($this->returnValue(false)); $this->requestMock->expects($this->at(1))->method('ajax')->will($this->returnValue(false)); $this->requestMock->expects($this->at(2))->method('ajax')->will($this->returnValue(true)); $resolveMethodsReflection = new ReflectionProperty($this->controller, 'resolveMethods'); $resolveMethodsReflection->setAccessible(true); $resolveMethodsReflection->setValue($this->controller, false); $this->assertSame($pass, $this->controller->callAction('getSomeMethod', $pass)); $resolveMethodsReflection->setValue($this->controller, true); $this->assertSame($expect, $this->controller->callAction('getSomeMethodResolve', $pass)); $separateRequestsReflection = new ReflectionProperty($this->controller, 'separateRequests'); $separateRequestsReflection->setAccessible(true); $separateRequestsReflection->setValue($this->controller, true); $this->requestMock->expects($this->any())->method('ajax')->will($this->returnValue(true)); $this->assertSame($expect, $this->controller->callAction('getSomeMethodResolve', $pass)); }
public static function boot() { parent::boot(); static::deleting(function ($item) { dd('Deleting event handler executed on item #' . $item->id); }); }
protected function process(UploadedFile $image, array $imageDimensions = []) { $this->setHashedName($image); try { foreach ($imageDimensions as $imageDimension) { switch ($imageDimension) { case 'large': Image::make($image->getRealPath())->resize($this->largeImageWidth, $this->largeImageHeight)->save($this->largeImagePath . $this->hashedName); break; case 'medium': Image::make($image->getRealPath())->resize($this->mediumImageWidth, $this->mediumImageHeight)->save($this->mediumImagePath . $this->hashedName); break; case 'thumbnail': Image::make($image->getRealPath())->resize($this->thumbnailImageWidth, $this->thumbnailImageHeight)->save($this->thumbnailImagePath . $this->hashedName); break; default: break; } } } catch (Exception $e) { dd($e->getMessage()); $this->addError($e->getMessage()); return false; } return $this; }
protected function handleException(Throwable $e) { if (response()->getCode() == 200) { response()->code(404); } $code = $e->getCode() ? $e->getCode() : response()->getCode(); $message = $e->getMessage(); if (class_exists(DeriveAssets::class)) { Reflect::create(DeriveAssets::class)->register(); } $handled = false; $codes = [$code, 'default']; foreach ($codes as $file) { try { $response = view('Pckg\\Framework:error/' . $file, ['message' => $message, 'code' => $code, 'exception' => $e])->autoparse(); if ($response) { $handled = true; break; } } catch (Throwable $e) { dd(exception($e)); } } if ($handled) { echo $response; } else { echo $code . ' : ' . $message; } exit; }
/** * @return View */ public function getIndex(SettingsManager $manager) { $settings = $manager->getGroups(); //$settings = \(new Manager(Mod))-> dd($settings); return $this->view('index'); }
public function process($dataset) { foreach ($dataset as $data) { $raw = json_decode($data, true); $lanes = $raw['_embedded']['lanes']; foreach ($lanes as $lane) { $categories = $lane['_embedded']['items']; foreach ($categories as $categorie) { if ($categorie['resourceType'] == 'Product') { $productLabel = $categorie['_embedded']['productCard']; //var_dump($productLabel); $product = []; $product['categorie'] = $productLabel['label']; $product['name'] = $productLabel['navItem']['title']; $productCard = $productLabel['_embedded']['product']; //var_dump($productCard); $product['unitSize'] = $productCard['unitSize']; $product['price']['orginalPrice'] = $productCard['priceLabel']['was']; $product['price']['actionPrice'] = $productCard['priceLabel']['now']; $product['period'] = $productCard['discount']['period']; $product['AHid'] = $productCard['id']; //dd($categorie); var_dump($product); dd('doei'); } } } } }
/** * * @return Response */ public function store(RegisterCommentProviderRequest $request) { try { $dataProvider = $request->all(); $objProvider = PrComments::whereUserId($this->_identity->id)->wherePrProviderId($dataProvider['pr_provider_id'])->first(); if ($objProvider == null) { $dataProvider['user_id'] = $this->_identity->id; if (isset($dataProvider['picture'])) { $file = base64_decode($dataProvider['picture']); $pathrelative = "/dinamic/pr_comment/" . date('YmdHis') . rand(1, 1000) . ".jpg"; $path = App::publicPath() . $pathrelative; file_put_contents($path, $file); $dataProvider['picture'] = $pathrelative; } $objProvider = PrComments::create($dataProvider); DB::select("call score_provider(" . $dataProvider['pr_provider_id'] . "," . $dataProvider['punctuation'] . ")"); $msg = 'ok'; } else { $msg = 'Usted ya ha valorado al proveedor'; } $this->_responseWS->setDataResponse(Response::HTTP_OK, ['id' => $objProvider->id], [], $msg); } catch (\Exception $exc) { dd($exc->getMessage()); $this->_responseWS->setDataResponse(Response::HTTP_INTERNAL_SERVER_ERROR, [], [], ''); } $this->_responseWS->response(); }
/** * @param \Illuminate\Http\Request $request * @param callable $next * * @return mixed */ public function handle($request, Closure $next, $permissions = null, $any = true, $branch_id = null) { $checkPermissions = explode('|', $permissions); // Laravel 5.1 - Using parameters $any = $this->getBool($any); if (!is_null($branch_id)) { $branch_id = (int) $branch_id; } if (is_null($permissions)) { $checkPermissions = $this->getPermissions($request); $any = $this->getAny($request); $branch_id = $this->getBranchId($request); } if (is_null($this->user)) { return $this->forbiddenResponse(); } if ($branch_id == 0) { $branch_id = null; } dd([$checkPermissions, $any, $branch_id]); $hasPermission = $this->user->hasPermission($checkPermissions, $any, $branch_id); if (!$hasPermission) { return $this->forbiddenResponse(); } return $next($request); }
public function Response(Request $request, $id) { $uri = $request->path(); $method = $request->method(); if ($request->is('countries')) { if ($request->has('filter')) { $zones = CountryAdapter::zoneByName($request->filter); } else { $zones = CountryAdapter::zones(); } return $this->apiOutput(function () use($zones) { $data = array(); foreach ($zones as $i => $zone) { $tmp_data[$i] = ['zone' => $zone->name, 'countries' => CountryAdapter::getByZone($zone)]; array_push($data, $tmp_data[$i]); } return $data; }); } elseif ($request->is('countries/*')) { $country = CountryAdapter::getById($id); return $this->apiOutput(function () use($country) { $zone = CountryAdapter::zoneById($country->zone_id); $country_data = ['id' => intval($country->numeric_code), 'name' => $country->name, 'zone' => $zone->name, 'alpha2' => $country->alpha2, 'alpha3' => $country->alpha3]; return $country_data; }); } else { dd('error'); } }
/** * Store a newly created resource in storage. * * @param AdduserRequest $request * @return \Illuminate\Http\Response */ public function store(AdduserRequest $request) { // $input = $request->all(); // get all data // $input['confirmed'] = 1; // set confirmed to 1 // $input['password'] = Hash::make($input['password']); // hash password // // $user = User::create($input); // save above details $user = User::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'email' => $request->email, 'confirmed' => 1, 'password' => Hash::make($request->password)]); // $profile = $user->profile()->save(new Profile); // also create new profile // $profile->apartment_id = Auth::user()->profile->defaultApartment; // get current defaultApartment // $profile->save(); // save details on profile $profile = Profile::create(['user_id' => $user->id, 'apartment_id' => Auth::user()->profile->defaultApartment]); dd(Auth::user()->profile->defaultApartment); $role = Role::whereName('user')->first(); $user->assignRole($role); //Assign Role $block_no = $request->blockno; // get block_no from profileform $floor_no = $request->floorno; // get floor_no from profileform $profile->apartments()->attach($profile->defaultApartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]); // attach this profile with default apartment, with approved = 1, and block_no, floor_no according to profileform in apartment_profile pivot table. Crm_account::create(['account' => $user->first_name . $user->last_name, 'fname' => $user->first_name, 'lname' => $user->last_name, 'company' => 'Company Name', 'email' => $user->email, 'address' => 'Current Address', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'zip' => '440012', 'country' => 'India']); return redirect()->back()->withMessage('User has been Added')->withStatus('success'); }
public function save_post() { // SET VALIDATION RULES $this->load->library('form_validation'); $this->form_validation->set_rules('txt_title', 'Tiêu đề', 'required'); $this->form_validation->set_error_delimiters('<em>', '</em>'); if ($this->input->post('login')) { if ($this->form_validation->run()) { dd("save ^^"); } } ?> <?php if ($this->session->flashdata('message')) { ?> <p><?php echo $this->session->flashdata('message'); ?> </p> <?php } ?> <?php $this->load->model('User'); $data["user_id"] = $this->input->post("txt_id"); $data["user_name"] = $this->input->post("txt_name"); $data["user_address"] = $this->input->post("txt_address"); $data["user_phone"] = $this->input->post("txt_phone"); if ($this->User->IU($data)) { redirect('/user/', 'refresh'); } else { redirect('/404', 'refresh'); } }
protected function create() { $route = Helpers::routeinfo(); /* $event = Conference::where('slug', '=', $route->params['conference']) ->published() ->latest(); */ $events = Lookup::lookup('conferences', [$route->params['conference']], ['latest' => true, 'published' => true]); $event = $events[0]; $options = Helpers::unserialize($event->options); $options['speakers'] = false; $options['sponsors'] = false; $options['partners'] = false; $options = Helpers::options($route, $route->params['conference']); $newEvent = Conference::create(['slug' => $route->params['conference'], 'conference' => $event->conference, 'city' => $event->city, 'state' => $event->state, 'start_date' => Carbon::createFromFormat('Y-m-d H:i:s', $event->start_date)->addYear(), 'end_date' => Carbon::createFromFormat('Y-m-d H:i:s', $event->end_date)->addYear(), 'timezone' => $event->timezone, 'coming' => 1, 'about' => $event->about, 'tags' => $event->tags, 'options' => Helpers::serialize($options), 'hero' => $event->hero, 'photo' => $event->photo, 'published' => Carbon::now()]); $newEvent = (object) $newEvent->toArray(); $newAgendas = []; $agendas = Lookup::lookup('agendas', ['conference' => $event->id], ['published' => true]); if (is_array($agendas)) { foreach ($agendas as $agenda) { $agenda->conference_id = $newEvent->id; $agenda->timeslot = Carbon::createFromFormat('Y-m-d H:i:s', $agenda->timeslot)->addYear(); $agenda->title = $agenda->type === 'breakout' || $agenda->type === 'session' ? 'Breakout Session' : ($agenda->type === 'break' ? $agenda->title : 'Keynote'); $agenda->title_short = $agenda->type === 'breakout' || $agenda->type === 'session' ? 'Breakout Session' : ($agenda->type === 'break' ? $agenda->title : 'Keynote'); $agenda->subtitle = null; $agenda->desc = null; $agenda->speakers = null; $agenda->published = Carbon::now(); $newAgendas[] = Agenda::create((array) $agenda); } } $container = (object) ['event' => (object) $newEvent, 'agendas' => (object) $newAgendas]; dd($newEvent); }
public function facebook_callback() { try { $user = Socialite::with('facebook')->fields(['first_name', 'last_name', 'email', 'gender', 'birthday'])->user(); dd($user); } catch (Exception $e) { return redirect('home'); } if ($user->getEmail() == null) { //return redirect('auth/register'); } else { $array_facebook = array('user_type_code' => 'seeker', 'email' => $user->getEmail(), 'user_f_name' => $user['first_name'], 'user_l_name' => $user['last_name']); // print_r($user->getEmail()); /* $userex=DB::table('users')->where('email',$user->getEmail())->first(); if($userex != null) { DB::table('users') ->where('user_id',$userex->user_id) ->update($array_facebook); } else { // WebUser::create($array_facebook); } */ // Session::set('emailId', $user->getEmail()); Session::set('name', $user['first_name'] . " " . $user['last_name']); // $userdatas = DB::table('web_users_v')->where('email',$user->getEmail())->first(); //Session::set('user_id', $userdatas->user_id); $redirect_url = Session::has('fb_redirect_url') ? Session::get('fb_redirect_url') : 'myaccount'; return redirect($redirect_url); } }
/** * Show the form for creating a new resource. * @param $request * @return Response */ public function decode(Request $request) { $path = $request['path']; dd($path); $points = GeoHelper::decode($path); return response()->json($points, 200); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { dd(1111); $advert = new Advert(); $advert->create($request->all()); return redirect()->route('/'); }