/**
  * Attribution pixel
  *
  * @param  PixelRequest $request
  * @return Image
  */
 public function store(PixelRequest $request)
 {
     $this->agent->setUserAgent($request->header('user-agent'));
     ignore_user_abort(true);
     // Turn off gzip compression
     if (function_exists('apache_setenv')) {
         apache_setenv('no-gzip', 1);
     }
     ini_set('zlib.output_compression', 0);
     // Turn on output buffering if necessary
     if (ob_get_level() == 0) {
         ob_start();
     }
     // Remove any content encoding
     header('Content-encoding: none', true);
     if (!$request->isMethod('post')) {
         // Create attribution entry
         $attribution = Attribution::create(['landing_page_id' => $request->get('lp'), 'email' => $request->get('em'), 'tracking_id' => $request->get('t'), 'converting_source' => $request->get('cs'), 'converting_medium' => $request->get('cm'), 'converting_keyword' => $request->get('ck'), 'converting_content' => $request->get('ccn'), 'converting_campaign' => $request->get('cc'), 'converting_landing_page' => $request->get('cl'), 'converting_timestamp' => Carbon::createFromTimeStamp($request->get('ct'))->toDateTimeString(), 'original_source' => $request->get('os'), 'original_medium' => $request->get('om'), 'original_keyword' => $request->get('ok'), 'original_content' => $request->get('ocn'), 'original_campaign' => $request->get('oc'), 'original_landing_page' => $request->get('ol'), 'original_timestamp' => Carbon::createFromTimeStamp($request->get('ot'))->toDateTimeString(), 'refer_url' => $request->get('r'), 'platform' => $this->agent->platform(), 'device' => $this->agent->device(), 'browser' => $this->agent->browser(), 'version' => $this->agent->version($this->agent->browser())]);
         // Link attribution entry to lead
         \Event::fire(new AttributionSubmitted($attribution));
         // Return 1x1 pixel transparent gif
         header("Content-type: image/gif");
         header("Content-Length: 42");
         header("Cache-Control: private, no-cache, no-cache=Set-Cookie, proxy-revalidate");
         header("Pragma: no-cache");
         echo base64_decode('R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEA');
     }
     // Flush output buffers
     ob_flush();
     flush();
     ob_end_flush();
 }
 public function storeWeb(Request $request)
 {
     //Process Gravity Form Fields to match Database
     $input = $request->all();
     $input['type'] = 'Sailing School';
     !empty($input['dest_grenada']) ? $input['destination'] = 'Grenada' : ($input['destination'] = '');
     !empty($input['dest_stvincent']) ? $input['destination'] .= ' St. Vincent' : $input['destination'];
     !empty($input['boat_monohull']) ? $input['boat_type'] = 'Monohull' : ($input['boat_type'] = '');
     !empty($input['boat_catamaran']) ? $input['boat_type'] .= ' Catamaran' : $input['boat_type'];
     !empty($input['newsletter']) ? $input['newsletter'] = 1 : ($input['newsletter'] = 0);
     Log::info($input);
     $user = User::where('email', $input['email'])->first();
     if (!$user) {
         $this->user->store($request);
         $user = User::where('email', $input['email'])->first();
     }
     if (!$user->types()->where('user_types.id', 1)->first()) {
         $user->types()->attach([1]);
     }
     //@TODO: Use this form to capture inquiries for Charters, Boat Buying and Selling
     $input['user_id'] = $user->id;
     $inquiry = Inquiry::create(['user_id' => $input['user_id'], 'type' => $input['type'], 'destination' => $input['destination'], 'boat_type' => $input['boat_type'], 'notes' => $input['notes']]);
     //Create a Note
     $note = $user->notes()->create(['note_date' => Carbon::now(), 'title' => 'Website Inquiry', 'note_type' => 'Inquiry', 'create_user_id' => User::where('email', '*****@*****.**')->first()->id, 'note' => $input['notes']]);
     //Schedule Initial Inquiry Response for 37 Minutes after Inquiry
     $this->scheduleInitialResponse($user);
     //Fire Prospect Inquiry Scheduled Responses.
     \Event::fire(new ScheduleResponse($inquiry));
     //Mail::raw('Test Booking',function($message){$message->to('*****@*****.**'); $message->from('*****@*****.**');});
     return $request->all();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $resturant = new Resturant();
     $request_data = $request->input('request');
     $parsed_object = json_decode($request_data, true);
     $resturant->name = $parsed_object['name'];
     $resturant->address = $parsed_object['address'];
     $resturant->phone = $parsed_object['phone'];
     $resturant->email = $parsed_object['email'];
     $resturant->subscription_plan_id = $parsed_object['plan'];
     $resturant->save();
     $user = new User();
     $user->email = $parsed_object['email'];
     $hashed_password = Hash::make($parsed_object['password']);
     $user->password = $hashed_password;
     $user->resturant_id = $resturant->id;
     $user->role_id = 1;
     $user->active = 0;
     $user->activation_token = str_random(32);
     $user->fullname = $parsed_object['name'];
     $user->phone = $parsed_object['phone'];
     $user->save();
     \Event::fire(new registrationEmail($user));
     return response()->json(["Response" => "success"]);
 }
 /**
  * Display a listing of all events
  *
  */
 public function index()
 {
     //        $events = Event::with('user')->orderBy('date_start', 'desc')->get();
     $eventsFeatured = Event::with('user')->where('feature_event', 1)->get();
     $events = $this->facebookSdk->getCurrentEvents();
     $events = json_decode(json_encode($events));
     return view('pages.events.index', compact('events', 'eventsFeatured'));
 }
Example #5
0
 public function itemDone()
 {
     $userId = \Auth::user()->id;
     $task = \Input::get('text');
     $item = Task::where(['task' => $task, 'user_id' => $userId])->first();
     $item->status = 1;
     $item->save();
     \Event::fire(new Purchased($item));
 }
 public function dev()
 {
     $image = Input::file('image');
     // Merge the name of the file being uploaded into the Input array so it can be saved to the database.{}{}
     Input::merge(array('name' => $image->getClientOriginalName()));
     // Use the repository method "processPost" to populate and create a new instance of the model
     if ($this->imageRepository->processUpload(Input::all())) {
         // Fire an event to move the uploaded file to permanent storage
         Event::fire(new Upload($this->imageRepository));
         return response()->json(['status' => 'true', 'message' => 'Successfully uploaded']);
     }
 }
Example #7
0
 public function result()
 {
     $payment = new Payment(config('robokassa.login'), config('robokassa.paymentPassword'), config('robokassa.validationPassword'));
     if ($payment->validateResult($_GET)) {
         $order = Order::where('id', $payment->getInvoiceId())->first();
         if ($payment->getSum() == $order->sum) {
             \Event::fire(new \App\Events\ProductWasPurchased($order->id));
             // send answer
             echo $payment->getSuccessAnswer();
             // "OK1254487\n"
         }
     }
 }
Example #8
0
 /**
  * 	PUT route for saving documents.
  */
 public function putDocs($id = '')
 {
     $user = Auth::user();
     if (!$user->can('admin_manage_documents')) {
         return Redirect::to('/dashboard')->with('message', "You do not have permission");
     }
     $content = Input::get('content');
     $content_id = Input::get('content_id');
     if ($content_id) {
         try {
             $doc_content = DocContent::find($content_id);
         } catch (Exception $e) {
             return Redirect::to('dashboard/docs/' . $id)->with('error', 'Error saving the document: ' . $e->getMessage());
         }
     } else {
         $doc_content = new DocContent();
     }
     $doc_content->doc_id = $id;
     $doc_content->content = $content;
     $doc_content->save();
     Event::fire(MadisonEvent::DOC_EDITED, $doc);
     $doc = Doc::find($id);
     $doc->indexContent($doc_content);
     return Redirect::to('dashboard/docs/' . $id)->with('success_message', 'Document Saved Successfully');
 }
 public function postDelete(Request $request)
 {
     if ($this->access['is_remove'] == 0) {
         return Redirect::to('dashboard')->with('messagetext', \Lang::get('core.note_restric'))->with('msgstatus', 'error');
     }
     // delete multipe rows
     if (count($request->input('ids')) >= 1) {
         $this->model->destroy($request->input('ids'));
         \DB::table('app_possible_answers')->whereIn('question_id', $request->input('ids'))->delete();
         \SiteHelpers::auditTrail($request, "ID : " . implode(",", $request->input('ids')) . "  , Has Been Removed Successfull");
         \Event::fire(new RevisionHasChanged(new Revision()));
         // redirect
         return Redirect::to('question')->with('messagetext', \Lang::get('core.note_success_delete'))->with('msgstatus', 'success');
     } else {
         return Redirect::to('question')->with('messagetext', 'No Item Deleted')->with('msgstatus', 'error');
     }
 }
 public function addrating(Request $request)
 {
     $token = $request->token;
     if ($token == null) {
         return response()->json('token is empty', 200);
     }
     $user = userSessionHandler::user($token);
     if ($user == null) {
         return response()->json('user not found.', 404);
     }
     $rating = new Rating();
     $rating->user_id = $user->id;
     $rating->value = $request->value;
     $rating->ratingable_id = $request->ratingable_id;
     $rating->ratingable_type = $request->ratingable_type;
     $rating->save();
     if ($request->ratingable_type == "Iterinary") {
         \Event::fire(new IterinaryRateWasAdded($request->ratingable_id));
     } else {
         \Event::fire(new ActivityRateWasAdded($request->ratingable_id));
     }
 }
Example #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\CreateClaimRequest $request)
 {
     $destinations = $request->get('destination');
     $request = $request->except('destination');
     $request['operator_id'] = Auth::user()->id;
     $request['status'] = 'N';
     $claim = new Claim($request);
     $propertyList = array();
     $errors = new Support\MessageBag();
     if (!empty($request["property"])) {
         $properties = Property::getPropertyByModel($claim);
         foreach ($properties as $property) {
             try {
                 if (isset($request["property"][$property->id])) {
                     $attributes = ['value' => $request["property"][$property->id], 'property_id' => $property->id];
                     if ($property->type == 'date') {
                         $pr = new PropertyTypes\DateProperty($attributes, $property->title);
                     } elseif ($property->type == 'number') {
                         $pr = new PropertyTypes\NumberProperty($attributes, $property->title);
                     } else {
                         $pr = new PropertyTypes\TextProperty();
                         $pr->value = $request["property"][$property->id];
                         $pr->property_id = $property->id;
                     }
                 }
                 $propertyList[] = $pr;
             } catch (ValidationException $e) {
                 $errors->merge($e->errors());
             }
         }
     }
     if ($errors->count() > 0) {
         return \Redirect::back()->withInput($request)->withErrors($errors);
     }
     $claim->save($request);
     foreach ($propertyList as $pr) {
         $pr->element_id = $claim->id;
         $pr->save();
     }
     flash()->success('Обращение Создано, № ' . $claim->id);
     \Event::fire(new ClaimCreate($claim, $destinations));
     return redirect('project');
 }
 public static function turn_pass($game_id)
 {
     if (self::has_winner($game_id)) {
         $list = \App\Models\Game_User::where('game_id', $game_id)->where('has_won', 1)->first();
         $user_win = \App\Models\User::where('id', '=', $list->user_id)->first();
         $msg = 'Ya existe un ganador y es ' . $user_win->first_name . '.';
         return response()->json(['errors' => true, 'msg' => $msg]);
     }
     if (self::has_ended($game_id)) {
         return response()->json(['errors' => true, 'msg' => 'El juego termino']);
     }
     if (self::have_turn($game_id)) {
         return response()->json(['errors' => true, 'msg' => 'NO es su turno.']);
     }
     \Event::fire(new \App\Events\TurnPass(Auth::user()->id, $game_id));
 }
Example #13
0
 /**
  * Culture worksheet for Test
  *
  * @param
  * @return
  */
 public function culture()
 {
     $test = Test::find(Input::get('testID'));
     $test->test_status_id = Test::VERIFIED;
     $test->time_verified = date('Y-m-d H:i:s');
     $test->verified_by = Auth::user()->id;
     $test->save();
     //Fire of entry verified event
     Event::fire('test.verified', array($testID));
     return view('test.viewDetails', compact('test'));
 }
 public function postRound(Request $request, $id)
 {
     $this->validate($request, ['beat_id' => 'required|integer', 'video' => 'required|mimes:mp4,mpg,3gp,h264,ogv,mov,webm,flv,wmv,mkv']);
     // get battle and user instances
     $battle = OpenBattle::findOrFail($id);
     $user = $request->user();
     if (!$battle->isOpen()) {
         return response('Gone', 410);
     }
     // get rapper number
     $rapperNumber = 0;
     if ($user == $battle->rapper1) {
         $rapperNumber = 1;
     } elseif ($user == $battle->rapper2) {
         $rapperNumber = 2;
     } else {
         return response('Unauthorized.', 401);
     }
     // TODO: check video file?
     // Name of the column the video needs to be saved in
     $videoColumn = 'rapper' . $rapperNumber . '_round' . $battle->phase;
     // Name of the video
     $videoName = $battle->id . '_' . $videoColumn;
     $video = $request->file('video');
     // Name of video on the disk
     $videoFilename = $videoName . '.mp4';
     // target file format: mp4
     $videoFilenameTmp = $videoName;
     Storage::disk('videos')->put($videoFilenameTmp, file_get_contents($video->getRealPath()));
     Log::info('Uploading video', ['rapperNumber' => $rapperNumber, 'phase' => $battle->phase, 'userID' => $user->id, 'videoFilenameTmp' => $videoFilenameTmp, 'videoFilename' => $videoFilename]);
     // convert video/fire events and delete temporary file
     $inFilePath = Storage::disk('videos')->getAdapter()->applyPathPrefix($videoFilenameTmp);
     $outFilePath = Storage::disk('videos')->getAdapter()->applyPathPrefix($videoFilename);
     /*
      * The event 'VideoWasUploaded' will be pushed on the queue and convert
      * the uploaded video. If the conversion succeds a following event will
      * be fired, in this case 'OpenBattleVideoConverted'. 'OpenBattleVideoConverted'
      * writes $videoFileName to the file column $videoColumn of $battle and
      * sets the beat_id. When all videos are uploaded 'OpenBattleVideoConverted
      * fires another event ('OpenBattleCompleted') to concatenate the video
      * files and to convert the OpenBattle to a Battle. This approach was choosen
      * since these steps depend on each other. When one step fails but the
      * following gets executed the OpenBattle may get 'corrupted' (eg. by
      * missing video files) and the conversion to a finished Battle will fail.
      */
     \Event::fire(new VideoWasUploaded($outFilePath, $inFilePath, true, new OpenBattleVideoConverted($battle, $videoFilename, $videoColumn, $rapperNumber, $request->input('beat_id'))));
 }
 public function createUser(Request $request)
 {
     $request_data = $request->input('request');
     $request_array = json_decode($request_data, true);
     $resturant = Resturant::Where('id', '=', $request_array['resturant_id'])->firstOrFail();
     $subscription = SubscriptionPlan::Where('id', '=', $resturant->subscription_plan_id)->firstOrFail();
     $all = User::Where('resturant_id', '=', $request_array['resturant_id'])->count();
     if ($all >= $subscription->user) {
         return response()->json(["Response" => "error", "message" => "You Subscription plan doesn't allow more users"]);
     }
     $rules = array('email' => 'unique:users,email');
     $validator = \Validator::make(array('email' => $request_array['email']), $rules);
     if ($validator->fails()) {
         return response()->json(["Response" => "Error", "message" => "This Email Address is Already Registered in our system."]);
     }
     $user = new User();
     $user->email = $request_array['email'];
     $hashed_password = Hash::make($request_array['password']);
     $user->password = $hashed_password;
     $user->phone = $request_array['phone'];
     $user->fullname = $request_array['fullname'];
     $user->activation_token = str_random(32);
     $user->active = 0;
     $user->role_id = 2;
     $user->resturant_id = $request_array['resturant_id'];
     $user->save();
     $alluserlocation = $request_array['locations'];
     foreach ($alluserlocation as $location) {
         $locationId = $location['id'];
         $user_locations = new UserLocation();
         $user_locations->user_id = $user->id;
         $user_locations->location_id = $locationId;
         $user_locations->save();
     }
     $maincardactions = $request_array['mainmenu'];
     $weeklycardactions = $request_array['weeklymenu'];
     $itemsactions = $request_array['items'];
     $user_actions = new UserAction();
     $user_actions->maincard = serialize($maincardactions);
     $user_actions->weeklymenu = serialize($weeklycardactions);
     $user_actions->items = serialize($itemsactions);
     $user_actions->user_id = $user->id;
     $user_actions->save();
     \Event::fire(new registrationEmail($user));
     return response()->json(["Response" => "success", "message" => "User Successfully Created"]);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id, $franchiseId)
 {
     //
     $registered_resturant = Resturant::Where('id', '=', $id)->firstOrFail();
     $subscription = SubscriptionPlan::Where('id', '=', $registered_resturant->subscription_plan_id)->firstOrFail();
     $franchise_users = User::Where('franchise_id', '=', $franchiseId)->count();
     $all_users = User::Where('resturant_id', '=', $id)->where('franchise_id', '!=', -1)->count();
     $request_data = $request->input('request');
     $request_array = json_decode($request_data, true);
     $Location_users = $request_array['users'];
     $effective_users = $all_users - $franchise_users + sizeof($Location_users);
     if ($effective_users > $subscription->user) {
         return response()->json(["Response" => "error", "message" => "You Subscription plan doesn't allow more users"]);
     } else {
         $franchise = Franchise::Where('id', '=', $franchiseId)->firstOrFail();
         $parsed_object = $request_array['Franchise'];
         $franchise->location_id = $parsed_object['location_id'];
         $franchise->address = $parsed_object['address'];
         $franchise->phone = $parsed_object['phone'];
         $franchise->name = $parsed_object['name'];
         $franchise->save();
         $rules = array('email' => 'unique:users,username');
         foreach ($Location_users as $users) {
             $name = $users['username'];
             $validator = \Validator::make(array('email' => $name), $rules);
             if ($validator->fails()) {
                 return response()->json(["Response" => "error", "message" => 'Email Address : ' . $name . ' is Already Registered in our system.']);
             }
         }
         foreach ($Location_users as $users) {
             $isnew = array_get($users, 'isnew', 'default');
             if ($isnew != 'default') {
                 $user = new User();
                 $name = $users['username'];
                 $password = $user['password'];
                 $user->username = $name;
                 $hashed_password = Hash::make($password);
                 $user->password = $hashed_password;
                 $user->resturant_id = $id;
                 $user->franchise_id = $franchiseId;
                 $user->role_id = 2;
                 $user->active = 0;
                 $user->activation_token = str_random(32);
                 \Event::fire(new registrationEmail($user));
                 $user->save();
             } else {
                 $name = $users['username'];
                 $password = $users['password'];
                 $userId = $users['id'];
                 $user = User::Where('id', '=', $userId)->firstOrFail();
                 $user->username = $name;
                 if ($user->password != $password) {
                     $hashed_password = Hash::make($password);
                     $user->password = $password;
                 }
                 $user->save();
             }
         }
         $franchise_Users = User::Where('franchise_id', '=', $franchiseId)->get();
         foreach ($franchise_Users as $franchiseUsers) {
             $franchiseUserId = $franchiseUsers->id;
             $tobeDeleted = true;
             foreach ($Location_users as $locationUsers) {
                 $isnew = array_get($locationUsers, 'isnew', 'default');
                 if ($isnew == 'default') {
                     if ($locationUsers['id'] == $franchiseUserId) {
                         $tobeDeleted = false;
                         break;
                     }
                 } else {
                     $tobeDeleted = false;
                 }
             }
             if ($tobeDeleted) {
                 User::where('id', '=', $franchiseUserId)->delete();
             }
         }
         return response()->json(["Response" => "success", "message" => "Franchise info Updated"]);
     }
     return response()->json(["Response" => "error", "message" => "There was an error processing your request"]);
 }
