-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb4444f
commit 89c38a9
Showing
3 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php namespace Arcanedev\Localization\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* Class TransRoute | ||
* | ||
* @package Arcanedev\Localization\Facades | ||
* @author ARCANEDEV <arcanedev.maroc@gmail.com> | ||
*/ | ||
class TransRoute extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
* | ||
* @throws \RuntimeException | ||
*/ | ||
protected static function getFacadeAccessor() { | ||
return 'arcanedev.localization.router'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php namespace Arcanedev\Localization\Routing; | ||
|
||
use Illuminate\Routing\Router; | ||
|
||
/** | ||
* Class TransRouter | ||
* | ||
* @package Arcanedev\Localization\Routing | ||
* @author ARCANEDEV <arcanedev.maroc@gmail.com> | ||
*/ | ||
class TransRouter extends Router | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Main Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* Create a localized route group with shared attributes. | ||
* | ||
* @param \Closure $callback | ||
*/ | ||
public function trans(\Closure $callback) | ||
{ | ||
$attributes = [ | ||
'prefix' => localization()->setLocale(), | ||
'middleware' => [ | ||
'localeSessionRedirect', | ||
'localizationRedirect' | ||
], | ||
]; | ||
|
||
$this->group($attributes, $callback); | ||
} | ||
|
||
/** | ||
* Register a new GET route with the router. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function get($uri, $action); | ||
|
||
/** | ||
* Register a new POST route with the router. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function post($uri, $action); | ||
|
||
/** | ||
* Register a new PUT route with the router. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function put($uri, $action); | ||
|
||
/** | ||
* Register a new PATCH route with the router. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function patch($uri, $action); | ||
|
||
/** | ||
* Register a new DELETE route with the router. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function delete($uri, $action); | ||
|
||
/** | ||
* Register a new OPTIONS route with the router. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function options($uri, $action); | ||
|
||
/** | ||
* Register a new route responding to all verbs. | ||
* | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function any($uri, $action); | ||
|
||
/** | ||
* Register a new route with the given verbs. | ||
* | ||
* @param array|string $methods | ||
* @param string $uri | ||
* @param \Closure|array|string $action | ||
* @return \Illuminate\Routing\Route | ||
*/ | ||
// public function match($methods, $uri, $action); | ||
} |