romeroqe/admin-tools

A package that provides a series of tools for managing a web application.

1 2017-01-03 08:06 UTC

This package is not auto-updated.

Last update: 2020-05-24 16:54:41 UTC


README

A package that provides a series of tools for managing a web application.

Documentation

Installation

Composer

First, pull in the package through Composer.

require”: {
    ...
    "romeroqe/admin-tools": "dev-master"
}

And run composer:

$ composer update

Provider

Once installed you need to register the service provider with the application. Open up config/app.php and find the providers key.

'providers' => [
	...
	Romeroqe\AdminTools\AdminToolsServiceProvider::class,
]

Facade

This package also ships with a facade which provides the static syntax. You can register the facade in the aliases key of your config/app.php file.

'aliases' => [
	...
	'AdminTools' => Romeroqe\AdminTools\AdminTools::class,
]

Latest steps

To finish the installation we must publish and migrate. In the console type the following:

$ php artisan vendor:publish

Followed by:

$ php artisan migrate

Configuration

Exception Handler

To use the exception handler you need to copy the following code into. app/Exceptions/Handler.php

public function render($request, Exception $exception)
{
    $response = \AdminTools::catchException($request, $exception);
    if(!$response['status']) return parent::render($request, $exception);
    else return response()->view('errors.'.$response['error'], ['tracing_code' => $response['tracing_code']], $response['error']);
}

And go to config/admintools.php and turn true de exception_handler field.

<?php
return [
    'exception_handler' => true,
    ...
];

If you want to add new exceptions, you can modify the exception_classes field in config/admintools.php.

'exception_classes' => [
    ...
    'my\new\class\Exception' => 420,
]

Log

The log is a record of anything, useful for saving changes in laravel or in the database. The generated file will be on a path similar to storage/logs/{name}/{year}/{month}.log.

To save a record in the log, you have to use the following code, :

AdminTools::set($type, $message, $module);

And to obtain the registration of a module in a particular month:

AdminTools::get(2017, 'January', 'Users');

Cache Cleaner

To use the cache cleaner, copy and paste the following code into the <head> of your master layout.

@if(\AdminTools::cleanCache())
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
@endif

How to use

To access AdminTools go to yourdomain.com/admintools in your browser.

Credits

This package uses a number of open source projects to work properly: