Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
added Facade
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Mills committed Jun 1, 2020
1 parent 239aae2 commit ab069a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Commands/GedcomImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Asdfx\LaravelGedcom\Commands;

use Asdfx\LaravelGedcom\Utils\GedcomParser;
use Asdfx\LaravelGedcom\Facades\GedcomParserFacade;
use Illuminate\Console\Command;

class GedcomImporter extends Command
Expand Down Expand Up @@ -39,7 +39,6 @@ public function __construct()
public function handle()
{
$filename = $this->argument('filename');
$parser = new GedcomParser();
$parser->parse($filename, true);
GedcomParserFacade::parse($filename, true);
}
}
13 changes: 13 additions & 0 deletions src/Facades/GedcomParserFacade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Asdfx\LaravelGedcom\Facades;

use Illuminate\Support\Facades\Facade;

class GedcomParserFacade extends Facade
{
protected static function getFacadeAccessor()
{
return 'asdfx/laravel-gedcom:parser';
}
}
5 changes: 5 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Asdfx\LaravelGedcom;

use Asdfx\LaravelGedcom\Commands\GedcomImporter;
use Asdfx\LaravelGedcom\Utils\GedcomParser;

class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
Expand All @@ -11,6 +12,10 @@ public function register()
$this->commands([
GedcomImporter::class
]);

$this->app->bind('asdfx/laravel-gedcom:parser', function () {
return new GedcomParser();
});
}

public function boot()
Expand Down

0 comments on commit ab069a1

Please sign in to comment.