How to view custom log files using Log Viewer in Laravel - laravel

I am using Laravel Log Reader
for viewing log files. It works fine.
But I also have other log files, how can I view them usig this viewer?

This package matching specific file pattern logs/laravel-*.log .So your mentioned log file doesn't match. This package doesn't have configuration to change it at present. But still if you want to view your own log files then you can override method and create your own view file.
I can provide you some basic idea and make sure i haven't written code in super clean.This is to get some idea
Custom class which is extended
<?php
namespace App\Helper;
class LaravelLogReader extends \Haruncpi\LaravelLogReader\LaravelLogReader
{
public function getLogFileDates()
{
$dates = [];
$files = glob(storage_path('logs/*.log'));
$files = array_reverse($files);
foreach ($files as $path) {
$fileName = basename($path);
array_push($dates, $fileName);
}
return $dates;
}
public function get()
{
$availableDates = $this->getLogFileDates();
if (count($availableDates) == 0) {
return response()->json([
'success' => false,
'message' => 'No log available'
]);
}
$configDate = $this->config['date'];
if ($configDate == null) {
$configDate = $availableDates[0];
}
if (!in_array($configDate, $availableDates)) {
return response()->json([
'success' => false,
'message' => 'No log file found with selected date ' . $configDate
]);
}
$pattern = "/^\[(?<date>.*)\]\s(?<env>\w+)\.(?<type>\w+):(?<message>.*)/m";
$fileName = $configDate;
$content = file_get_contents(storage_path('logs/' . $fileName));
preg_match_all($pattern, $content, $matches, PREG_SET_ORDER, 0);
$logs = [];
foreach ($matches as $match) {
$logs[] = [
'timestamp' => $match['date'],
'env' => $match['env'],
'type' => $match['type'],
'message' => trim($match['message'])
];
}
$date = $fileName;
$data = [
'available_log_dates' => $availableDates,
'date' => $date,
'filename' => $fileName,
'logs' => $logs
];
return response()->json(['success' => true, 'data' => $data]);
}
}
and view file which is copied from library view .i have named it as log.blade.php
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Log Reader</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script>
var angularUrl = '{{asset('laravel-log-reader/angular.min.js')}}';
window.angular || document.write('<script src="' + angularUrl + '">\x3C/script>')
</script>
<style>
body {
margin: 0;
padding: 0;
background: #f4f4f4;
font-family: sans-serif;
}
.btn {
text-decoration: none;
background: antiquewhite;
padding: 5px 12px;
border-radius: 25px;
}
header {
min-height: 30px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;
background: #3F51B5;
position: fixed;
left: 0;
right: 0;
top: 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
header .btn_clear_all {
background: #de4f4f;
color: #fff;
}
header .name {
font-size: 25px;
font-weight: 500;
color: white;
}
.content {
margin-top: 65px;
padding: 15px;
background: #fff;
min-height: 100px;
}
.content .date_selector {
min-height: 26px;
min-width: 130px;
border: 1px solid #ddd;
border-radius: 4px;
}
.top_content {
display: flex;
justify-content: space-between;
align-items: center;
}
.top_content .top_content_left {
display: flex;
}
.top_content .top_content_left .log_filter {
display: flex;
align-items: center;
margin-left: 15px;
}
.top_content .top_content_left .log_filter .log_type_item {
margin-right: 4px;
background: #eae9e9;
max-height: 20px;
font-size: 11px;
box-sizing: border-box;
padding: 4px 6px;
cursor: pointer;
}
.top_content .top_content_left .log_filter .log_type_item.active {
background: #2f2e2f;
color: white;
}
.top_content .top_content_left .log_filter .log_type_item.clear {
background: #607D8B;
color: white;
}
table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
}
table tr {
border: 1px solid #e8e8e8;
padding: 5px;
}
table tr:hover {
background: #f4f4f4;
}
thead tr td {
background: #717171;
color: #fff;
}
table th,
table td {
padding: 5px;
font-size: 14px;
color: #666;
}
table th {
font-size: 14px;
letter-spacing: 1px;
text-transform: uppercase;
}
#media screen and (max-width: 700px) {
.top_content {
flex-direction: column;
}
.top_content .top_content_left {
flex-direction: column;
}
.top_content .log_filter {
flex-wrap: wrap;
}
.top_content .log_filter .log_type_item {
margin-bottom: 3px;
}
}
#media screen and (max-width: 600px) {
header {
flex-direction: column;
}
header .name {
margin-bottom: 20px;
}
.content {
margin-top: 90px;
}
.btn {
font-size: 13px;
}
.dt_box,
.selected_date {
text-align: center;
}
.responsive_table {
max-width: 100%;
overflow-x: auto;
}
table {
border: 0;
}
table thead {
display: none;
}
table tr {
border-bottom: 2px solid #ddd;
display: block;
margin-bottom: 10px;
}
table td {
border-bottom: 1px dotted #ccc;
display: block;
font-size: 15px;
}
table td:last-child {
border-bottom: 0;
}
table td:before {
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
}
.badge {
padding: 2px 8px;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
font-size: 11px;
}
.badge.info {
background: #6bb5b5;
color: #fff;
}
.badge.warning {
background: #f7be57;
}
.badge.critical {
background: #de4f4f;
color: #fff;
}
.badge.emergency {
background: #ff6060;
color: white;
}
.badge.notice {
background: bisque;
}
.badge.debug {
background: #8e8c8c;
color: white;
}
.badge.alert {
background: #4ba4ea;
color: white;
}
.badge.error {
background: #c36a6a;
color: white;
}
</style>
</head>
<body ng-controller="LogCtrl">
<header>
<div class="name">#{{ title }}</div>
<div class="actions">
<a class="btn btn_clear_all" href="#" ng-click="clearAll()">Clear All</a>
<a class="btn" href="{{url(config('laravel-log-reader.admin_panel_path'))}}">Goto Admin Panel</a>
<a class="btn" href="https://laravelarticle.com/laravel-log-reader" title="Laravel Log Reader">Doc</a>
</div>
</header>
<section class="content">
<div class="top_content">
<div class="top_content_left">
<div>
<p class="selected_date" style="font-size: 14px;"><strong>
<span ng-show="response.success">Showing Logs: #{{data.date}}</span>
<span ng-hide="response.success">#{{response.message}}</span>
</strong></p>
</div>
<div class="log_filter">
<div class="log_type_item" ng-class="selectedType==tp?'active':''"
ng-repeat="tp in logTypes track by $index"
ng-click="filterByType(tp)">#{{ tp }}
</div>
<div class="log_type_item clear" ng-show="selectedType" ng-click="selectedType=undefined">CLEAR FILTER
</div>
</div>
</div>
<div class="top_content_right">
<p class="dt_box">Select Date: <select class="date_selector" ng-model="selectedDate"
ng-change="init(selectedDate)">
<option ng-repeat="dt in data.available_log_dates"
value="#{{ dt }}">#{{ dt }}
</option>
</select>
</p>
</div>
</div>
<div>
<div class="responsive_table">
<table>
<thead>
<tr>
<td width="140">Timestamp</td>
<td width="120">Env</td>
<td width="120">Type</td>
<td>Message</td>
</tr>
</thead>
<tr ng-repeat="log in data.logs |filter: selectedType track by $index">
<td>#{{ log.timestamp }}</td>
<td>#{{log.env}}</td>
<td><span class="badge #{{ log.type.toLowerCase() }}">#{{ log.type }}</span></td>
<td>#{{ log.message }}</td>
</tr>
</table>
</div>
</div>
<script>
var myApp = angular.module("myApp", []);
myApp.controller("LogCtrl", function ($scope, $http) {
$scope.title = "Log Reader";
$scope.selectedType = undefined;
$scope.logTypes = ['INFO', 'EMERGENCY', 'CRITICAL', 'ALERT', 'ERROR', 'WARNING', 'NOTICE', 'DEBUG'];
var originalData = null;
$scope.init = function (date) {
var url = '';
if (date !== '' && date !== undefined) {
url = '{{url(config('laravel-log-reader.api_route_path'))}}?date=' + date
} else {
url = '{{url("custom-logger")}}'
}
alert(url);
$http.get(url)
.success(function (data) {
$scope.response = data;
$scope.data = data.data;
originalData = data.data;
})
};
$scope.init();
$scope.filterByType = function (tp) {
$scope.selectedType = tp
};
$scope.clearAll = function () {
if (confirm("Are you sure?")) {
var url = '{{url(config('laravel-log-reader.view_route_path'))}}'
$http.post(url, {'clear': true})
.success(function (data) {
if (data.success) {
alert(data.message);
$scope.init();
}
})
}
}
})
</script>
</section>
</body>
</html>
And add two routes
Route::get('custom-logger', function () {
$laravelLogReader=new \App\Helper\LaravelLogReader();
return $laravelLogReader->get();
});
Route::get('/log-viewer', function () {
return view('log');
});
Note: this not fully optimized code but you can write it in better way.This is only to show you can override the package
Another package you can use
Ref:https://github.com/rap2hpoutre/laravel-log-viewer
This package will read all log files and i have tested it it works fine

