Skip to content

Commit

Permalink
add the defined route name to the route object
Browse files Browse the repository at this point in the history
  • Loading branch information
WanWizard committed Jul 12, 2014
1 parent 5a2f31b commit 30ba478
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion classes/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class Route
*/
public $strip_extension = true;

/**
* @var string route name
*/
public $name = null;

/**
* @var string route module
*/
Expand Down Expand Up @@ -80,13 +85,14 @@ class Route
*/
protected $search = null;

public function __construct($path, $translation = null, $case_sensitive = null, $strip_extension = null)
public function __construct($path, $translation = null, $case_sensitive = null, $strip_extension = null, $name = null)
{
$this->path = $path;
$this->translation = ($translation === null) ? $path : $translation;
$this->search = ($translation == stripslashes($path)) ? $path : $this->compile();
$this->case_sensitive = ($case_sensitive === null) ? \Config::get('routing.case_sensitive', true) : $case_sensitive;
$this->strip_extension = ($strip_extension === null) ? \Config::get('routing.strip_extension', true) : $strip_extension;
$this->name = $name;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public static function add($path, $options = null, $prepend = false, $case_sensi

if ($prepend)
{
\Arr::prepend(static::$routes, $name, new \Route($path, $options, $case_sensitive));
\Arr::prepend(static::$routes, $name, new \Route($path, $options, $case_sensitive, $name));
return;
}

static::$routes[$name] = new \Route($path, $options, $case_sensitive);
static::$routes[$name] = new \Route($path, $options, $case_sensitive, $name);
}

/**
Expand Down

0 comments on commit 30ba478

Please sign in to comment.