当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::error方法代码示例

本文整理汇总了PHP中Notification::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::error方法的具体用法?PHP Notification::error怎么用?PHP Notification::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testErrorCollectingAndReporting

 public function testErrorCollectingAndReporting()
 {
     $n = new Notification();
     $this->assertTrue($n->isOk());
     $this->assertEquals("", $n->report());
     $n->error("An error!");
     $this->assertFalse($n->isOk());
     $n->error("Some %s occured at %s!", "FOO", "BAR");
     $this->assertFalse($n->isOk());
     $n->error("Error: %s at line %d occued because %s!", "SNAFU", 5, "FOOBAR");
     $this->assertEquals("An error!" . PHP_EOL . "Some FOO occured at BAR!" . PHP_EOL . "Error: SNAFU at line 5 occued because FOOBAR!", $n->report());
 }
开发者ID:bgarrels,项目名称:ebnf,代码行数:12,代码来源:NotificationTest.php

示例2: handle

 /**
  * Handle the file upload. Returns the array on success, or false
  * on failure.
  *
  * @param \Symfony\Component\HttpFoundation\File\UploadedFile $file
  * @param String $path where to upload file
  * @return array|bool
  */
 public function handle(UploadedFile $file, $path = 'uploads')
 {
     $input = array();
     $fileName = Str::slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
     // Detect and transform Croppa pattern to avoid problem with Croppa::delete()
     $fileName = preg_replace('#([0-9_]+)x([0-9_]+)#', "\$1-\$2", $fileName);
     $input['path'] = $path;
     $input['extension'] = '.' . $file->getClientOriginalExtension();
     $input['filesize'] = $file->getClientSize();
     $input['mimetype'] = $file->getClientMimeType();
     $input['filename'] = $fileName . $input['extension'];
     $fileTypes = Config::get('file.types');
     $input['type'] = $fileTypes[strtolower($file->getClientOriginalExtension())];
     $filecounter = 1;
     while (file_exists($input['path'] . '/' . $input['filename'])) {
         $input['filename'] = $fileName . '_' . $filecounter++ . $input['extension'];
     }
     try {
         $file->move($input['path'], $input['filename']);
         list($input['width'], $input['height']) = getimagesize($input['path'] . '/' . $input['filename']);
         return $input;
     } catch (FileException $e) {
         Notification::error($e->getmessage());
         return false;
     }
 }
开发者ID:phillipmadsen,项目名称:app,代码行数:34,代码来源:FileUpload.php