Related

laravel dompdf export not export all content of my view

Im currently using laravel 9, laravel dompdf package for export my file , this the pdf file igot , no content at all. the data i pass did not display in the PDF. ::
But when I just open it as view , the data pass properly and the css work nice. This is how it looks like :
Here is my code on the View:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
</head>
<style>
* {
box-sizing: border-box;
margin:0;
padding:0;
}
body {
background:#DDD;
}
div.container {
max-width: 1350px;
margin: 0 auto;
overflow: hidden
}
.upcomming {
font-size: 45px;
text-transform: uppercase;
border-left: 14px solid rgba(255, 235, 59, 0.78);
padding-left: 12px;
margin: 18px 8px;
}
.container .item {
width: 48%;
float: left;
padding: 0 20px;
background: #fff;
overflow: hidden;
margin: 10px
}
.container .item-right, .container .item-left {
float: left;
padding: 20px
}
.container .item-right {
padding: 79px 0px;
margin-right: 20px;
width: 25%;
position: relative;
height: 286px;
text-align: center;
}
.container .item-right .up-border, .container .item-right .down-border {
padding: 14px 15px;
background-color: #ddd;
border-radius: 50%;
position: absolute
}
.container .item-right .up-border {
top: -8px;
right: -35px;
}
.container .item-right .down-border {
bottom: -13px;
right: -35px;
}
.container .item-right .num {
font-size: 50px;
color: #111
}
.container .item-right .day, .container .item-left .event {
color: #555;
font-size: 15px;
margin-bottom: 9px;
}
.container .item-right .day {
text-align: center;
font-size: 25px;
}
.container .item-left {
width: 71%;
padding: 34px 0px 19px 46px;
border-left: 3px dotted #999;
}
.container .item-left .title {
color: #111;
font-size: 34px;
margin-bottom: 12px
}
.container .item-left .sce {
margin-top: 5px;
display: block
}
.container .item-left .sce .icon, .container .item-left .sce p,
.container .item-left .loc .icon, .container .item-left .loc p{
float: left;
word-spacing: 5px;
letter-spacing: 1px;
color: #888;
margin-bottom: 10px;
}
.container .item-left .sce .icon, .container .item-left .loc .icon {
margin-right: 10px;
font-size: 20px;
color: #666
}
.container .item-left .loc {display: block}
.fix {clear: both}
.container .item .tickets, .booked, .cancel{
color: #fff;
padding: 6px 14px;
float: right;
margin-top: 10px;
font-size: 18px;
border: none;
cursor: pointer
}
.container .item .tickets {background: #777}
.container .item .booked {background: #3D71E9}
.container .item .cancel {background: #DF5454}
.linethrough {text-decoration: line-through}
</style>
<body>
<div class="container">
<h1 class="upcomming">Event Tickets</h1>
#php ($i=1)
#foreach ($tickets as $key=> $ticket)
<div class="item">
<div class="item-right">
<h2 class="num"> {{ $ticket->ticket_no }}</h2>
<p class="day">Ticket No.</p>
<span class="up-border"></span>
<span class="down-border"></span>
</div> <!-- end item-right -->
<div class="item-left">
<p class="event">{{ $ticket->GiftGiving->name }}</p>
<h2 class="title">{{ $ticket->name }}</h2>
<div class="sce">
<p>{{Carbon\Carbon::parse($ticket->GiftGiving->start_at )->isoFormat('LL') }}<br/> {{ Carbon\Carbon::parse($ticket->GiftGiving->start_at )->isoFormat('h:mm A') }}</p>
</div>
<div class="fix"></div>
<div class="loc">
<p>{{ $ticket->GiftGiving->venue }}</p>
</div>
<div class="fix"></div>
<button class="booked">Batch No. {{ $ticket->GiftGiving->batch_no}}</button>
</div> <!-- end item-right -->
</div> <!-- end item -->
<!--Set limitation of printing only 5 ticket per page-->
#if ($i % 6 === 0)
<div style="page-break-after: always;"></div>
#endif
#php ($i++)
#endforeach
</div>
</body>
</html>
Controller
public function GenerateTicket($code)
{
# Retrieve the records using $code
$GiftGiving = GiftGiving::where('code', $code)->firstOrFail();
$tickets = GiftGivingBeneficiary::where('gift_giving_id', $GiftGiving->id)->get();
# Users can only access their own charity's records
if ($GiftGiving->charitable_organization_id == Auth::user()->charitable_organization_id) {
# Must have at least one beneficiary before generating tickets
if ($tickets->count() < 1) {
$toastr = array(
'message' => 'Gift Giving must have at least one (1) beneficiary first before generating tickets',
'alert-type' => 'error'
);
return redirect()->back()->with($toastr);
}
# Retrieve the last batch no. from the gift giving.
$batch_no = $GiftGiving->batch_no;
# Increment Batch no. by +1
$GiftGiving->update([
'last_downloaded_by' => Auth::id(),
'batch_no' => $batch_no + 1,
]);
# Audit Logs Creation
$log = new AuditLog;
$log->user_id = Auth::user()->id;
$log->action_type = 'GENERATE PDF';
$log->charitable_organization_id = Auth::user()->charitable_organization_id;
$log->table_name = 'Gift Giving';
$log->record_id = $GiftGiving->code;
$log->action = 'Charity Admin generated tickets for the Gift Giving [' . $GiftGiving->name . '] with batch no. ' . $GiftGiving->batch_no . '.';
$log->performed_at = Carbon::now();
$log->save();
# Send Notification to each user in their Charitable Organizations
$users = User::where('charitable_organization_id', Auth::user()->charitable_organization_id)->where('status', 'Active')->get();
foreach ($users as $user) {
$notif = new Notification;
$notif->code = Str::uuid()->toString();
$notif->user_id = $user->id;
$notif->category = 'Gift Giving';
$notif->subject = 'Generated Tickets';
$notif->message = Auth::user()->role . ' ' . Auth::user()->info->first_name . ' ' .
Auth::user()->info->last_name . ' has generated tickets for [' . $GiftGiving->name . '] with batch no. ' .
$GiftGiving->batch_no . '.';
$notif->icon = 'mdi mdi-ticket';
$notif->color = 'info';
$notif->created_at = Carbon::now();
$notif->save();
}
// return view('charity.gifts.generate_ticket', compact('tickets'));
$pdf = PDF::loadView('charity.gifts.generate_ticket', compact('tickets'));
return $pdf->download($GiftGiving->name . ' - No. ' . $GiftGiving->batch_no . '.pdf');
} else {
$toastr = array(
'message' => 'Users can only access their own charity records.',
'alert-type' => 'error'
);
return redirect()->back()->with($toastr);
}
}
Hope somebody can point out what did i miss, thankyou in advance . all suggest/answer are highly appreciated.
dompdf is really picky about CSS and styles... but first, you should always put your <style> tags inside the <head> tag of the document. Without putting it there, there will be inconsistencies in how different browsers render the content, and that includes headless systems and domPDF.
So put your <style> tag in the <head> tags, and see if that helps resolve the issue, and if not, try converting your styles to tables with styling, as dompdf seems to do better with tables than divs.
you should care about syntax:
#php $i = 1; #endphp
#php $i++; #endphp

Call to a member function get_cellmap() on null in barryvdh/laravel-dompdf

I am using laravel version 9 for doing my project. and there is a feature that needs to let the user export the event ticket. I try to use the package barryvdh/laravel-dompdf . right now I encounter the error of
Call a member function get_cellmap() on null
I tried to read others' posts with a similar issue, but I found out most of them are using the for the view so seems like the solution working for them is not appropriate for me.here is my code :
controller
public function GenerateTicket($id)
{
$tickets = GiftGivingBeneficiaries::where('gift_giving_id', $id)->get();
# Retrieve the last batch no. from the gift giving.
$batch_no = GiftGiving::findOrFail($id)->batch_no;
GiftGiving::findOrFail($id)->update([
'last_downloaded_by' => Auth::id(),
'batch_no' => $batch_no + 1,
]);
$pdf = PDF::loadView('charity.gifts.generate_ticket', compact('tickets'));
return $pdf->download('event_tickets.pdf');
}
View Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- This file has been downloaded from bootdey.com #bootdey on twitter -->
<!-- All snippets are MIT license http://bootdey.com/license -->
<title>Genearate Ticket</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<section class="container">
<h1>Event Tickets</h1>
#foreach ($tickets as $key=> $ticket)
<table>
</table>
<div class="row">
<input type="hidden" value="{{$key + 1}} ">
<article class="card fl-left">
<section class="date">
<time datetime="23th feb">
<span>Ticket No.</span><br>
<span>{{ $ticket->ticket_no }}</span>
</time>
</section>
<section class="card-cont">
<small>Event Name:{{ $ticket->GiftGiving->name }}</small>
<h3>{{ $ticket->name }}</h3>
<div class="even-date">
<i class="fa fa-calendar"></i>
<time>
<span>{{ $ticket->GiftGiving->start_at }}</span>
</time>
</div>
<div class="even-info">
<i class="fa fa-map-marker"></i>
<p>
{{ $ticket->GiftGiving->venue }}
</p>
</div>
Batch No.{{ $ticket->GiftGiving->batch_no }}
</section>
</article>
</div>
#if ( $key == 5 )
<div style="page-break-before:always;"> </div>
#endif
#endforeach
</div>
<style type="text/css">
#import url('https://fonts.googleapis.com/css?family=Oswald');
* {
margin: 0;
padding: 0;
border: 0;
box-sizing: border-box
}
body {
background-color: #dadde6;
font-family: arial
}
.fl-left {
float: left
}
.fl-right {
float: right
}
h1 {
text-transform: uppercase;
font-weight: 900;
border-left: 10px solid #fec500;
padding-left: 10px;
margin-bottom: 30px
}
.row {
overflow: hidden
}
.card {
display: table-row;
width: 100%;
background-color: #fff;
color: #989898;
margin-bottom:20px;
font-family: 'Oswald', sans-serif;
text-transform: uppercase;
border-radius: 4px;
position: relative;
border: #2b2b2b 1px solid;
}
.card+.card {
margin-left: 2%
}
.date {
display: table-cell;
width: 45%;
position: relative;
text-align: center;
border-right: 2px dashed #dadde6
}
.date:before,
.date:after {
content: "";
display: block;
width: 30px;
height: 30px;
background-color: #DADDE6;
position: absolute;
top: -15px;
right: -15px;
z-index: 1;
border-radius: 50%
}
.date:after {
top: auto;
bottom: -15px
}
.date time {
display: block;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%)
}
.date time span {
display: block
}
.date time span:first-child {
color: #2b2b2b;
font-weight: 600;
font-size: 150%
}
.date time span:last-child {
text-transform: uppercase;
font-weight: 600;
margin-top: -10px
}
.card-cont {
display: table-cell;
width: 75%;
font-size: 100%;
padding: 10px 10px 30px 50px
}
.card-cont h3 {
color: #3C3C3C;
font-size: 130%
}
.row:last-child .card:last-of-type .card-cont h3 {
text-decoration: line-through
}
.card-cont>div {
display: table-row
}
.card-cont .even-date i,
.card-cont .even-info i,
.card-cont .even-date time,
.card-cont .even-info p {
display: table-cell
}
.card-cont .even-date i,
.card-cont .even-info i {
padding: 5% 5% 0 0
}
.card-cont .even-info p {
padding: 30px 50px 0 0
}
.card-cont .even-date time span {
display: block
}
.card-cont a {
display: block;
text-decoration: none;
width: 80px;
height: 30px;
background-color: #D8DDE0;
color: #fff;
text-align: center;
line-height: 30px;
border-radius: 2px;
position: absolute;
right: 10px;
bottom: 10px
}
.row:last-child .card:first-child .card-cont a {
background-color: #037FDD
}
.row:last-child .card:last-child .card-cont a {
background-color: #F8504C
}
#media screen and (max-width: 860px) {
.card {
display: block;
float: none;
width: 50%;
margin-bottom: 10px
}
.card+.card {
margin-left: 0
}
.card-cont .even-date,
.card-cont .even-info {
font-size: 75%
}
}
.page-break {
page-break-after: always;
}
</style>
<script type="text/javascript">
</script>
</body>
</html>
also, this is what my view looks like. Hope to know what part did I miss for it,every answer is highly appreciated.
Not sure if this will help but the way I execute this in my app is like so:
Maybe try storing it first then accessing it? Then delete them after 1 hour?
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true])->loadView('charity.gifts.generate_ticket', compact('tickets'));
$pdf->setPaper('a4', 'landscape');
Storage::disk('reports')->put('tickets'. '.pdf', $pdf->output());
$url = Storage::disk('reports')->url('tickets'. '.pdf');

