Added new models for Lookup Tables
Added new Library class called LookupHelper to assist in easier access to reference tables across all classes. Added lookup table migrations Added chartjs package to composer, and laravel service provider modified routes to make it easier to see what is going on rather than having different names for post things from get pages
This commit is contained in:
19
vendor/composer/autoload_classmap.php
vendored
19
vendor/composer/autoload_classmap.php
vendored
@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'App\\CharacterToCorporation' => $baseDir . '/app/Models/Charcter/CharacterToCorporation.php',
|
||||
'App\\Console\\Commands\\CalculateMarketTax' => $baseDir . '/app/Console/Commands/calculatemarkettax.php',
|
||||
'App\\Console\\Commands\\CorpJournal' => $baseDir . '/app/Console/Commands/corpJournal.php',
|
||||
'App\\Console\\Commands\\DumpFleets' => $baseDir . '/app/Console/Commands/dumpFleets.php',
|
||||
@@ -45,16 +46,15 @@ return array(
|
||||
'App\\Http\\Middleware\\TrimStrings' => $baseDir . '/app/Http/Middleware/TrimStrings.php',
|
||||
'App\\Http\\Middleware\\TrustProxies' => $baseDir . '/app/Http/Middleware/TrustProxies.php',
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => $baseDir . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\Esi' => $baseDir . '/app/Library/Esi.php',
|
||||
'App\\Library\\Esi\\Esi' => $baseDir . '/app/Library/Esi/Esi.php',
|
||||
'App\\Library\\Esi\\Mail' => $baseDir . '/app/Library/Esi/Mail.php',
|
||||
'App\\Library\\FinanceHelper' => $baseDir . '/app/Library/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\FinanceHelper' => $baseDir . '/app/Library/Finances/FinanceHelper.php',
|
||||
'App\\Library\\FleetHelper' => $baseDir . '/app/Library/FleetHelper.php',
|
||||
'App\\Library\\Finances\\Helper\\FinanceHelper' => $baseDir . '/app/Library/Finances/Helper/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\JumpBridgeTax' => $baseDir . '/app/Library/Finances/JumpBridgeTax.php',
|
||||
'App\\Library\\Finances\\MarketTax' => $baseDir . '/app/Library/Finances/MarketTax.php',
|
||||
'App\\Library\\Finances\\PlayerDonation' => $baseDir . '/app/Library/Finances/PlayerDonation.php',
|
||||
'App\\Library\\Finances\\ReprocessingTax' => $baseDir . '/app/Library/Finances/ReprocessingTax.php',
|
||||
'App\\Library\\Fleets\\FleetHelper' => $baseDir . '/app/Library/Fleets/FleetHelper.php',
|
||||
'App\\Library\\Mail' => $baseDir . '/app/Library/Mail.php',
|
||||
'App\\Library\\MoonCalc' => $baseDir . '/app/Library/MoonCalc.php',
|
||||
'App\\Library\\MoonMine' => $baseDir . '/app/Library/MoonMine.php',
|
||||
'App\\Library\\Lookups\\LookupHelper' => $baseDir . '/app/Library/Lookups/LookupHelper.php',
|
||||
'App\\Library\\Moons\\MoonCalc' => $baseDir . '/app/Library/Moons/MoonCalc.php',
|
||||
'App\\Library\\Moons\\MoonMine' => $baseDir . '/app/Library/Moons/MoonMine.php',
|
||||
'App\\Library\\SeatHelper' => $baseDir . '/app/Library/SeatHelper.php',
|
||||
@@ -70,7 +70,10 @@ return array(
|
||||
'App\\Models\\Doku\\DokuUser' => $baseDir . '/app/Models/Doku/DokuUser.php',
|
||||
'App\\Models\\Esi\\EsiScope' => $baseDir . '/app/Models/Esi/EsiScope.php',
|
||||
'App\\Models\\Esi\\EsiToken' => $baseDir . '/app/Models/Esi/EsiToken.php',
|
||||
'App\\Models\\Finances\\CorpMarketJournal' => $baseDir . '/app/Models/Finances/CorpMarketJournal.php',
|
||||
'App\\Models\\Finances\\JumpBridgeJournal' => $baseDir . '/app/Models/Finances/JumpBridgeJournal.php',
|
||||
'App\\Models\\Finances\\PlayerDonationJournal' => $baseDir . '/app/Models/Finances/PlayerDonationJournal.php',
|
||||
'App\\Models\\Finances\\ReprocessingTaxJournal' => $baseDir . '/app/Models/Finances/ReprocessingTaxJournal.php',
|
||||
'App\\Models\\Fleet\\Fleet' => $baseDir . '/app/Models/Fleet/Fleet.php',
|
||||
'App\\Models\\Fleet\\FleetActivity' => $baseDir . '/app/Models/Fleet/FleetActivity.php',
|
||||
'App\\Models\\Logistics\\Contract' => $baseDir . '/app/Models/Logistics/Contract.php',
|
||||
@@ -667,6 +670,8 @@ return array(
|
||||
'Faker\\ValidGenerator' => $vendorDir . '/fzaninotto/faker/src/Faker/ValidGenerator.php',
|
||||
'Fideloper\\Proxy\\TrustProxies' => $vendorDir . '/fideloper/proxy/src/TrustProxies.php',
|
||||
'Fideloper\\Proxy\\TrustedProxyServiceProvider' => $vendorDir . '/fideloper/proxy/src/TrustedProxyServiceProvider.php',
|
||||
'Fx3costa\\LaravelChartJs\\Builder' => $vendorDir . '/fx3costa/laravelchartjs/src/Builder.php',
|
||||
'Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider' => $vendorDir . '/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php',
|
||||
'GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php',
|
||||
'GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php',
|
||||
'GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
|
||||
|
||||
1
vendor/composer/autoload_psr4.php
vendored
1
vendor/composer/autoload_psr4.php
vendored
@@ -57,6 +57,7 @@ return array(
|
||||
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
|
||||
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
|
||||
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
|
||||
'Fx3costa\\LaravelChartJs\\' => array($vendorDir . '/fx3costa/laravelchartjs/src'),
|
||||
'Fideloper\\Proxy\\' => array($vendorDir . '/fideloper/proxy/src'),
|
||||
'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'),
|
||||
'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'),
|
||||
|
||||
24
vendor/composer/autoload_static.php
vendored
24
vendor/composer/autoload_static.php
vendored
@@ -139,6 +139,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
),
|
||||
'F' =>
|
||||
array (
|
||||
'Fx3costa\\LaravelChartJs\\' => 24,
|
||||
'Fideloper\\Proxy\\' => 16,
|
||||
'Faker\\' => 6,
|
||||
),
|
||||
@@ -376,6 +377,10 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src',
|
||||
),
|
||||
'Fx3costa\\LaravelChartJs\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/fx3costa/laravelchartjs/src',
|
||||
),
|
||||
'Fideloper\\Proxy\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/fideloper/proxy/src',
|
||||
@@ -455,6 +460,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'App\\CharacterToCorporation' => __DIR__ . '/../..' . '/app/Models/Charcter/CharacterToCorporation.php',
|
||||
'App\\Console\\Commands\\CalculateMarketTax' => __DIR__ . '/../..' . '/app/Console/Commands/calculatemarkettax.php',
|
||||
'App\\Console\\Commands\\CorpJournal' => __DIR__ . '/../..' . '/app/Console/Commands/corpJournal.php',
|
||||
'App\\Console\\Commands\\DumpFleets' => __DIR__ . '/../..' . '/app/Console/Commands/dumpFleets.php',
|
||||
@@ -494,16 +500,15 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'App\\Http\\Middleware\\TrimStrings' => __DIR__ . '/../..' . '/app/Http/Middleware/TrimStrings.php',
|
||||
'App\\Http\\Middleware\\TrustProxies' => __DIR__ . '/../..' . '/app/Http/Middleware/TrustProxies.php',
|
||||
'App\\Http\\Middleware\\VerifyCsrfToken' => __DIR__ . '/../..' . '/app/Http/Middleware/VerifyCsrfToken.php',
|
||||
'App\\Library\\Esi' => __DIR__ . '/../..' . '/app/Library/Esi.php',
|
||||
'App\\Library\\Esi\\Esi' => __DIR__ . '/../..' . '/app/Library/Esi/Esi.php',
|
||||
'App\\Library\\Esi\\Mail' => __DIR__ . '/../..' . '/app/Library/Esi/Mail.php',
|
||||
'App\\Library\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/Finances/FinanceHelper.php',
|
||||
'App\\Library\\FleetHelper' => __DIR__ . '/../..' . '/app/Library/FleetHelper.php',
|
||||
'App\\Library\\Finances\\Helper\\FinanceHelper' => __DIR__ . '/../..' . '/app/Library/Finances/Helper/FinanceHelper.php',
|
||||
'App\\Library\\Finances\\JumpBridgeTax' => __DIR__ . '/../..' . '/app/Library/Finances/JumpBridgeTax.php',
|
||||
'App\\Library\\Finances\\MarketTax' => __DIR__ . '/../..' . '/app/Library/Finances/MarketTax.php',
|
||||
'App\\Library\\Finances\\PlayerDonation' => __DIR__ . '/../..' . '/app/Library/Finances/PlayerDonation.php',
|
||||
'App\\Library\\Finances\\ReprocessingTax' => __DIR__ . '/../..' . '/app/Library/Finances/ReprocessingTax.php',
|
||||
'App\\Library\\Fleets\\FleetHelper' => __DIR__ . '/../..' . '/app/Library/Fleets/FleetHelper.php',
|
||||
'App\\Library\\Mail' => __DIR__ . '/../..' . '/app/Library/Mail.php',
|
||||
'App\\Library\\MoonCalc' => __DIR__ . '/../..' . '/app/Library/MoonCalc.php',
|
||||
'App\\Library\\MoonMine' => __DIR__ . '/../..' . '/app/Library/MoonMine.php',
|
||||
'App\\Library\\Lookups\\LookupHelper' => __DIR__ . '/../..' . '/app/Library/Lookups/LookupHelper.php',
|
||||
'App\\Library\\Moons\\MoonCalc' => __DIR__ . '/../..' . '/app/Library/Moons/MoonCalc.php',
|
||||
'App\\Library\\Moons\\MoonMine' => __DIR__ . '/../..' . '/app/Library/Moons/MoonMine.php',
|
||||
'App\\Library\\SeatHelper' => __DIR__ . '/../..' . '/app/Library/SeatHelper.php',
|
||||
@@ -519,7 +524,10 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'App\\Models\\Doku\\DokuUser' => __DIR__ . '/../..' . '/app/Models/Doku/DokuUser.php',
|
||||
'App\\Models\\Esi\\EsiScope' => __DIR__ . '/../..' . '/app/Models/Esi/EsiScope.php',
|
||||
'App\\Models\\Esi\\EsiToken' => __DIR__ . '/../..' . '/app/Models/Esi/EsiToken.php',
|
||||
'App\\Models\\Finances\\CorpMarketJournal' => __DIR__ . '/../..' . '/app/Models/Finances/CorpMarketJournal.php',
|
||||
'App\\Models\\Finances\\JumpBridgeJournal' => __DIR__ . '/../..' . '/app/Models/Finances/JumpBridgeJournal.php',
|
||||
'App\\Models\\Finances\\PlayerDonationJournal' => __DIR__ . '/../..' . '/app/Models/Finances/PlayerDonationJournal.php',
|
||||
'App\\Models\\Finances\\ReprocessingTaxJournal' => __DIR__ . '/../..' . '/app/Models/Finances/ReprocessingTaxJournal.php',
|
||||
'App\\Models\\Fleet\\Fleet' => __DIR__ . '/../..' . '/app/Models/Fleet/Fleet.php',
|
||||
'App\\Models\\Fleet\\FleetActivity' => __DIR__ . '/../..' . '/app/Models/Fleet/FleetActivity.php',
|
||||
'App\\Models\\Logistics\\Contract' => __DIR__ . '/../..' . '/app/Models/Logistics/Contract.php',
|
||||
@@ -1116,6 +1124,8 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9
|
||||
'Faker\\ValidGenerator' => __DIR__ . '/..' . '/fzaninotto/faker/src/Faker/ValidGenerator.php',
|
||||
'Fideloper\\Proxy\\TrustProxies' => __DIR__ . '/..' . '/fideloper/proxy/src/TrustProxies.php',
|
||||
'Fideloper\\Proxy\\TrustedProxyServiceProvider' => __DIR__ . '/..' . '/fideloper/proxy/src/TrustedProxyServiceProvider.php',
|
||||
'Fx3costa\\LaravelChartJs\\Builder' => __DIR__ . '/..' . '/fx3costa/laravelchartjs/src/Builder.php',
|
||||
'Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider' => __DIR__ . '/..' . '/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php',
|
||||
'GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php',
|
||||
'GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php',
|
||||
'GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php',
|
||||
|
||||
54
vendor/composer/installed.json
vendored
54
vendor/composer/installed.json
vendored
@@ -608,6 +608,60 @@
|
||||
"whoops"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fx3costa/laravelchartjs",
|
||||
"version": "2.5.1",
|
||||
"version_normalized": "2.5.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fxcosta/laravel-chartjs.git",
|
||||
"reference": "ab1b987e12c477be2408f77df8c0506be0e7848b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fxcosta/laravel-chartjs/zipball/ab1b987e12c477be2408f77df8c0506be0e7848b",
|
||||
"reference": "ab1b987e12c477be2408f77df8c0506be0e7848b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "~5.1",
|
||||
"php": ">=5.6.4"
|
||||
},
|
||||
"time": "2018-09-11T21:37:47+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Fx3costa\\LaravelChartJs\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Felix",
|
||||
"email": "fx3costa@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library",
|
||||
"keywords": [
|
||||
"chart",
|
||||
"chartjs",
|
||||
"fx3costa",
|
||||
"graphics",
|
||||
"laravel5",
|
||||
"reports"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fzaninotto/faker",
|
||||
"version": "v1.8.0",
|
||||
|
||||
219
vendor/fx3costa/laravelchartjs/README.md
vendored
Normal file
219
vendor/fx3costa/laravelchartjs/README.md
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
|
||||
# laravel-chartjs - Chart.js v2 wrapper for Laravel 5.x
|
||||
|
||||
Simple package to facilitate and automate the use of charts in Laravel 5.x
|
||||
using the [Chart.js](http://www.chartjs.org/) v2 library from Nick Downie.
|
||||
|
||||
# Setup:
|
||||
```
|
||||
composer require fx3costa/laravelchartjs
|
||||
```
|
||||
|
||||
And add the Service Provider in your file config/app.php:
|
||||
```php
|
||||
Fx3costa\LaravelChartJs\Providers\ChartjsServiceProvider::class
|
||||
```
|
||||
|
||||
Finaly, for now, you must install and add to your layouts / templates the Chartjs library that can be easily
|
||||
found for download at: http://www.chartjs.org. This setting will also be improved.
|
||||
|
||||
# Usage:
|
||||
|
||||
You can request to Service Container the service responsible for building the charts
|
||||
and passing through fluent interface the chart settings.
|
||||
|
||||
```php
|
||||
$service = app()->chartjs
|
||||
->name()
|
||||
->type()
|
||||
->size()
|
||||
->labels()
|
||||
->datasets()
|
||||
->options();
|
||||
```
|
||||
|
||||
For now the builder needs the name of the chart, the type of chart that can be anything that is supported by chartjs and the other custom configurations like labels, datasets, size and options.
|
||||
|
||||
In the dataset interface you can pass any configuration and option to your chart.
|
||||
All options available in chartjs documentation are supported.
|
||||
Just write the configuration with php array notations and its work!
|
||||
|
||||
# Advanced chartjs options
|
||||
|
||||
Since the current version allows it to add simple json string based options, it is not possible to generate options like:
|
||||
|
||||
```php
|
||||
options: {
|
||||
scales: {
|
||||
xAxes: [{
|
||||
type: 'time',
|
||||
time: {
|
||||
displayFormats: {
|
||||
quarter: 'MMM YYYY'
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Using the method optionsRaw(string) its possible to add a the options in raw format:
|
||||
|
||||
Passing string format like a json
|
||||
```php
|
||||
$chart->optionsRaw("{
|
||||
legend: {
|
||||
display:false
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
gridLines: {
|
||||
display:false
|
||||
}
|
||||
}]
|
||||
}
|
||||
}");
|
||||
```
|
||||
|
||||
Or, if your prefer, you can pass a php array format
|
||||
|
||||
```php
|
||||
$chart->optionsRaw([
|
||||
'legend' => [
|
||||
'display' => true,
|
||||
'labels' => [
|
||||
'fontColor' => '#000'
|
||||
]
|
||||
],
|
||||
'scales' => [
|
||||
'xAxes' => [
|
||||
[
|
||||
'stacked' => true,
|
||||
'gridLines' => [
|
||||
'display' => true
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
```
|
||||
|
||||
|
||||
# Examples
|
||||
|
||||
1 - Line Chart / Radar Chart:
|
||||
```php
|
||||
// ExampleController.php
|
||||
|
||||
$chartjs = app()->chartjs
|
||||
->name('lineChartTest')
|
||||
->type('line')
|
||||
->size(['width' => 400, 'height' => 200])
|
||||
->labels(['January', 'February', 'March', 'April', 'May', 'June', 'July'])
|
||||
->datasets([
|
||||
[
|
||||
"label" => "My First dataset",
|
||||
'backgroundColor' => "rgba(38, 185, 154, 0.31)",
|
||||
'borderColor' => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBorderColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBackgroundColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointHoverBackgroundColor" => "#fff",
|
||||
"pointHoverBorderColor" => "rgba(220,220,220,1)",
|
||||
'data' => [65, 59, 80, 81, 56, 55, 40],
|
||||
],
|
||||
[
|
||||
"label" => "My Second dataset",
|
||||
'backgroundColor' => "rgba(38, 185, 154, 0.31)",
|
||||
'borderColor' => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBorderColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointBackgroundColor" => "rgba(38, 185, 154, 0.7)",
|
||||
"pointHoverBackgroundColor" => "#fff",
|
||||
"pointHoverBorderColor" => "rgba(220,220,220,1)",
|
||||
'data' => [12, 33, 44, 44, 55, 23, 40],
|
||||
]
|
||||
])
|
||||
->options([]);
|
||||
|
||||
return view('example', compact('chartjs'));
|
||||
|
||||
|
||||
// example.blade.php
|
||||
|
||||
<div style="width:75%;">
|
||||
{!! $chartjs->render() !!}
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
2 - Bar Chart:
|
||||
```php
|
||||
// ExampleController.php
|
||||
|
||||
$chartjs = app()->chartjs
|
||||
->name('barChartTest')
|
||||
->type('bar')
|
||||
->size(['width' => 400, 'height' => 200])
|
||||
->labels(['Label x', 'Label y'])
|
||||
->datasets([
|
||||
[
|
||||
"label" => "My First dataset",
|
||||
'backgroundColor' => ['rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)'],
|
||||
'data' => [69, 59]
|
||||
],
|
||||
[
|
||||
"label" => "My First dataset",
|
||||
'backgroundColor' => ['rgba(255, 99, 132, 0.3)', 'rgba(54, 162, 235, 0.3)'],
|
||||
'data' => [65, 12]
|
||||
]
|
||||
])
|
||||
->options([]);
|
||||
|
||||
return view('example', compact('chartjs'));
|
||||
|
||||
|
||||
// example.blade.php
|
||||
|
||||
<div style="width:75%;">
|
||||
{!! $chartjs->render() !!}
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
3 - Pie Chart / Doughnut Chart:
|
||||
```php
|
||||
// ExampleController.php
|
||||
|
||||
$chartjs = app()->chartjs
|
||||
->name('pieChartTest')
|
||||
->type('pie')
|
||||
->size(['width' => 400, 'height' => 200])
|
||||
->labels(['Label x', 'Label y'])
|
||||
->datasets([
|
||||
[
|
||||
'backgroundColor' => ['#FF6384', '#36A2EB'],
|
||||
'hoverBackgroundColor' => ['#FF6384', '#36A2EB'],
|
||||
'data' => [69, 59]
|
||||
]
|
||||
])
|
||||
->options([]);
|
||||
|
||||
return view('example', compact('chartjs'));
|
||||
|
||||
|
||||
// example.blade.php
|
||||
|
||||
<div style="width:75%;">
|
||||
{!! $chartjs->render() !!}
|
||||
</div>
|
||||
```
|
||||
|
||||
|
||||
# OBS:
|
||||
|
||||
This README as well as the package is in development but will be constantly updated and will keep you informed as soon as
|
||||
are ready for production. Thank you for understanding.
|
||||
|
||||
Any questions or suggestions preferably open a issue!
|
||||
|
||||
# License
|
||||
LaravelChartJs is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
|
||||
32
vendor/fx3costa/laravelchartjs/composer.json
vendored
Normal file
32
vendor/fx3costa/laravelchartjs/composer.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "fx3costa/laravelchartjs",
|
||||
"description": "Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library",
|
||||
"keywords": [
|
||||
"chartjs","laravel5","chart","reports","graphics", "fx3costa"
|
||||
],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Felix",
|
||||
"email": "fx3costa@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.4",
|
||||
"illuminate/support": "~5.1"
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Fx3costa\\LaravelChartJs\\" : "src/"
|
||||
}
|
||||
},
|
||||
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Fx3costa\\LaravelChartJs\\Providers\\ChartjsServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
180
vendor/fx3costa/laravelchartjs/src/Builder.php
vendored
Normal file
180
vendor/fx3costa/laravelchartjs/src/Builder.php
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is inspired by Builder from Laravel ChartJS - Brian Faust
|
||||
*/
|
||||
|
||||
namespace Fx3costa\LaravelChartJs;
|
||||
|
||||
class Builder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $charts = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $defaults = [
|
||||
'datasets' => [],
|
||||
'labels' => [],
|
||||
'type' => 'line',
|
||||
'options' => [],
|
||||
'size' => ['width' => null, 'height' => null]
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $types = [
|
||||
'bar',
|
||||
'horizontalBar',
|
||||
'bubble',
|
||||
'scatter',
|
||||
'doughnut',
|
||||
'line',
|
||||
'pie',
|
||||
'polarArea',
|
||||
'radar'
|
||||
];
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
public function name($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->charts[$name] = $this->defaults;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $element
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function element($element)
|
||||
{
|
||||
return $this->set('element', $element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $labels
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function labels(array $labels)
|
||||
{
|
||||
return $this->set('labels', $labels);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $datasets
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function datasets(array $datasets)
|
||||
{
|
||||
return $this->set('datasets', $datasets);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function type($type)
|
||||
{
|
||||
if (!in_array($type, $this->types)) {
|
||||
throw new \InvalidArgumentException('Invalid Chart type.');
|
||||
}
|
||||
return $this->set('type', $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $size
|
||||
*
|
||||
* @return Builder
|
||||
*/
|
||||
public function size($size)
|
||||
{
|
||||
return $this->set('size', $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $options
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
public function options(array $options)
|
||||
{
|
||||
foreach ($options as $key => $value) {
|
||||
$this->set('options.' . $key, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string|array $optionsRaw
|
||||
* @return \self
|
||||
*/
|
||||
public function optionsRaw($optionsRaw)
|
||||
{
|
||||
if (is_array($optionsRaw)) {
|
||||
$this->set('optionsRaw', json_encode($optionsRaw, true));
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->set('optionsRaw', $optionsRaw);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$chart = $this->charts[$this->name];
|
||||
|
||||
return view('chart-template::chart-template')
|
||||
->with('datasets', $chart['datasets'])
|
||||
->with('element', $this->name)
|
||||
->with('labels', $chart['labels'])
|
||||
->with('options', isset($chart['options']) ? $chart['options'] : '')
|
||||
->with('optionsRaw', isset($chart['optionsRaw']) ? $chart['optionsRaw'] : '')
|
||||
->with('type', $chart['type'])
|
||||
->with('size', $chart['size']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function get($key)
|
||||
{
|
||||
return array_get($this->charts[$this->name], $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $key
|
||||
* @param $value
|
||||
*
|
||||
* @return $this|Builder
|
||||
*/
|
||||
private function set($key, $value)
|
||||
{
|
||||
array_set($this->charts[$this->name], $key, $value);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
37
vendor/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php
vendored
Normal file
37
vendor/fx3costa/laravelchartjs/src/Providers/ChartjsServiceProvider.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php namespace Fx3costa\LaravelChartJs\Providers;
|
||||
|
||||
use Fx3costa\LaravelChartJs\Builder;
|
||||
use Fx3costa\LaravelChartJs\ChartBar;
|
||||
use Fx3costa\LaravelChartJs\ChartLine;
|
||||
use Fx3costa\LaravelChartJs\ChartPieAndDoughnut;
|
||||
use Fx3costa\LaravelChartJs\ChartRadar;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ChartjsServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Array with colours configuration of the chartjs config file
|
||||
* @var array
|
||||
*/
|
||||
protected $colours = [];
|
||||
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'chart-template');
|
||||
$this->colours = config('chartjs.colours');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind('chartjs', function() {
|
||||
return new Builder();
|
||||
});
|
||||
}
|
||||
}
|
||||
22
vendor/fx3costa/laravelchartjs/src/resources/views/chart-template.blade.php
vendored
Normal file
22
vendor/fx3costa/laravelchartjs/src/resources/views/chart-template.blade.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<canvas id="{!! $element !!}" width="{!! $size['width'] !!}" height="{!! $size['height'] !!}">
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
(function() {
|
||||
"use strict";
|
||||
let ctx = document.getElementById("{!! $element !!}");
|
||||
window.{!! $element !!} = new Chart(ctx, {
|
||||
type: '{!! $type !!}',
|
||||
data: {
|
||||
labels: {!! json_encode($labels) !!},
|
||||
datasets: {!! json_encode($datasets) !!}
|
||||
},
|
||||
@if(!empty($optionsRaw))
|
||||
options: {!! $optionsRaw !!}
|
||||
@elseif(!empty($options))
|
||||
options: {!! json_encode($options) !!}
|
||||
@endif
|
||||
});
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
</canvas>
|
||||
Reference in New Issue
Block a user