示例3: store

 /**
  * Start the creation of a new gocardless payment
  *   Details get posted into this method and the redirected to gocardless
  * @param $userId
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\FormValidationException
  * @throws \BB\Exceptions\NotImplementedException
  */
 public function store($userId)
 {
     User::findWithPermission($userId);
     $requestData = \Request::only(['reason', 'amount', 'return_path', 'stripeToken', 'ref']);
     $stripeToken = $requestData['stripeToken'];
     $amount = $requestData['amount'];
     $reason = $requestData['reason'];
     $returnPath = $requestData['return_path'];
     $ref = $requestData['ref'];
     try {
         $charge = Stripe_Charge::create(array("amount" => $amount, "currency" => "gbp", "card" => $stripeToken, "description" => $reason));
     } catch (\Exception $e) {
         \Log::error($e);
         if (\Request::wantsJson()) {
             return \Response::json(['error' => 'There was an error confirming your payment'], 400);
         }
         \Notification::error("There was an error confirming your payment");
         return \Redirect::to($returnPath);
     }
     //Replace the amount with the one from the charge, this prevents issues with variable tempering
     $amount = $charge->amount / 100;
     //Stripe don't provide us with the fee so this should be OK
     $fee = $amount * 0.024 + 0.2;
     $this->paymentRepository->recordPayment($reason, $userId, 'stripe', $charge->id, $amount, 'paid', $fee, $ref);
     if (\Request::wantsJson()) {
         return \Response::json(['message' => 'Payment made']);
     }
     \Notification::success("Payment made");
     return \Redirect::to($returnPath);
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:38,代码来源:StripePaymentController.php

示例4: store

 /**
  * Start the creation of a new balance payment
  *   Details get posted into this method
  * @param $userId
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\FormValidationException
  * @throws \BB\Exceptions\NotImplementedException
  */
 public function store($userId)
 {
     $user = User::findWithPermission($userId);
     $this->bbCredit->setUserId($user->id);
     $requestData = \Request::only(['reason', 'amount', 'return_path', 'ref']);
     $amount = $requestData['amount'] * 1 / 100;
     $reason = $requestData['reason'];
     $returnPath = $requestData['return_path'];
     $ref = $requestData['ref'];
     //Can the users balance go below 0
     $minimumBalance = $this->bbCredit->acceptableNegativeBalance($reason);
     //What is the users balance
     $userBalance = $this->bbCredit->getBalance();
     //With this payment will the users balance go to low?
     if ($userBalance - $amount < $minimumBalance) {
         if (\Request::wantsJson()) {
             return \Response::json(['error' => 'You don\'t have the money for this'], 400);
         }
         \Notification::error("You don't have the money for this");
         return \Redirect::to($returnPath);
     }
     //Everything looks gooc, create the payment
     $this->paymentRepository->recordPayment($reason, $userId, 'balance', '', $amount, 'paid', 0, $ref);
     //Update the users cached balance
     $this->bbCredit->recalculate();
     if (\Request::wantsJson()) {
         return \Response::json(['message' => 'Payment made']);
     }
     \Notification::success("Payment made");
     return \Redirect::to($returnPath);
 }
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:39,代码来源:BalancePaymentController.php

示例5: activate

 /**
  * Show the form for editing the specified resource.
  *
  * @param Email $email
  * @param $token
  * @return \Illuminate\Http\Response
  */
 public function activate(Email $email, $token)
 {
     if ($email->activate($token, auth()->user())) {
         \Notification::success(trans('email::email.activation_success'));
     } else {
         \Notification::error(trans('email::email.activation_failed'));
     }
     return redirect($this->redirectPath());
 }
开发者ID:javanlabs,项目名称:siparti,代码行数:16,代码来源:EmailController.php

示例6: store

 /**
  * Store a newly created resource in storage.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store()
 {
     $input = \Input::only('email', 'password');
     $this->loginForm->validate($input);
     if (Auth::attempt($input, true)) {
         return redirect()->intended('account/' . \Auth::id());
     }
     \Notification::error("Invalid login details");
     return redirect()->back()->withInput();
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:15,代码来源:SessionController.php

示例7: isSWF

 public function isSWF($setNotification = true)
 {
     $imageFileType = $this->getExtension();
     if ($imageFileType != "swf") {
         if ($setNotification) {
             Notification::error(1, 'Only Flash files are allowed.');
         }
         return false;
     }
     return true;
 }
开发者ID:ashmna,项目名称:MedDocs,代码行数:11,代码来源:FileUpload.php

示例8: file

 public static function file($file)
 {
     $skinPath = self::dir(true) . $file;
     $globalPath = self::dir() . $file;
     if (file_exists($skinPath)) {
         return include $skinPath;
     } elseif (file_exists($globalPath)) {
         return include $globalPath;
     } else {
         Notification::error(1, 'file "' . $file . '" Not found! ', 'Template');
     }
 }
开发者ID:ashmna,项目名称:LikeTracker,代码行数:12,代码来源:Template.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param $roleId
  * @param $userId
  * @return Response
  */
 public function destroy($roleId, $userId)
 {
     $role = Role::findOrFail($roleId);
     //don't let people remove the admin permission if they are a trustee
     $user = User::findOrFail($userId);
     if ($user->active && $user->director && $role->name == 'admin') {
         \Notification::error("You cannot remove a trustee from the admin group");
         return \Redirect::back();
     }
     $role->users()->detach($userId);
     return \Redirect::back();
 }
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:19,代码来源:RoleUsersController.php

示例10: online

 public static function online($user_id, $plan_id)
 {
     $input = ['plan_id' => $plan_id, 'validity' => 1, 'validity_unit' => 'Day', 'count' => 1];
     try {
         DB::transaction(function () use($input, $user_id) {
             $pins = Voucher::generate($input);
             return self::now(current($pins), $user_id, 'online');
         });
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         Notification::error($e->getMessage());
     }
 }
开发者ID:guilhermefilippo,项目名称:access-manager,代码行数:12,代码来源:Recharge.php

示例11: post_index

 public function post_index()
 {
     //POST LOGIN
     $credentials = array('cms' => true, 'username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => false);
     //CHECK CREDENTIALS
     if (Auth::attempt($credentials)) {
         //SUCCESS NOTIFICATION
         return Redirect::to_action('cms::dashboard');
     } else {
         //ERROR NOTIFICATION
         Notification::error(LL('cms::alert.login_error', CMSLANG));
         //BACK TO LOGIN
         return Redirect::to_action('cms::login')->with_input('only', array('username'));
     }
 }
开发者ID:SerdarSanri,项目名称:PongoCMS-Laravel-cms-bundle,代码行数:15,代码来源:login.php

示例12: postEdit

 public function postEdit()
 {
     if (!Input::has('id')) {
         Notification::error('Parameter Missing.');
         return Redirect::route(self::HOME);
     }
     $input = Input::all();
     try {
         $router = Router::findOrFail($input['id']);
         $router->fill($input);
         $this->flash($router->save());
         return Redirect::route(self::HOME);
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         App::abort(404);
     }
 }
开发者ID:guilhermefilippo,项目名称:access-manager,代码行数:16,代码来源:RoutersController.php

示例13: destroy

 /**
  * Remove cash from the users balance
  *
  * @param $userId
  * @return mixed
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\InvalidDataException
  */
 public function destroy($userId)
 {
     $user = User::findWithPermission($userId);
     $this->bbCredit->setUserId($userId);
     $amount = \Request::get('amount');
     $returnPath = \Request::get('return_path');
     $ref = \Request::get('ref');
     $minimumBalance = $this->bbCredit->acceptableNegativeBalance('withdrawal');
     if ($user->cash_balance + $minimumBalance * 100 < $amount * 100) {
         \Notification::error("Not enough money");
         return \Redirect::to($returnPath);
     }
     $this->paymentRepository->recordPayment('withdrawal', $userId, 'balance', '', $amount, 'paid', 0, $ref);
     $this->bbCredit->recalculate();
     \Notification::success("Payment recorded");
     return \Redirect::to($returnPath);
 }
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:25,代码来源:CashPaymentController.php

示例14: post_delete

 public function post_delete()
 {
     if (Input::has('user_id')) {
         $uid = Input::get('user_id');
         $user = CmsUser::find($uid);
         //CHECK IF USER EXISTS
         if (empty($user)) {
             Notification::error(LL('cms::alert.delete_user_error', CMSLANG), 2500);
             return Redirect::to_action('cms::user');
         } else {
             $user->delete();
             Notification::success(LL('cms::alert.delete_user_success', CMSLANG, array('user' => $user->username)), 1500);
             return Redirect::to_action('cms::user');
         }
     } else {
         Notification::error(LL('cms::alert.delete_user_error', CMSLANG), 1500);
         return Redirect::to_action('cms::user');
     }
 }
开发者ID:BGCX262,项目名称:zweer-laravel-svn-to-git,代码行数:19,代码来源:user.php

示例15: render

 /**
  * Render an exception into an HTTP response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Exception  $e
  * @return \Illuminate\Http\Response
  */
 public function render($request, Exception $e)
 {
     if ($e instanceof FormValidationException) {
         if ($request->wantsJson()) {
             return \Response::json($e->getErrors(), 422);
         }
         \Notification::error("Something wasn't right, please check the form for errors", $e->getErrors());
         return redirect()->back()->withInput();
     }
     if ($e instanceof ValidationException) {
         if ($request->wantsJson()) {
             return \Response::json($e->getMessage(), 422);
         }
         \Notification::error($e->getMessage());
         return redirect()->back()->withInput();
     }
     if ($e instanceof NotImplementedException) {
         \Notification::error("NotImplementedException: " . $e->getMessage());
         \Log::warning($e);
         return redirect()->back()->withInput();
     }
     if ($e instanceof AuthenticationException) {
         if ($request->wantsJson()) {
             return \Response::json(['error' => $e->getMessage()], 403);
         }
         $userString = \Auth::guest() ? "A guest" : \Auth::user()->name;
         \Log::warning($userString . " tried to access something they weren't supposed to.");
         return \Response::view('errors.403', [], 403);
     }
     if ($e instanceof ModelNotFoundException) {
         $e = new HttpException(404, $e->getMessage());
     }
     if (config('app.debug') && $this->shouldReport($e) && !$request->wantsJson()) {
         return $this->renderExceptionWithWhoops($e);
     }
     if ($request->wantsJson()) {
         if ($this->isHttpException($e)) {
             return \Response::json(['error' => $e->getMessage()], $e->getStatusCode());
         }
     }
     return parent::render($request, $e);
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:49,代码来源:Handler.php


注:本文中的Notification::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。