xamarin forms Jsonreaderexception

I have a list showing stores on a page, upon clicking each store, corresponding categories and products are shown on a lists in another page. Stores, categories and products are displayed using Api calls.I am getting everything correct, but while navigating back and forth many times between store page and product page,Getting this error:
Newtonsoft.Json.JsonReaderException: Unexpected character encountered
while parsing value: <. Path '', line 0, position 0.
Using breakpoint, not able to see the source of exception. How to handle this exception?
Edit: I am getting this html just before exception
<!doctype html>
<html lang="en">
<head>
<title>Too Many Requests</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
<!-- Styles -->
<style>
html {
line-height: 1.15;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
header,
nav,
section {
display: block;
}
figcaption,
main {
display: block;
}
a {
background-color: transparent;
-webkit-text-decoration-skip: objects;
}
strong {
font-weight: inherit;
}
strong {
font-weight: bolder;
}
code {
font-family: monospace, monospace;
font-size: 1em;
}
dfn {
font-style: italic;
}
svg:not(:root) {
overflow: hidden;
}
button,
input {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
button,
input {
overflow: visible;
}
button {
text-transform: none;
}
button,
html [type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
legend {
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
[type="checkbox"],
[type="radio"] {
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
}
[type="search"]::-webkit-search-cancel-button,
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
menu {
display: block;
}
canvas {
display: inline-block;
}
template {
display: none;
}
[hidden] {
display: none;
}
html {
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-family: sans-serif;
}
*,
*::before,
*::after {
-webkit-box-sizing: inherit;
box-sizing: inherit;
}
p {
margin: 0;
}
button {
background: transparent;
padding: 0;
}
button:focus {
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
*,
*::before,
*::after {
border-width: 0;
border-style: solid;
border-color: #dae1e7;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
border-radius: 0;
}
button,
input {
font-family: inherit;
}
input::-webkit-input-placeholder {
color: inherit;
opacity: .5;
}
input:-ms-input-placeholder {
color: inherit;
opacity: .5;
}
input::-ms-input-placeholder {
color: inherit;
opacity: .5;
}
input::placeholder {
color: inherit;
opacity: .5;
}
button,
[role=button] {
cursor: pointer;
}
.bg-transparent {
background-color: transparent;
}
.bg-white {
background-color: #fff;
}
.bg-teal-light {
background-color: #64d5ca;
}
.bg-blue-dark {
background-color: #2779bd;
}
.bg-indigo-light {
background-color: #7886d7;
}
.bg-purple-light {
background-color: #a779e9;
}
.bg-no-repeat {
background-repeat: no-repeat;
}
.bg-cover {
background-size: cover;
}
.border-grey-light {
border-color: #dae1e7;
}
.hover\:border-grey:hover {
border-color: #b8c2cc;
}
.rounded-lg {
border-radius: .5rem;
}
.border-2 {
border-width: 2px;
}
.hidden {
display: none;
}
.flex {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.items-center {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.justify-center {
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
.font-sans {
font-family: Nunito, sans-serif;
}
.font-light {
font-weight: 300;
}
.font-bold {
font-weight: 700;
}
.font-black {
font-weight: 900;
}
.h-1 {
height: .25rem;
}
.leading-normal {
line-height: 1.5;
}
.m-8 {
margin: 2rem;
}
.my-3 {
margin-top: .75rem;
margin-bottom: .75rem;
}
.mb-8 {
margin-bottom: 2rem;
}
.max-w-sm {
max-width: 30rem;
}
.min-h-screen {
min-height: 100vh;
}
.py-3 {
padding-top: .75rem;
padding-bottom: .75rem;
}
.px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
}
.pb-full {
padding-bottom: 100%;
}
.absolute {
position: absolute;
}
.relative {
position: relative;
}
.pin {
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.text-black {
color: #22292f;
}
.text-grey-darkest {
color: #3d4852;
}
.text-grey-darker {
color: #606f7b;
}
.text-2xl {
font-size: 1.5rem;
}
.text-5xl {
font-size: 3rem;
}
.uppercase {
text-transform: uppercase;
}
.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.tracking-wide {
letter-spacing: .05em;
}
.w-16 {
width: 4rem;
}
.w-full {
width: 100%;
}
#media (min-width: 768px) {
.md\:bg-left {
background-position: left;
}
.md\:bg-right {
background-position: right;
}
.md\:flex {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.md\:my-6 {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
.md\:min-h-screen {
min-height: 100vh;
}
.md\:pb-0 {
padding-bottom: 0;
}
.md\:text-3xl {
font-size: 1.875rem;
}
.md\:text-15xl {
font-size: 9rem;
}
.md\:w-1\/2 {
width: 50%;
}
}
#media (min-width: 992px) {
.lg\:bg-center {
background-position: center;
}
}
</style>
</head>
<body class="antialiased font-sans">
<div class="md:flex min-h-screen">
<div class="w-full md:w-1/2 bg-white flex items-center justify-center">
<div class="max-w-sm m-8">
<div class="text-black text-5xl md:text-15xl font-black">
429 </div>
<div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
<p class="text-grey-darker text-2xl md:text-3xl font-light mb-8 leading-normal">
Sorry, you are making too many requests to our servers. </p>
<a href="http://beta.cybasetech.com/hotcool">
<button class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
Go Home
</button>
</a>
</div>
</div>
<div class="relative pb-full md:flex md:pb-0 md:min-h-screen w-full md:w-1/2">
<div style="background-image: url('/svg/403.svg');" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
</div>
</div>
</body>
</html>
The server is returning an error because you are making too many requests. You should check the response code of your HTTP request, if it is not 200 then do not attempt to parse it. You may also want to try caching some of your data locally so you are not repeatedly requesting the same data from the server.

Checkbox option in dropdown list in Slickgrid

How can I add checkboxes to the options/dropdown list using customized Slick.Editor so that I am able to select multiple values from the dropdown list which is attached to click event on a column on grid?
/*
Dropdown with Multiple checkbox select with jQuery - May 27, 2013
(c) 2013 #ElmahdiMahmoud
license: http://www.opensource.org/licenses/mit-license.php
*/
$(".dropdown dt a").on('click', function() {
$(".dropdown dd ul").slideToggle('fast');
});
$(".dropdown dd ul li a").on('click', function() {
$(".dropdown dd ul").hide();
});
function getSelectedValue(id) {
return $("#" + id).find("dt a span.value").html();
}
$(document).bind('click', function(e) {
var $clicked = $(e.target);
if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide();
});
$('.mutliSelect input[type="checkbox"]').on('click', function() {
var title = $(this).closest('.mutliSelect').find('input[type="checkbox"]').val(),
title = $(this).val() + ",";
if ($(this).is(':checked')) {
var html = '<span title="' + title + '">' + title + '</span>';
$('.multiSel').append(html);
$(".hida").hide();
} else {
$('span[title="' + title + '"]').remove();
var ret = $(".hida");
$('.dropdown dt a').append(ret);
}
});
body {
font: normal 14px/100% "Andale Mono", AndaleMono, monospace;
color: #fff;
padding: 50px;
width: 300px;
margin: 0 auto;
background-color: #374954;
}
.dropdown {
position: absolute;
top:50%;
transform: translateY(-50%);
}
a {
color: #fff;
}
.dropdown dd,
.dropdown dt {
margin: 0px;
padding: 0px;
}
.dropdown ul {
margin: -1px 0 0 0;
}
.dropdown dd {
position: relative;
}
.dropdown a,
.dropdown a:visited {
color: #fff;
text-decoration: none;
outline: none;
font-size: 12px;
}
.dropdown dt a {
background-color: #4F6877;
display: block;
padding: 8px 20px 5px 10px;
min-height: 25px;
line-height: 24px;
overflow: hidden;
border: 0;
width: 272px;
}
.dropdown dt a span,
.multiSel span {
cursor: pointer;
display: inline-block;
padding: 0 3px 2px 0;
}
.dropdown dd ul {
background-color: #4F6877;
border: 0;
color: #fff;
display: none;
left: 0px;
padding: 2px 15px 2px 5px;
position: absolute;
top: 2px;
width: 280px;
list-style: none;
height: 100px;
overflow: auto;
}
.dropdown span.value {
display: none;
}
.dropdown dd ul li a {
padding: 5px;
display: block;
}
.dropdown dd ul li a:hover {
background-color: #fff;
}
button {
background-color: #6BBE92;
width: 302px;
border: 0;
padding: 10px 0;
margin: 5px 0;
text-align: center;
color: #fff;
font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<dl class="dropdown">
<dt>
<a href="#">
<span class="hida">Select</span>
<p class="multiSel"></p>
</a>
</dt>
<dd>
<div class="mutliSelect">
<ul>
<li>
<input type="checkbox" value="Apple" />Apple</li>
<li>
<input type="checkbox" value="Blackberry" />Blackberry</li>
<li>
<input type="checkbox" value="HTC" />HTC</li>
<li>
<input type="checkbox" value="Sony Ericson" />Sony Ericson</li>
<li>
<input type="checkbox" value="Motorola" />Motorola</li>
<li>
<input type="checkbox" value="Nokia" />Nokia</li>
</ul>
</div>
</dd>
<button>Filter</button>
</dl>
Are you looking for something like this

Laravel 4 - unable to show the page

I tried to redirect to the 'login' page but the page is showing blank. Please see the following coding on the respective pages:
On routes.php:
Route::resource('users','UserController');
Route::get('/users/login', array('as' => 'users.login', 'uses' => 'UserController#getLogin'));
On UserController.php:
<?php
class UserController extends \BaseController {
/**
* Display a listing of the resource.
*
* #return Response
*/
public function index()
{
$users = User::paginate(10);
return View::make('users.index', compact('users'), array('users' => $users));
}
public function getLogin() {
return View::make('users.login');
$this->layout->content = View::make('users.login');
}
}
I have created two view files under the "app\views\users" location:
user.blade.php (master blade file)
login.blade.php (
The content of user.blade file is below:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>#yield('title')</title>
<meta name="description" content="#yield('description')">
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap
/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<style>
table form { margin-bottom: 0; }
form ul { margin-left: 0; list-style: none; }
.error { color: red; font-style: italic; }
body { padding-top: 20px; }
/* Pagination styling */
.pagination { display: inline-block; padding-right: 0; margin: 20px 0; border-radius: 4px; float: right; } .pagination>li { display: inline } .pagination>li>a, .pagination>li>span { position: relative; float: right; padding: 6px 12px; line-height: 1.428571429; text-decoration: none; color: #333333; background-color: #fff; border: 1px solid #e4e4e4; } .pagination>li:first-child>a, .pagination>li:first-child>span { margin-right: 0; border-bottom-right-radius: 4px; border-top-right-radius: 4px } .pagination>li:last-child>a, .pagination>li:last-child>span { border-bottom-left-radius: 4px; border-top-left-radius: 4px } .pagination>li>a:hover, .pagination>li>span:hover, .pagination>li>a:focus, .pagination>li>span:focus { color: #fff; background-color: #ffae12; border-color: #ffae12 } .pagination>.active>a, .pagination>.active>span,
.pagination>.active>a:hover, .pagination>.active>span:hover, .pagination>.active>a:focus, .pagination>.active>span:focus { z-index: 2; color: #fff; background-color: #F2541B; border-color: #F2541B; cursor: default } .pagination>.disabled>span, .pagination>.disabled>span:hover, .pagination>.disabled>span:focus, .pagination>.disabled>a, .pagination>.disabled>a:hover, .pagination>.disabled>a:focus { color: #777; background-color: #fff; border-color: #ddd; cursor: not-allowed } .pagination-lg>li>a, .pagination-lg>li>span { padding: 10px 16px; font-size: 18px } .pagination-lg>li:first-child>a, .pagination-lg>li:first-child>span { border-bottom-right-radius: 6px; border-top-right-radius: 6px } .pagination-lg>li:last-child>a, .pagination-lg>li:last-child>span { border-bottom-left-radius: 6px; border-top-left-radius: 6px } .pagination-sm>li>a, .pagination-sm>li>span {
padding: 5px 10px; font-size: 12px }
.pagination-sm>li:first-child>a, .pagination-sm>li:first-child>span { border-bottom-right-radius: 3px; border-top-rightt-radius: 3px } .pagination-sm>li:last-child>a, .pagination-sm>li:last-child>span { border-bottom-left-radius: 3px; border-top-left-radius: 3px }
</style>
</head>
<body>
<div class="container">
#if (Session::has('message'))
<div class="flash alert">
<p>{{ Session::get('message') }}</p>
</div>
#endif
#yield('main')
</div>
</body>
The content for login.blade file is below:
#extends('users.user')
#section('main')
<h1>Login</h1>
{{ Form::open(array('route' => 'users.getlogin')) }}
<ul>
<li>
{{ Form::label('username', 'Username:') }}
{{ Form::text('username') }}
</li>
<li>
{{ Form::label('password', 'Password:') }}
{{ Form::password('password') }}
</li>
<li>
{{ Form::submit('Submit', array('class' => 'btn')) }}
</li>
</ul>
{{ Form::close() }}
#if ($errors->any())
<ul>
{{ implode('', $errors->all('<li class="error">:message</li>')) }}
</ul>
#endif
#stop
Finally I solved this and I can access the login page as http://localhost/testlaravell/users/login:
On routes.php:
I have swap the lines:
Route::get('/users/login', array('as' => 'users.login', 'uses' => 'UserController#getLogin'));
Route::resource('users','UserController');
As I'm new to Laravel, I previously made that mistake.

Resources