Example #17
0
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function updatedCommand(Request $request)
 {
     $this->validate($request, ['product_id.*' => 'integer', 'delete' => 'in:true', 'quantity.*' => 'integer', 'id.*' => 'integer']);
     if (!empty($request->input('delete'))) {
         foreach ($this->cart->getCart() as $id => $storage) {
             $this->restoreProductLock($id, 'all');
         }
         $cookie = $this->cart->reset();
         return back()->withCookie($cookie)->with(['message' => trans('app.cartEmpty')]);
     }
     if (!Auth::check()) {
         return back()->with(['message' => trans('app.noAuthentificate')]);
     }
     if (!empty($request->input('product_id'))) {
         foreach ($request->input('product_id') as $id) {
             $quantity = (int) $request->input('quantity' . $id);
             $this->history->create(['product_id' => $id, 'user_id' => $request->user()->id, 'quantity' => $quantity]);
             \Event::fire(new ScoreEvent($id, $quantity));
         }
         $cookie = $this->cart->reset();
         return redirect()->home()->withCookie($cookie)->with(['message' => trans('app.thankForYourCommand')]);
     }
 }
Example #18
0
 public function postPayments(Request $request)
 {
     $authId = Auth::user()->id;
     //dd($authId);
     //$getReceiverAccount = \App\Models\ReciverAccount::where('user_id' , $authId)->first();
     //dd($getReceiverAccount);
     $rewardLogId = $request->input('_log_id_');
     $rewardLogRow = \App\Models\RewardsLogDuringPayment::where('id', $rewardLogId)->first();
     $rewardLogRowDecodedObj = json_decode($rewardLogRow->array_obj);
     $project_id = $rewardLogRowDecodedObj->project_id;
     $backingAmount = $rewardLogRowDecodedObj->backing->amount;
     $stripeToken = $request->input('stripeToken');
     $currency = $request->input('currency');
     $error = '';
     $post = \App\Models\Project::findOrFail($rewardLogRowDecodedObj->project_id);
     $getReceiverAccount = $post->user_id ? \App\Models\ReciverAccount::where('user_id', $post->user_id)->first() : Null;
     if ($getReceiverAccount->secret_key) {
         //\Stripe\Stripe::setApiKey(\Config::get('stripe.stripe.secret'));
         \Stripe\Stripe::setApiKey($getReceiverAccount->secret_key);
     }
     try {
         // throw new Exception("The Stripe Token was not generated correctly");
         $post = \App\Models\Project::findOrFail($project_id);
         $charge = \Stripe\Charge::create(array("amount" => $backingAmount * 100, "currency" => $currency, "capture" => false, "card" => $stripeToken, "description" => 'Captured  amount #' . $backingAmount . $currency . ' for pledge project-id #' . $project_id), array('idempotency_key' => $this->generateRandomString()));
         //echo $charge->status;
         //dd($charge);
         if ($charge->status == 'succeeded') {
             $transactionId = $charge->id;
             $actionMsg_1 = Auth::user()->name . ' has pledged for project  # ' . $post->name;
             $actionMsg_2 = Auth::user()->name . ' has invested ' . $backingAmount . $currency . ' for project  # ' . $post->name;
             $settingsRow = \App\Setting::where('config_key', 'commission_from_each_fund')->first();
             $commissionVal = $settingsRow->config_value;
             $projectFunds = new \App\Models\ProjectFund();
             $projectFunds->P_ID = $project_id;
             $projectFunds->U_ID = Auth::user()->id;
             $projectFunds->paid_amount = $backingAmount;
             $projectFunds->site_commission = $backingAmount * $commissionVal / 100;
             $projectFunds->amount_to_project_owner = $backingAmount - $backingAmount * $commissionVal / 100;
             $projectFunds->status = 'Pledged';
             $projectFunds->rewards_log_during_payment_id = $rewardLogId;
             $projectFunds->transaction_id = $transactionId;
             $projectFunds->save();
             // commission_from_each_fund
             \Event::fire('transaction.log', new \App\Events\Transaction($request, ['transaction_id' => $transactionId, 'user_id' => Auth::user()->id, 'msg' => $actionMsg_1, 'credit' => '0.00', 'debit' => $backingAmount, 'status' => 'Pledged']));
             \Event::fire('activity.log', new \App\Events\Activity($request, ['project_id' => $project_id, 'user_id' => Auth::user()->id, 'action' => 'invested', 'msg' => $actionMsg_2]));
         }
     } catch (Exception $e) {
         $e_json = $e->getMessage();
         $error = $e_json['error'];
         return \Redirect::to('checkout/payments')->withInput()->with('stripe_errors', $error['message']);
     }
     return \Redirect::to('checkout/success');
 }
