1 | <?php |
||
2 | |||
3 | use Ffcms\Core\Helper\Date; |
||
4 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
5 | |||
6 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
7 | /** @var Apps\ActiveRecord\UserLog[]|\Illuminate\Support\Collection $records */ |
||
8 | /** @var array $pagination */ |
||
9 | |||
10 | $this->layout('_layouts/default', [ |
||
11 | 'title' => __('Logs'), |
||
12 | 'breadcrumbs' => [ |
||
13 | Url::to('main/index') => __('Home'), |
||
14 | Url::to('profile/show', [\App::$User->identity()->getId()]) => __('Profile'), |
||
15 | __('Logs') |
||
16 | ] |
||
17 | ]); |
||
18 | ?> |
||
19 | |||
20 | <?php $this->start('body') ?> |
||
21 | |||
22 | <?php $this->insert('profile/menus/settings') ?> |
||
23 | |||
24 | <h2><?= __('My logs') ?></h2> |
||
25 | <hr /> |
||
26 | <?php if(!$records || $records->count() < 1) { |
||
27 | echo $this->bootstrap()->alert('info', __('No logs available')); |
||
28 | $this->stop(); |
||
29 | return; |
||
30 | } ?> |
||
31 | <div class="table-responsive"> |
||
32 | <?php |
||
33 | $table = $this->table(['class' => 'table']) |
||
34 | ->head([ |
||
35 | ['text' => '#'], |
||
36 | ['text' => __('Type')], |
||
37 | ['text' => __('Message')], |
||
38 | ['text' => __('Date')] |
||
39 | ]); |
||
40 | foreach ($records as $log) { |
||
41 | $table->row([ |
||
42 | ['type' => 'text', 'text' => $log->id], |
||
43 | ['type' => 'text', 'text' => $log->type], |
||
44 | ['type' => 'text', 'text' => $log->message], |
||
45 | ['type' => 'text', 'text' => Date::convertToDatetime($log->created_at, Date::FORMAT_TO_HOUR)] |
||
46 | ]); |
||
47 | } |
||
48 | echo $table->display(); |
||
49 | ?> |
||
50 | </div> |
||
51 | |||
52 | <?= $this->bootstrap()->pagination(['profile/log'], ['class' => 'pagination justify-content-center']) |
||
53 | ->size($pagination['total'], $pagination['page'], $pagination['step']) |
||
54 | ->display() |
||
55 | ?> |
||
56 | |||
57 | <?php $this->stop() ?> |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: