本文整理汇总了PHP中Illuminate\Support\Facades\Log类的典型用法代码示例。如果您正苦于以下问题:PHP Log类的具体用法?PHP Log怎么用?PHP Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::info('Iniciando proceso de actualizacion de referencia de ventas');
$sales = Sales::where('transaction_id', '-1')->get();
foreach ($sales as $sale) {
$ventasPorAplicar = DB::table('contabilidad_sales')->select('*')->whereRaw('credit_debit = ? and reference = ? ', ['credit', $sale->reference])->where('transaction_id', '<>', '-1')->groupBy('reference')->get();
if (count($ventasPorAplicar) > 0) {
// se encontraron referencias de venta nuevas
foreach ($ventasPorAplicar as $ventaPorAplicar) {
$depositoAplicacionAnterior = DepositoAplicacion::where('venta_id', $sale->id)->get();
foreach ($depositoAplicacionAnterior as $depositoAplicacion) {
echo $depositoAplicacion->cantidad . ' ' . $depositoAplicacion->deposito_id . ' -- ' . $ventaPorAplicar->ammount . '-- ' . $ventaPorAplicar->ammount_applied . '-------';
if ($depositoAplicacion->estatus == 1) {
$deposito = new DepositoAplicacion(['deposito_id' => $depositoAplicacion->deposito_id, 'venta_id' => $ventaPorAplicar->id, 'estatus' => $depositoAplicacion->estatus, 'usuario_id' => $depositoAplicacion->usuario_id, 'cantidad' => $depositoAplicacion->cantidad]);
$ventaPorAplicar->ammount_applied = $depositoAplicacion->cantidad + ($ventaPorAplicar->ammount - $ventaPorAplicar->ammount_applied);
} else {
if (abs($depositoAplicacion->cantidad) >= $ventaPorAplicar->ammount - $ventaPorAplicar->ammount_applied) {
$ventaPorAplicar->ammount_applied = $depositoAplicacion->ammount;
$depositoAplicacion->cantidad = $depositoAplicacion->cantidad - ($ventaPorAplicar->ammount - $ventaPorAplicar->ammount_applied);
} else {
$ventaPorAplicar->ammount_applied = $ventaPorAplicar->ammount - $ventaPorAplicar->ammount_applied - $depositoAplicacion->cantidad;
$depositoAplicacion->cantidad = 0;
}
$deposito = new DepositoAplicacion(['deposito_id' => $depositoAplicacion->deposito_id, 'venta_id' => $ventaPorAplicar->id, 'estatus' => $depositoAplicacion->estatus, 'usuario_id' => $depositoAplicacion->usuario_id, 'cantidad' => -1 * ($ventaPorAplicar->ammount_applied - $ventaPorAplicar->ammount)]);
}
$deposito->save();
${$ventaPorAplicar}->update();
$depositoAplicacion->delete();
}
}
}
}
Log::info('Finalizando proceso de actualizacion de referencia de ventas');
}
示例2: send
/**
* {@inheritdoc}
*/
public function send(Swift_Mime_Message $message, &$failedRecipients = null)
{
try {
$to = implode(', ', array_keys((array) $message->getTo()));
$cc = implode(', ', array_keys((array) $message->getCc()));
$bcc = implode(', ', array_keys((array) $message->getBcc()));
$replyto = '';
foreach ((array) $message->getReplyTo() as $address => $name) {
$replyto = $address;
break;
}
$mail_options = ["sender" => "admin@{$this->app->getGaeAppId()}.appspotmail.com", "to" => $to, "subject" => $message->getSubject(), "htmlBody" => $message->getBody()];
if ($cc !== '') {
$mail_options['cc'] = $cc;
}
if ($bcc !== '') {
$mail_options['bcc'] = $bcc;
}
if ($replyto !== '') {
$mail_options['replyto'] = $replyto;
}
$attachments = $this->getAttachmentsArray($message);
if (count($attachments) > 0) {
$mail_options['attachments'] = $attachments;
}
$gae_message = new GAEMessage($mail_options);
$gae_message->send();
} catch (InvalidArgumentException $ex) {
Log::warning("Exception sending mail: " . $ex);
}
}
示例3: testStoreUpdateAndDelete
/**
* Test store, update and delete.
*/
public function testStoreUpdateAndDelete()
{
$requestBody = <<<EOT
{
"data" : {
"type" : "pricelists",
"attributes" : {
"company_id" : "1",
"name": "pricelist_1"
}
}
}
EOT;
// Create
$response = $this->callPost(self::API_URL, $requestBody);
$this->assertEquals(Response::HTTP_CREATED, $response->getStatusCode());
$this->assertNotNull($obj = json_decode($response->getContent())->data);
$this->assertNotEmpty($obj->id);
//$this->assertNotEmpty($obj->headers->get('Location'));
// re-read and check
$this->assertNotNull($obj = json_decode($this->callGet(self::API_URL . $obj->id)->getContent())->data);
$this->assertEquals('pricelist_1', $obj->attributes->name);
// Update
$requestBody = "{\n \"data\" : {\n \"type\" : \"pricelists\",\n \"id\" : \"{$obj->id}\",\n \"attributes\" : {\n \"company_id\" : \"1\",\n \"name\" : \"pricelist_2\"\n }\n }\n }";
Log::info($requestBody);
$response = $this->callPatch(self::API_URL . $obj->id, $requestBody);
Log::info($response);
$this->assertEquals(Response::HTTP_NO_CONTENT, $response->getStatusCode());
// re-read and check
$this->assertNotNull($obj = json_decode($this->callGet(self::API_URL . $obj->id)->getContent())->data);
$this->assertEquals('pricelist_2', $obj->attributes->name);
// Delete
$response = $this->callDelete(self::API_URL . $obj->id);
$this->assertEquals(Response::HTTP_NO_CONTENT, $response->getStatusCode());
}
示例4: verifyNotify
/**
* 针对notify_url验证消息是否是支付宝发出的合法消息
* @return 验证结果
*/
function verifyNotify()
{
if (empty($_POST)) {
//判断POST来的数组是否为空
return false;
} else {
//生成签名结果
$isSign = $this->getSignVerify($_POST, $_POST["sign"], true);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (!empty($_POST["notify_id"])) {
$responseTxt = $this->getResponse($_POST["notify_id"]);
}
//写日志记录
if ($this->alipay_config['log'] || true) {
if ($isSign) {
$isSignStr = 'true';
} else {
$isSignStr = 'false';
}
$log_text = "[===AliPay Notify===]responseTxt=" . $responseTxt . "\n notify_url_log:isSign=" . $isSignStr . "\n";
$log_text = $log_text . $this->createLinkString($_POST);
Log::info($log_text);
}
//验证
//$responseTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true\$/i", $responseTxt) && $isSign) {
return true;
} else {
return false;
}
}
}
示例5: push
public function push($token, $data, $params)
{
try {
$url = 'https://' . $this->config['host'];
$fields = array('registration_ids' => array($token), 'data' => array_merge($data, ['data' => $params]));
$headers = array('Authorization: key=' . $this->config['key'], 'Content-Type: application/json');
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
Log::error('Curl failed: ' . curl_error($ch));
return false;
}
// Close connection
curl_close($ch);
return true;
} catch (Exception $e) {
Log::error($e);
return false;
}
}
示例6: report
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
if ($this->shouldReport($e)) {
Log::error($e);
}
parent::report($e);
}
示例7: login
public function login()
{
$response = $this->steam->validate();
Log::alert(json_encode($this->steam));
Log::alert(json_encode(\Config::get('steam-auth.api_key')));
if ($response) {
$info = $this->steam->getUserInfo();
if (!is_null($info)) {
$user = User::where('steam_id', $info->getSteamID64())->first();
if (!is_null($user)) {
Auth::login($user, true);
return redirect('/');
// redirect to site
} else {
$data = ['name' => $info->getNick(), 'steam_id' => $info->getSteamID64(), 'avatar' => $info->getProfilePictureFull()];
$user = User::create($data);
Auth::login($user, true);
return redirect('/');
// redirect to site
}
}
} else {
return $this->steam->redirect();
// redirect to Steam login page
}
}
示例8: create
/**
* Create a user and return response
*
* @param array $data
* @param CreatorListenerInterface $listener
* @return mixed
*/
public function create(array $data, CreatorListenerInterface $listener)
{
$valid = $this->userValidator->isValid($data);
if (!$valid) {
return $listener->onCreateFail($this->userValidator->getMessages());
}
$groups = empty($data['roles']) ? [] : $data['roles'];
$data = $this->filterData($data);
if ($this->auth->check()) {
$user = $this->auth->user();
$data['creator_id'] = $user->id;
}
try {
$data['activated'] = true;
$user = $this->userRepo->create($data);
$this->events->fire('user.created', array($user));
if (Sentry::getUser()->hasAnyAccess(['user.change_groups'])) {
$this->groupRepo->addGroupsToUser($user, $groups);
}
return $listener->onCreateSuccess();
} catch (InvalidArgumentException $e) {
Log::error($e->getMessage());
return $listener->onCreateFail([Lang::get('messages.operation_error')]);
}
}
示例9: handle
public function handle()
{
$users = User::all();
foreach ($users as $user) {
if ($user->message) {
$client = new Client(['base_uri' => 'https://app.asana.com/api/1.0/', 'headers' => ['Authorization' => 'Bearer ' . $user->access_token]]);
$response = $client->get('workspaces/8231054812149/tasks', ['query' => ['assignee' => $user->asana_id, 'completed_since' => 'now']]);
$tasks = json_decode($response->getBody());
$latestTaskId = $user->getLatestTask($tasks->data);
if (!$user->latest_task_id) {
$user->latest_task_id = $latestTaskId;
$user->save();
continue;
}
$newTasks = $user->getNewTasks($tasks->data);
if (!$newTasks) {
continue;
}
foreach ($newTasks as $newTask) {
$client->post('tasks/' . $newTask->id . '/stories', ['form_params' => ['text' => $user->message]]);
}
$user->latest_task_id = $latestTaskId;
$user->save();
Log::info('Message posted successfully', ['user' => $user->name, 'message' => $user->message, 'tasks' => $newTasks]);
}
}
}
示例10: address
public function address(Request $request)
{
$user = $this->getUserFromCookies($request);
$cart = $this->getCartOrNewCart($user);
$user->email = $request->get('email');
$user->save();
$address = null;
if ($request->input('type') == Address::TYPE_SHIPPING) {
$address = $cart->shippingAddress();
} else {
if ($request->input('type') == Address::TYPE_BILLING) {
$address = $cart->billingAddress();
}
}
if (!$address) {
$address = new Address();
$cart->addresses()->save($address);
}
$address->fill($request->all());
$address->save();
if ($address->type == Address::TYPE_SHIPPING) {
$price = $cart->getTotalPrice();
$util = new PaylineUtility();
$response = $util->stepOne($address, $price);
$xml = simplexml_load_string($response->getBody()->__toString());
Log::Info($xml->{"form-url"});
return $this->success(array("url" => $xml->{"form-url"}->__toString()));
}
return $this->success();
}
示例11: getOAuth2AccessToken
/**
* 通过code换取网页授权access_token
* {
* "access_token": "OezXcEiiBSKSxW0eoylIeLbTirX__QgA7uW8WJE0Z2izAbnXV7DHbdHni-j9OoCq2Xqh5gLlPt0uAHtfYByOH80h1dwMrq74iALd_K359JYEN5KWKB7_sEz3T19V86sP9lSO5ZGbc-qoXUD3XZjEPw",
* "expires_in": 7200,
* "refresh_token": "OezXcEiiBSKSxW0eoylIeLbTirX__QgA7uW8WJE0Z2izAbnXV7DHbdHni-j9OoCqgBFR_ApctbH4Tk5buv8Rr3zb7T3_27zZXWIdJrmbGFoFzGUfOvnwX249iPoeNJ2HYDbzW5sEfZHkC5zS4Qr8ug",
* "openid": "oMzBIuI7ctx3n-kZZiixjchzBKLw",
* "scope": "snsapi_base"
* }
**/
public function getOAuth2AccessToken(Request $request)
{
$code = $request->input('code');
$res = AccessTokenService::getOAuth2AccessToken($code);
Log::info($res);
return response($res)->header('Content-Type', 'JSON');
}
示例12: update
public function update($data)
{
$response = new ApiResponse();
$status = 200;
$mission = Mission::find(\Request::get('id'));
if ($mission == null) {
$response->status = 'error';
$response->message = ['id' => '', 'code' => 'mission_not_found', 'description' => 'The mission was not found'];
$status = 400;
} else {
$mission = $this->sanitize($data, $mission);
try {
$this->radicalIntegrationManager->updateMission($mission);
} catch (RadicalApiException $e) {
Log::error($e);
//For now ingore, see [CIT-380]
// $response->status = 'error';
// $response->message = $e->getMessage();
// $status = 500;
}
$mission->save();
$response->status = 'success';
$response->message = $mission->id;
}
return \Response::json($response, $status);
}
示例13: update
/**
* Update the profile based on the form submission
* @param ProfileUpdateRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function update(ProfileUpdateRequest $request)
{
$contact = $this->getContact();
$contact->setName($request->input('name'));
$contact->setRole($request->input('role'));
$contact->setEmailAddress($request->input('email_address'));
try {
$work = $contact->getPhoneNumber(PhoneNumber::WORK);
$work->setNumber(preg_replace("/[^0-9]/", "", $request->input('work_phone')));
$contact->setPhoneNumber($work);
$mobile = $contact->getPhoneNumber(PhoneNumber::MOBILE);
$mobile->setNumber(preg_replace("/[^0-9]/", "", $request->input('mobile_phone')));
$contact->setPhoneNumber($mobile);
$home = $contact->getPhoneNumber(PhoneNumber::HOME);
$home->setNumber(preg_replace("/[^0-9]/", "", $request->input('home_phone')));
$contact->setPhoneNumber($home);
$fax = $contact->getPhoneNumber(PhoneNumber::FAX);
$fax->setNumber(preg_replace("/[^0-9]/", "", $request->input('fax')));
$contact->setPhoneNumber($fax);
} catch (Exception $e) {
return redirect()->back()->withErrors($e->getMessage());
}
$contactController = new ContactController();
try {
$contactController->updateContact($contact);
} catch (Exception $e) {
Log::error($e->getMessage());
return redirect()->back()->withErrors(trans("errors.failedToUpdateProfile"));
}
$this->clearProfileCache();
return redirect()->action("ProfileController@show")->with('success', trans("profile.profileUpdated"));
}
示例14: ctlStore
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function ctlStore(Request $request)
{
Log::info('Received CTL Erase request for: ' . $request->input('macAddress'));
$this->dispatch(new EraseTrustList($request->input('macAddress'), 'ctl'));
Flash::success('Processed Request. Check table below for status.');
return redirect('ctl');
}
示例15: fire
public function fire($job, $data)
{
// build the event data
$event_data = $this->event_builder->buildBlockEventData($data['hash']);
// fire an event
try {
Log::debug("Begin xchain.block.received {$event_data['height']} ({$event_data['hash']})");
Event::fire('xchain.block.received', [$event_data]);
Log::debug("End xchain.block.received {$event_data['height']} ({$event_data['hash']})");
// job successfully handled
$job->delete();
} catch (Exception $e) {
EventLog::logError('BTCBlockJob.failed', $e, $data);
// this block had a problem
// but it might be found if we try a few more times
$attempts = $job->attempts();
if ($attempts > self::MAX_ATTEMPTS) {
// we've already tried MAX_ATTEMPTS times - give up
Log::debug("Block {$data['hash']} event failed after attempt " . $attempts . ". Giving up.");
$job->delete();
} else {
$release_time = 2;
Log::debug("Block {$data['hash']} event failed after attempt " . $attempts . ". Trying again in " . self::RETRY_DELAY . " seconds.");
$job->release(self::RETRY_DELAY);
}
}
}