PHP code example of alexdeoliveira / laravel-zabbix-graph

1. Go to this page and download the library: Download alexdeoliveira/laravel-zabbix-graph library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alexdeoliveira / laravel-zabbix-graph example snippets


// config/app.php
'providers' => [
    ...
    Alexdeoliveira\LaravelZabbixGraph\ZabbixGraphServiceProvider::class,
],

// config/app.php
'aliases' => [
    ...
    'ZabbixGraph' => Alexdeoliveira\LaravelZabbixGraph\ZabbixGraphFacade::class,
],



namespace App\Http\Controllers;

use Carbon\Carbon;
use Illuminate\Http\Request;
use Alexdeoliveira\ZabbixGraph\ZabbixGraph;

class GraphsController extends Controller
{
    public function show(Request $request, ZabbixGraph $zabbixGraph, $id)
    {
        $graph = $zabbixGraph->startTime(Carbon::now()->subDay())
            ->width($request->input('width', 1000))
            ->height($request->input('height', 200))
            ->find($id);

        return response($graph)
            ->header('Content-Type', 'image/png');
    }
}



namespace App\Http\Controllers;

use ZabbixGraph;
use Carbon\Carbon;
use Illuminate\Http\Request;

class GraphsController extends Controller
{
    public function show(Request $request, $id)
    {
        $graph = ZabbixGraph::startTime(Carbon::now()->subDay())
            ->width($request->input('width', 1000))
            ->height($request->input('height', 200))
            ->find($id);

        return response($graph)
            ->header('Content-Type', 'image/png');
    }
}

php artisan vendor:publish --provider="Alexdeoliveira\LaravelZabbixGraph\ZabbixGraphServiceProvider"