Skip to content

Commit

Permalink
support multiple city,...
Browse files Browse the repository at this point in the history
  • Loading branch information
sayadaazami committed Sep 14, 2016
1 parent d41e3a5 commit 681e6fc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,27 @@ Next, add your new provider to the providers array of config/app.php:
]
```

Finally, add class alias to the aliases array of config/app.php:
Next, add class alias to the aliases array of config/app.php:

```php
'aliases' => [
// ...
// ...
'Plate' => Plate\PlateFacade::class
// ...
]
```

Finally, run:
> php artisan vendor:publish
Ho to use:
====
```php
$plate_number = '12' .
'س' .
321 .
'ایران' .
. 22;
'س' .
321 .
'ایران' .
. 22;
$plate = Plate::setPlate($plate_number);
$plate->getType(); // تاکسی
$plate->getState(); // تهران
Expand Down
2 changes: 1 addition & 1 deletion src/Plate.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private function _getCityNameByCharAndNumber($state, $char, $number){
throw new CityNotFound("There Is Not Any City With This Information");
}

return $this->_data[$state][$number][$char][0];
return implode(', ', $this->_data[$state][$number][$char]);
}

public function setPlate($plate){
Expand Down
2 changes: 2 additions & 0 deletions src/PlateFacade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Plate;

use Illuminate\Support\Facades\Facade;

class PlateFacade extends Facade
{
/**
Expand Down
5 changes: 5 additions & 0 deletions src/PlateServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ public function boot()
$this->publishes([
__DIR__ . '/config.php' => config_path('plate.php')
], 'config');

\App::bind('plate', function()
{
return new Plate;
});
}

/**
Expand Down

0 comments on commit 681e6fc

Please sign in to comment.