本文整理汇总了PHP中App\Http\Controllers\Log::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::error方法的具体用法?PHP Log::error怎么用?PHP Log::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\Log
的用法示例。
在下文中一共展示了Log::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
private function execute($message, $tg)
{
try {
if (!array_key_exists('text', $message)) {
app()->abort(200, 'Missing command');
}
if (starts_with($message['text'], '/start')) {
$this->start($message, $tg);
} else {
if (starts_with($message['text'], '/cancel')) {
$this->cancel($message, $tg);
} else {
if (starts_with($message['text'], '/list')) {
$this->listApps($message, $tg);
} else {
if (starts_with($message['text'], '/revoke')) {
$this->revoke($message, $tg);
} else {
if (starts_with($message['text'], '/help')) {
$this->help($message, $tg);
} else {
$this->commandReply($message, $tg);
}
}
}
}
}
return response()->json('', 200);
} catch (\Exception $e) {
\Log::error($e);
app()->abort(200);
}
}
示例2: store
/**
* Stores new upload
*
*/
public function store()
{
$file = Input::file('file');
$upload = new Upload();
try {
$upload->process($file);
} catch (Exception $exception) {
// Something went wrong. Log it.
Log::error($exception);
$error = array('name' => $file->getClientOriginalName(), 'size' => $file->getSize(), 'error' => $exception->getMessage());
// Return error
return Response::json($error, 400);
}
// If it now has an id, it should have been successful.
if ($upload->id) {
$newurl = URL::asset($upload->publicpath() . $upload->filename);
// this creates the response structure for jquery file upload
$success = new stdClass();
$success->name = $upload->filename;
$success->size = $upload->size;
$success->url = $newurl;
$success->thumbnailUrl = $newurl;
$success->deleteUrl = action('UploadController@delete', $upload->id);
$success->deleteType = 'DELETE';
$success->fileID = $upload->id;
return Response::json(array('files' => array($success)), 200);
} else {
return Response::json('Error', 400);
}
}
示例3: notifyHost
private function notifyHost($client, $reservation)
{
$host = $reservation->property->user;
$twilioNumber = config('services.twilio')['number'];
try {
$client->account->messages->sendMessage($twilioNumber, $host->fullNumber(), $reservation->message);
} catch (Exception $e) {
Log::error($e->getMessage());
}
}
示例4: notifyHost
private function notifyHost($client, $reservation)
{
$host = $reservation->property->user;
$twilioNumber = config('services.twilio')['number'];
$messageBody = $reservation->message . ' - Reply \'yes\' or \'accept\' to confirm the reservation, or anything else to reject it.';
try {
$client->messages->create($host->fullNumber(), ['from' => $twilioNumber, 'body' => $messageBody]);
} catch (Exception $e) {
Log::error($e->getMessage());
}
}
示例5: update
public function update(Request $request)
{
$query = DB::table('Company')->where('companyId', $request->input('companyId'))->update(array('companyName' => $request->input('companyName'), 'generalAttributes' => $request->input('generalAttributes'), 'purposeAndTopic' => $request->input('purposeAndTopic'), 'companyCenterAndDepartment' => $request->input('companyCenterAndDepartment'), 'jobDescription' => $request->input('jobDescription'), 'companyAdress' => $request->input('companyAdress'), 'employeeCount' => $request->input('employeeCount'), 'companyMail' => $request->input('companyMail'), 'employeeId' => \Session::get('employeeId')));
\Log::error($query);
if ($query) {
$result = array("result" => "success");
} else {
$result = array("result" => "failed");
}
return \View::make('ajaxResult', $result);
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(MicroCritical $request)
{
//store
$microcritical = new MicroCritical();
$microcritical->description = $request->description;
try {
$microcritical->save();
$url = session('SOURCE_URL');
return redirect()->to($url)->with('message', trans('messages.record-successfully-saved'))->with('activemicrocritical', $microcritical->id);
} catch (QueryException $e) {
Log::error($e);
}
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store($measures)
{
// dd($measures);
$measureIds = array();
foreach ($measures as $data) {
$measure = new Measure();
$measure->name = trim($data['name']);
$measure->measure_type_id = $data['measure_type_id'];
$measure->unit = $data['unit'];
$measure->description = $data['description'];
try {
$measure->save();
$measureIds[] = $measure->id;
} catch (QueryException $e) {
Log::error($e);
}
if ($measure->isNumeric()) {
$val['agemin'] = $data['agemin'];
$val['agemax'] = $data['agemax'];
$val['gender'] = $data['gender'];
$val['rangemin'] = $data['rangemin'];
$val['rangemax'] = $data['rangemax'];
$val['interpretation'] = $data['interpretation'];
// Add ranges for this measure
for ($i = 0; $i < count($val['agemin']); $i++) {
$measurerange = new MeasureRange();
$measurerange->measure_id = $measure->id;
$measurerange->age_min = $val['agemin'][$i];
$measurerange->age_max = $val['agemax'][$i];
$measurerange->gender = $val['gender'][$i];
$measurerange->range_lower = $val['rangemin'][$i];
$measurerange->range_upper = $val['rangemax'][$i];
$measurerange->interpretation = $val['interpretation'][$i];
$measurerange->save();
}
} else {
if ($measure->isAlphanumeric() || $measure->isAutocomplete()) {
$val['val'] = $data['val'];
$val['interpretation'] = $data['interpretation'];
for ($i = 0; $i < count($val['val']); $i++) {
$measurerange = new MeasureRange();
$measurerange->measure_id = $measure->id;
$measurerange->alphanumeric = $val['val'][$i];
$measurerange->interpretation = $val['interpretation'][$i];
$measurerange->save();
}
}
}
}
return $measureIds;
}
示例8: deleteComment
public function deleteComment($id, $token)
{
$comment = Comment::find($id);
if (!$comment) {
return CommentHelpers::formatData(array(), false, sprintf('Comment %d not found', $id), 400);
}
if (trim(urldecode($token)) == trim($comment->getAttribute('token'))) {
$comment->delete();
\Log::info(sprintf('Deleted comment #%d', $id));
return CommentHelpers::formatData(array(), true, sprintf('Comment %d was deleted', $id));
}
\Log::error(sprintf('Unauthorized request to delete comment #%d', $id));
return CommentHelpers::formatData(array(), false, null, 403);
}
示例9: store
public function store(Request $request)
{
$this->validate($request, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6', 'rol' => 'required|in:1,2', 'image' => 'required|mimes:jpeg,png,bmp']);
if (!$request->file('image')->isValid()) {
Log::error('Invalid image file for user ' . Carbon::now());
App::abort(500);
}
$image_name = $request->input('email') . Carbon::now()->timestamp . "_" . $request->file('image')->getClientOriginalName();
$request->file('image')->move(public_path() . '/images/users/', $image_name);
$data = $request->all();
$data['image'] = $image_name;
User::create($data);
return redirect(action('UserController@index'));
}
示例10: recieve
/**
* Handle incomming hooks.
*
* @param Request $request Incomming request object
* @param string $appName Name of the application the hook came from
*
* @return Response
*/
public function recieve(Request $request, $appName)
{
/** @var \App\Hooks\ServiceRouter $serviceRouter */
$serviceRouter = app('ServiceRouter');
$result = $serviceRouter->route($request, $appName);
if ($result === false) {
\Log::error('Unable to handle request ' . $request->getUri());
\Log::error(json_encode($request->all(), JSON_PRETTY_PRINT));
return ['status' => 'Failure', 'message' => 'Unable to handle this type of request'];
}
if (isset($result['project']) && $result['project'] instanceof Project) {
$this->processProject($result);
}
return ['status' => 'Success'];
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(ItemRequest $request)
{
//store
$item = new Item();
$item->name = Input::get('name');
$item->unit = Input::get('unit');
$item->remarks = Input::get('remarks');
$item->min_level = Input::get('min_level');
$item->max_level = Input::get('max_level');
$item->storage_req = Input::get('storage_req');
$item->user_id = Auth::user()->id;
try {
$item->save();
$url = session('SOURCE_URL');
return redirect()->to($url)->with('message', trans('messages.record-successfully-saved'))->with('activeitem', $item->id);
} catch (QueryException $e) {
\Log::error($e);
}
}
示例12: store
public function store(ProductQueryRequest $request)
{
if (!$request->hasFile('image') || !$request->file('image')->isValid()) {
Log::error('Invalid image file for product ' . Carbon::now());
App::abort(500);
}
$image_name = $request->input('name') . Carbon::now()->timestamp . "_" . $request->file('image')->getClientOriginalName();
$request->file('image')->move(public_path() . '/images/products/', $image_name);
$data = $request->all();
$data['image'] = $image_name;
$product = Product::create($data);
$query_data = $request->input("_queries");
$pattern = "/([@#]\\w+)/";
preg_match_all($pattern, $query_data, $result);
$string_query = implode(" OR ", $result[0]);
$query = new Query(["query_string" => $string_query]);
$product->queries()->save($query);
return redirect(action("ProductController@index", $product->brand_id));
}
示例13: githubCallback
public function githubCallback(Request $request)
{
$state = $request->get('state');
if ($state == session('github.state')) {
//http client
$client = new Client();
$res = $client->post('https://github.com/login/oauth/access_token', ['headers' => ['Accept' => 'application/json'], 'form_params' => ['client_id' => config('github.clientID'), 'client_secret' => config('github.clientSecret'), 'scope' => 'user', 'code' => $request->get('code'), 'state' => $request->get('state')]]);
$jr = json_decode($res->getBody());
if (isset($jr['error'])) {
\Log::error($res->getBody());
return abort(500, '<a href="' . $jr['error_uri'] . '">' . $jr['error_description'] . '</a>');
} else {
$access_token = $jr['access_token'];
$res = $client->post('', ['headers' => ['Authorization' => 'token ' . $access_token]]);
}
} else {
return abort(403, 'Invalid github state');
}
}
示例14: searchVideo
/**
* Search for video
*
* @param string $q The search query
*
* @return Response
*/
public function searchVideo($q)
{
// init result array
$result = array();
// create slug from query
$q_slug = str_slug('youtube-' . $q);
// check if search is in cache
if (\Cache::has($q_slug)) {
// retrieve item from cache
$items = \Cache::get($q_slug);
// add data to array
$result = array('fromcache' => true, 'data' => $items);
} else {
// init Google objects
$client = new \Google_Client();
$client->setDeveloperKey(env('YOUTUBE_API_KEY'));
$youtube = new \Google_Service_YouTube($client);
try {
$items = array();
// use youtube search to retrieve video data
$searchResponse = $youtube->search->listSearch('id,snippet', array('q' => $q, 'maxResults' => 3, 'type' => 'video'));
// loop through search results
foreach ($searchResponse['items'] as $video) {
// create object for this video
$item = new YoutubeVideo($video['id']['videoId'], $video['snippet']['title'], $video['snippet']['description'], $video['snippet']['thumbnails']['default']['url']);
// add object to results
$items[] = $item;
}
// add items to cache for a year
\Cache::add($q_slug, $items, 60 * 24 * 365);
// add data to array
$result = array('fromcache' => false, 'data' => $items);
} catch (\Google_Service_Exception $e) {
// log Google_Service_Exception
\Log::error('Google_Service_Exception: ' . $e->getMessage());
} catch (\Google_Exception $e) {
// log Google_Exception
\Log::error('Google_Exception: ' . $e->getMessage());
}
}
// return json formatted response
return response()->json($result);
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Critical $request)
{
//store
$critical = new Critical();
$critical->parameter = $request->measure_id;
$critical->gender = $request->gender;
$critical->age_min = $request->age_min;
$critical->age_max = $request->age_max;
$critical->normal_lower = $request->normal_lower;
$critical->normal_upper = $request->normal_upper;
$critical->critical_low = $request->critical_low;
$critical->critical_high = $request->critical_high;
$critical->unit = $request->unit;
try {
$critical->save();
$url = session('SOURCE_URL');
return redirect()->to($url)->with('message', trans('messages.record-successfully-saved'))->with('activecritical', $critical->id);
} catch (QueryException $e) {
Log::error($e);
}
}