Skip to content

Commit 59a5cbd

Browse files
committed
updating to L5.6 and BS4
1 parent ecf5489 commit 59a5cbd

File tree

11 files changed

+112
-43
lines changed

11 files changed

+112
-43
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Laravel Logger
1+
# Laravel Activity Logger
22

33
[![Latest Stable Version](https://poser.pugx.org/jeremykenedy/laravel-logger/v/stable)](https://packagist.org/packages/jeremykenedy/laravel-logger)
44
[![Total Downloads](https://poser.pugx.org/jeremykenedy/laravel-logger/downloads)](https://packagist.org/packages/jeremykenedy/laravel-logger)
@@ -32,7 +32,7 @@ Laravel logger can work out the box with or without the following roles packages
3232

3333
### Features
3434

35-
| Laravel Logger Features |
35+
| Laravel Activity Logger Features |
3636
| :------------ |
3737
|Logs login page visits|
3838
|Logs user logins|
@@ -60,7 +60,7 @@ Laravel logger can work out the box with or without the following roles packages
6060
|Lots of [configuration](#configuration) options|
6161

6262
### Requirements
63-
* [Laravel 5.1, 5.2, 5.3, 5.4, or 5.5+](https://laravel.com/docs/installation)
63+
* [Laravel 5.1, 5.2, 5.3, 5.4, 5.5, and 5.6+](https://laravel.com/docs/installation)
6464
* [jaybizzle/laravel-crawler-detect](https://github.com/JayBizzle/Laravel-Crawler-Detect) included dependency in composer.json (for crawler detection)
6565

6666
### Installation Instructions
@@ -101,7 +101,7 @@ Register the package with laravel in `config/app.php` under `providers` with the
101101
```
102102

103103
### Configuration
104-
Laravel Logger can be configured in directly in `/config/laravel-logger.php` if you published the assets.
104+
Laravel Activity Logger can be configured in directly in `/config/laravel-logger.php` if you published the assets.
105105
Or you can variables to your `.env` file.
106106

107107

@@ -128,11 +128,12 @@ LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
128128
LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED=false
129129
LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED=false
130130
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
131-
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
131+
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
132132
LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
133133
LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
134134
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
135-
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
135+
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
136+
LARAVEL_LOGGER_POPPER_JS_CDN_URL=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js
136137
```
137138

138139
### Usage

src/.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ LARAVEL_LOGGER_JQUERY_CDN_URL=https://code.jquery.com/jquery-2.2.4.min.js
1717
LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED=false
1818
LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED=false
1919
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED=true
20-
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
20+
LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js
2121
LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED=true
2222
LARAVEL_LOGGER_FONT_AWESOME_CDN_URL=https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css
2323
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED=true
24-
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css
24+
LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css
25+
LARAVEL_LOGGER_POPPER_JS_CDN_URL=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js

src/app/Logic/helpers.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{
55
/**
66
* Clean the url for the front end to display
7+
*
78
* @param string $link
89
* @return echo string
910
*/

src/config/laravel-logger.php

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,42 @@
9595

9696
/*
9797
|--------------------------------------------------------------------------
98-
| Laravel Logger Dependencies - allows for easier builds into other projects
98+
| Blade settings
9999
|--------------------------------------------------------------------------
100100
*/
101101

102-
// jQuery
103-
'enablejQueryCDN' => env('LARAVEL_LOGGER_JQUERY_CDN_ENABLED', true),
104-
'JQueryCDN' => env('LARAVEL_LOGGER_JQUERY_CDN_URL', 'https://code.jquery.com/jquery-2.2.4.min.js'),
102+
// The parent Blade file
103+
'loggerBladeExtended' => 'layouts.app',
104+
105+
// Switch Between bootstrap 3 `panel` and bootstrap 4 `card` classes
106+
'bootstapVersion' => '4',
107+
108+
// Additional Card classes for styling -
109+
// See: https://getbootstrap.com/docs/4.0/components/card/#background-and-color
110+
// Example classes: 'text-white bg-primary mb-3'
111+
'bootstrapCardClasses' => '',
105112

106113
// Blade Extension Placement
107114
'enableBladeCssPlacement' => env('LARAVEL_LOGGER_BLADE_CSS_PLACEMENT_ENABLED', false),
108115
'enableBladeJsPlacement' => env('LARAVEL_LOGGER_BLADE_JS_PLACEMENT_ENABLED', false),
109116

117+
/*
118+
|--------------------------------------------------------------------------
119+
| Laravel Logger Dependencies - allows for easier builds into other projects
120+
|--------------------------------------------------------------------------
121+
*/
122+
123+
// jQuery
124+
'enablejQueryCDN' => env('LARAVEL_LOGGER_JQUERY_CDN_ENABLED', true),
125+
'JQueryCDN' => env('LARAVEL_LOGGER_JQUERY_CDN_URL', 'https://code.jquery.com/jquery-3.2.1.slim.min.js'),
126+
110127
// Bootstrap
111128
'enableBootstrapCssCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_ENABLED', true),
112-
'bootstrapCssCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'),
129+
'bootstrapCssCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_CSS_CDN_URL', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css'),
113130
'enableBootstrapJsCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_ENABLED', true),
114-
'bootstrapJsCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'),
131+
'bootstrapJsCDN' => env('LARAVEL_LOGGER_BOOTSTRAP_JS_CDN_URL', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js'),
132+
'enablePopperJsCDN' => env('LARAVEL_LOGGER_POPPER_JS_CDN_ENABLED', true),
133+
'popperJsCDN' => env('LARAVEL_LOGGER_POPPER_JS_CDN_URL', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js'),
115134

116135
// Font Awesome
117136
'enableFontAwesomeCDN' => env('LARAVEL_LOGGER_FONT_AWESOME_CDN_ENABLED', true),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{!! Form::open(array('route' => 'clear-activity')) !!}
22
{!! Form::hidden('_method', 'DELETE') !!}
3-
{!! Form::button('<i class="fa fa-fw fa-trash" aria-hidden="true"></i>' . trans('LaravelLogger::laravel-logger.dashboard.menu.clear'), array('type' => 'button', 'data-toggle' => 'modal', 'data-target' => '#confirmDelete', 'data-title' => trans('LaravelLogger::laravel-logger.modals.clearLog.title'),'data-message' => trans('LaravelLogger::laravel-logger.modals.clearLog.message'))) !!}
3+
{!! Form::button('<i class="fa fa-fw fa-trash" aria-hidden="true"></i>' . trans('LaravelLogger::laravel-logger.dashboard.menu.clear'), array('type' => 'button', 'data-toggle' => 'modal', 'data-target' => '#confirmDelete', 'data-title' => trans('LaravelLogger::laravel-logger.modals.clearLog.title'),'data-message' => trans('LaravelLogger::laravel-logger.modals.clearLog.message'), 'class' => 'dropdown-item')) !!}
44
{!! Form::close() !!}

src/resources/views/logger/activity-log-cleared.blade.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@extends('layouts.app')
1+
@extends(config('LaravelLogger.loggerBladeExtended'))
22

33
@section('template_title')
44
@lang('LaravelLogger::laravel-logger.dashboardCleared.title')
@@ -85,6 +85,10 @@
8585
<script type="text/javascript" src="{{ config('LaravelLogger.bootstrapJsCDN') }}"></script>
8686
@endif
8787

88+
@if(config('LaravelLogger.enablePopperJsCDN'))
89+
<script type="text/javascript" src="{{ config('LaravelLogger.popperJsCDN') }}"></script>
90+
@endif
91+
8892
@include('LaravelLogger::scripts.confirm-modal', ['formTrigger' => '#confirmDelete'])
8993
@include('LaravelLogger::scripts.confirm-modal', ['formTrigger' => '#confirmRestore'])
9094

@@ -101,4 +105,4 @@
101105

102106
@if(config('LaravelLogger.enableBladeJsPlacement'))
103107
@endsection
104-
@endif
108+
@endif

src/resources/views/logger/activity-log-item.blade.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@extends('layouts.app')
1+
@extends(config('LaravelLogger.loggerBladeExtended'))
22

33
@section('template_title')
44
@lang('LaravelLogger::laravel-logger.drilldown.title', ['id' => $activity->id])
@@ -363,6 +363,10 @@
363363
<script type="text/javascript" src="{{ config('LaravelLogger.bootstrapJsCDN') }}"></script>
364364
@endif
365365

366+
@if(config('LaravelLogger.enablePopperJsCDN'))
367+
<script type="text/javascript" src="{{ config('LaravelLogger.popperJsCDN') }}"></script>
368+
@endif
369+
366370
@if(config('LaravelLogger.loggerDatatables'))
367371
@if (count($activities) > 10)
368372
@include('LaravelLogger::scripts.datatables')
@@ -371,4 +375,4 @@
371375

372376
@if(config('LaravelLogger.enableBladeJsPlacement'))
373377
@endsection
374-
@endif
378+
@endif

src/resources/views/logger/activity-log.blade.php

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@extends('layouts.app')
1+
@extends(config('LaravelLogger.loggerBladeExtended'))
22

33
@section('template_title')
44
@lang('LaravelLogger::laravel-logger.dashboard.title')
@@ -12,6 +12,22 @@
1212
@include('LaravelLogger::partials.styles')
1313
@endif
1414

15+
@php
16+
switch (config('LaravelLogger.bootstapVersion')) {
17+
case '4':
18+
$containerClass = 'card';
19+
$containerHeaderClass = 'card-header';
20+
$containerBodyClass = 'card-body';
21+
break;
22+
case '3':
23+
default:
24+
$containerClass = 'panel panel-default';
25+
$containerHeaderClass = 'panel-heading';
26+
$containerBodyClass = 'panel-body';
27+
}
28+
$bootstrapCardClasses = (is_null(config('LaravelLogger.bootstrapCardClasses')) ? '' : config('LaravelLogger.bootstrapCardClasses'));
29+
@endphp
30+
1531
@section('content')
1632

1733
<div class="container-fluid">
@@ -22,36 +38,53 @@
2238

2339
<div class="row">
2440
<div class="col-sm-12">
25-
<div class="panel panel-default">
26-
<div class="panel-heading">
27-
<div style="display: flesx; justify-content: spacse-between; align-items: censter;">
28-
@lang('LaravelLogger::laravel-logger.dashboard.title')
41+
<div class="{{ $containerClass }} {{ $bootstrapCardClasses }}">
42+
<div class="{{ $containerHeaderClass }}">
43+
<div style="display: flex; justify-content: space-between; align-items: center;">
44+
2945
@if(config('LaravelLogger.enableSubMenu'))
30-
<small>
31-
<sup class="label label-default">
32-
{{ $totalActivities }} @lang('LaravelLogger::laravel-logger.dashboard.subtitle')
33-
</sup>
34-
</small>
46+
47+
<span>
48+
@lang('LaravelLogger::laravel-logger.dashboard.title')
49+
<small>
50+
<sup class="label label-default">
51+
{{ $totalActivities }} @lang('LaravelLogger::laravel-logger.dashboard.subtitle')
52+
</sup>
53+
</small>
54+
</span>
55+
3556
<div class="btn-group pull-right btn-group-xs">
3657
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
3758
<i class="fa fa-ellipsis-v fa-fw" aria-hidden="true"></i>
3859
<span class="sr-only">
3960
@lang('LaravelLogger::laravel-logger.dashboard.menu.alt')
4061
</span>
4162
</button>
42-
<ul class="dropdown-menu">
43-
<li>
63+
@if(config('LaravelLogger.bootstapVersion') == '4')
64+
<div class="dropdown-menu dropdown-menu-right">
4465
@include('LaravelLogger::forms.clear-activity-log')
45-
</li>
46-
<li>
47-
<a href="{{route('cleared')}}">
66+
<a href="{{route('cleared')}}" class="dropdown-item">
4867
<i class="fa fa-fw fa-history" aria-hidden="true"></i>
4968
@lang('LaravelLogger::laravel-logger.dashboard.menu.show')
5069
</a>
51-
</li>
52-
</ul>
70+
</div>
71+
@else
72+
<ul class="dropdown-menu dropdown-menu-right">
73+
<li class="dropdown-item">
74+
@include('LaravelLogger::forms.clear-activity-log')
75+
</li>
76+
<li class="dropdown-item">
77+
<a href="{{route('cleared')}}">
78+
<i class="fa fa-fw fa-history" aria-hidden="true"></i>
79+
@lang('LaravelLogger::laravel-logger.dashboard.menu.show')
80+
</a>
81+
</li>
82+
</ul>
83+
@endif
5384
</div>
85+
5486
@else
87+
@lang('LaravelLogger::laravel-logger.dashboard.title')
5588
<span class="pull-right label label-default">
5689
{{ $totalActivities }}
5790
<span class="hidden-sms">
@@ -62,7 +95,7 @@
6295

6396
</div>
6497
</div>
65-
<div class="panel-body">
98+
<div class="{{ $containerBodyClass }}">
6699
@include('LaravelLogger::logger.partials.activity-table', ['activities' => $activities, 'hoverable' => true])
67100
</div>
68101
</div>
@@ -86,6 +119,10 @@
86119
<script type="text/javascript" src="{{ config('LaravelLogger.bootstrapJsCDN') }}"></script>
87120
@endif
88121

122+
@if(config('LaravelLogger.enablePopperJsCDN'))
123+
<script type="text/javascript" src="{{ config('LaravelLogger.popperJsCDN') }}"></script>
124+
@endif
125+
89126
@include('LaravelLogger::scripts.confirm-modal', ['formTrigger' => '#confirmDelete'])
90127

91128
@if(config('LaravelLogger.loggerDatatables'))
@@ -101,4 +138,4 @@
101138

102139
@if(config('LaravelLogger.enableBladeJsPlacement'))
103140
@endsection
104-
@endif
141+
@endif

src/resources/views/logger/partials/activity-table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@endphp
1717

1818
<div class="table-responsive activity-table">
19-
<table class="table table-striped table-condensed @if(config('LaravelLogger.enableDrillDown') && $hoverable) table-hover @endif data-table">
19+
<table class="table table-striped table-condensed table-sm @if(config('LaravelLogger.enableDrillDown') && $hoverable) table-hover @endif data-table">
2020
<thead>
2121
<tr>
2222
<th>

src/resources/views/modals/confirm-modal.blade.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
}
1313
@endphp
1414
<div class="modal fade modal-{{$modalClass}}" id="{{$formTrigger}}" role="dialog" aria-labelledby="{{$formTrigger}}Label" aria-hidden="true">
15-
<div class="modal-dialog">
15+
<div class="modal-dialog" role="document">
1616
<div class="modal-content">
17-
<div class="modal-header">
17+
<div class="modal-header {{$modalClass}}">
18+
<h5 class="modal-title">
19+
Confirm
20+
</h5>
1821
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
19-
<h4 class="modal-title">Confirm</h4>
2022
</div>
2123
<div class="modal-body">
2224
<p>Are you sure?</p>

0 commit comments

Comments
 (0)