Example #19
0
 /**
  * Add user to lead
  * 
  * @param  AdminAddUserRequest $request
  * @param  Integer $id
  * @return Redirect
  */
 public function putAssignLead(AdminAddUsersRequest $request, $id)
 {
     $lead = Lead::find($id);
     $emails = $request->get('email');
     $users_new = User::whereIn('email', $emails)->get();
     $users = $users_new->diff($lead->users()->wherePivot('type', 'owner'));
     // Attach
     foreach ($users as $user) {
         $lead->users()->attach($user->id, ['type' => 'owner']);
         $flash_message[] = $user->fullname;
         \Mail::queue('emails.leads.assign', ['lead' => $lead], function ($message) use($user) {
             $message->to($user->email)->subject(\Lang::get('lead.email.assigned_lead'));
         });
     }
     // Log lead activity
     \Event::fire(new LogLeadActivity($lead, 'Assigned lead to users', $users));
     return redirect('leads/' . $lead->id . '/assign_lead')->with('status', \Lang::get('lead.added_users', ['users' => rtrim(implode(', ', $flash_message), ',')]));
 }
Example #20
0
 public function regler()
 {
     if (\Request::ajax()) {
         $numbers = substr(\Input::get('regler'), 0, -1);
         $ids = explode(',', $numbers);
         $ids = array_unique($ids);
         foreach ($ids as $id) {
             $bills = Bill::findOrFail($id);
             if ($bills->child->Family->responsable == 1) {
                 $resp = $bills->child->Family->nom_pere;
             } else {
                 $resp = $bills->child->Family->nom_mere;
             }
             \Event::fire(new ReglerBillEvent($resp, $bills->start->format('d-m-Y'), $bills->child->nom_enfant, $bills->id, $bills->somme, \Auth::user()->name, $bills->child->Family->email_responsable));
             $bills->status = 1;
             $bills->save();
         }
     }
 }
Example #21
0
 public function post(Request $request)
 {
     \Event::fire(new ChatEvent($request->msg, $request->name));
     $response = array('status' => 'success', 'msg' => $request->msg);
     return \Response::json($response);
 }
Example #22
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $hoje = date("Y-m-d");
     if ($request->data_sorteio < $hoje) {
         return redirect()->back()->with('msg_error', 'A ação não foi cadastrada, favor inserir uma data válida.');
     }
     //Cria o objeto Acao a ser inserido
     $acao = new Acao();
     $acao->user_id = Auth::user()->id;
     $acao->nome_acao = $request->nome_acao;
     $acao->descricao = $request->descricao;
     $acao->quantidade_rifas = $request->quantidade_rifas;
     $acao->valor_rifa = $request->valor_rifa;
     $acao->data_sorteio = $request->data_sorteio;
     $acao->forma_entrega = $request->forma_entrega;
     $acao->qtd_max = $request->qtd_max;
     $acao->nome_contato = Auth::user()->name;
     $acao->telefone_contato = Auth::user()->telefone;
     $acao->email = Auth::user()->email;
     $acao->foto_contato = Auth::user()->foto;
     //Cria e salva as rifas
     $quantidade_rifas = $acao->quantidade_rifas;
     //Salva a acao
     $acao->save();
     $id = $acao->id;
     //Armazenamento da imagem
     $arquivo = $request->file('imagem');
     $extension = $arquivo->getClientOriginalExtension();
     $image_name = 'acao' . $acao->id;
     $path = $arquivo->getRealPath();
     Storage::put('acaos/' . $image_name . '.' . $extension, file_get_contents($path));
     $acao->imagem = '/image/acaos/' . $image_name;
     $acao->save();
     if ($acao->save()) {
         //Dispara o evento de geracao de rifas
         \Event::fire(new GeracaoDeRifas($acao));
     }
     return redirect()->route('acao', ['id' => $id]);
 }