Added LivewireCharts facade

This commit is contained in:
Andrés Santibáñez
2020-11-08 21:53:26 -05:00
parent dbbbf8eca2
commit f5b40ec73d
3 changed files with 75 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace Asantibanez\LivewireCharts\Facades;
use Asantibanez\LivewireCharts\Models\AreaChartModel;
use Asantibanez\LivewireCharts\Models\ColumnChartModel;
use Asantibanez\LivewireCharts\Models\LineChartModel;
use Asantibanez\LivewireCharts\Models\PieChartModel;
use Illuminate\Support\Facades\Facade;
/**
* Class LivewireCharts
* @package Asantibanez\LivewireCharts\Facades
* @method static LineChartModel lineChartModel()
* @method static LineChartModel multiLineChartModel()
* @method static ColumnChartModel columnChartModel()
* @method static ColumnChartModel multiColumnChartModel()
* @method static AreaChartModel areaChartModel()
* @method static PieChartModel pieChartModel()
*/
class LivewireCharts extends Facade
{
protected static function getFacadeAccessor()
{
return 'livewirecharts';
}
}

47
src/LivewireCharts.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
namespace Asantibanez\LivewireCharts;
use Asantibanez\LivewireCharts\Models\AreaChartModel;
use Asantibanez\LivewireCharts\Models\ColumnChartModel;
use Asantibanez\LivewireCharts\Models\LineChartModel;
use Asantibanez\LivewireCharts\Models\PieChartModel;
class LivewireCharts
{
public function lineChartModel()
{
return (new LineChartModel)
->singleLine();
}
public function multiLineChartModel()
{
return (new LineChartModel)
->multiLine();
}
public function columnChartModel()
{
return (new ColumnChartModel)
->singleColumn();
}
public function multiColumnChartModel()
{
return (new ColumnChartModel)
->multiColumn();
}
public function areaChartModel()
{
return new AreaChartModel;
}
public function pieChartModel()
{
return new PieChartModel;
}
}

View File

@@ -35,6 +35,6 @@ class LivewireChartsServiceProvider extends ServiceProvider
*/
public function register()
{
//
$this->app->bind('livewirecharts', LivewireCharts::class);
}
}