Commit 2d170e23 authored by Taylor Otwell's avatar Taylor Otwell

added more facades.

parent 31e2c1c4
...@@ -19,19 +19,19 @@ return array( ...@@ -19,19 +19,19 @@ return array(
*/ */
'Asset' => 'Laravel\\Asset', 'Asset' => 'Laravel\\Asset',
'Auth' => 'Laravel\\Security\\Authenticator', 'Auth' => 'Laravel\\Security\\Authenticator_Facade',
'Benchmark' => 'Laravel\\Benchmark', 'Benchmark' => 'Laravel\\Benchmark',
'Cache' => 'Laravel\\Cache\\Manager', 'Cache' => 'Laravel\\Cache\\Manager_Facade',
'Config' => 'Laravel\\Config_Facade', 'Config' => 'Laravel\\Config_Facade',
'Cookie' => 'Laravel\\Cookie_Facade', 'Cookie' => 'Laravel\\Cookie_Facade',
'Crypter' => 'Laravel\\Security\\Crypter', 'Crypter' => 'Laravel\\Security\\Crypter_Facade',
'DB' => 'Laravel\\Database\\Manager', 'DB' => 'Laravel\\Database\\Manager_Facade',
'Download' => 'Laravel\\Download_Facade', 'Download' => 'Laravel\\Download_Facade',
'Eloquent' => 'Laravel\\Database\\Eloquent\\Model', 'Eloquent' => 'Laravel\\Database\\Eloquent\\Model',
'Error' => 'Laravel\\Error', 'Error' => 'Laravel\\Error',
'File' => 'Laravel\\File_Facade', 'File' => 'Laravel\\File_Facade',
'Form' => 'Laravel\\Form_Facade', 'Form' => 'Laravel\\Form_Facade',
'Hasher' => 'Laravel\\Security\\Hasher', 'Hasher' => 'Laravel\\Security\\Hashing\\Hasher_Facade',
'HTML' => 'Laravel\\HTML_Facade', 'HTML' => 'Laravel\\HTML_Facade',
'Inflector' => 'Laravel\\Inflector', 'Inflector' => 'Laravel\\Inflector',
'Input' => 'Laravel\\Input_Facade', 'Input' => 'Laravel\\Input_Facade',
...@@ -43,9 +43,9 @@ return array( ...@@ -43,9 +43,9 @@ return array(
'Redirect' => 'Laravel\\Redirect_Facade', 'Redirect' => 'Laravel\\Redirect_Facade',
'Request' => 'Laravel\\Request_Facade', 'Request' => 'Laravel\\Request_Facade',
'Response' => 'Laravel\\Response_Facade', 'Response' => 'Laravel\\Response_Facade',
'Session' => 'Laravel\\Session\\Manager', 'Session' => 'Laravel\\Session\\Manager_Facade',
'Str' => 'Laravel\\Str', 'Str' => 'Laravel\\Str',
'Validator' => 'Laravel\\Validation\\Validator', 'Validator' => 'Laravel\\Validation\\Validator_Facade',
'View' => 'Laravel\\View_Facade', 'View' => 'Laravel\\View_Facade',
); );
\ No newline at end of file
<?php namespace Laravel\Cache; <?php namespace Laravel\Cache;
use Laravel\Facade;
use Laravel\Container; use Laravel\Container;
class Manager_Facade extends Facade { public static $resolve = 'cache'; }
class Manager { class Manager {
/** /**
......
<?php namespace Laravel\Database; <?php namespace Laravel\Database;
use Laravel\Facade;
class Manager_Facade extends Facade { public static $resolve = 'database'; }
class Manager { class Manager {
/** /**
......
...@@ -6,6 +6,10 @@ abstract class Facade { ...@@ -6,6 +6,10 @@ abstract class Facade {
* Magic Method for passing methods to a class registered in the IoC container. * Magic Method for passing methods to a class registered in the IoC container.
* This provides a convenient method of accessing functions on classes that * This provides a convenient method of accessing functions on classes that
* could not otherwise be accessed staticly. * could not otherwise be accessed staticly.
*
* Facades allow Laravel to still have a high level of dependency injection
* and testability while still accomodating the common desire to conveniently
* use classes via static methods.
*/ */
public static function __callStatic($method, $parameters) public static function __callStatic($method, $parameters)
{ {
......
<?php namespace Laravel\Security; <?php namespace Laravel\Security;
use Laravel\IoC; use Laravel\IoC;
use Laravel\Facade;
use Laravel\Session\Driver; use Laravel\Session\Driver;
class Authenticator_Facade extends Facade { public static $resolve = 'auth'; }
class Authenticator { class Authenticator {
/** /**
...@@ -51,16 +54,6 @@ class Authenticator { ...@@ -51,16 +54,6 @@ class Authenticator {
$this->session = $driver; $this->session = $driver;
} }
/**
* Get an authenticator instance from the IoC container.
*
* @return Authenticator
*/
public static function make()
{
return IoC::container()->resolve('laravel.auth');
}
/** /**
* Determine if the current user of the application is authenticated. * Determine if the current user of the application is authenticated.
* *
......
<?php namespace Laravel\Security; <?php namespace Laravel\Security;
use Laravel\IoC; use Laravel\IoC;
use Laravel\Facade;
class Crypter_Facade extends Facade { public static $resolve = 'crypter'; }
class Crypter { class Crypter {
......
<?php namespace Laravel\Security\Hashing; <?php namespace Laravel\Security\Hashing;
use Laravel\Facade;
class Hasher_Facade extends Facade { public static $resolve = 'hasher'; }
class Hasher { class Hasher {
/** /**
...@@ -22,19 +26,6 @@ class Hasher { ...@@ -22,19 +26,6 @@ class Hasher {
$this->engine = (is_null($engine)) ? new BCrypt(10, false) : $engine; $this->engine = (is_null($engine)) ? new BCrypt(10, false) : $engine;
} }
/**
* Create a new Hasher instance.
*
* If no hashing engine is provided, the BCrypt engine will be used.
*
* @param Engine $engine
* @return Hasher
*/
public static function make(Engine $engine = null)
{
return new static($engine);
}
/** /**
* Magic Method for delegating method calls to the hashing engine. * Magic Method for delegating method calls to the hashing engine.
* *
......
<?php namespace Laravel\Session; <?php namespace Laravel\Session;
use Laravel\Facade;
use Laravel\Container; use Laravel\Container;
class Manager_Facade extends Facade { public static $resolve = 'session'; }
class Manager { class Manager {
/** /**
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
use Laravel\IoC; use Laravel\IoC;
use Laravel\Str; use Laravel\Str;
use Laravel\Lang; use Laravel\Facade;
use Laravel\Lang_Factory;
class Validator_Facade extends Facade { public static $resolve = 'validator'; }
class Validator { class Validator {
...@@ -68,24 +71,11 @@ class Validator { ...@@ -68,24 +71,11 @@ class Validator {
* @param Lang $lang * @param Lang $lang
* @return void * @return void
*/ */
public function __construct(Lang $lang) public function __construct(Lang_Factory $lang)
{ {
$this->lang = $lang; $this->lang = $lang;
} }
/**
* Factory for creating new validator instances.
*
* @param array $attributes
* @param array $rules
* @param array $messages
* @return Validator
*/
public static function make($attributes, $rules, $messages = array())
{
return IoC::resolve('laravel.validator')->of($attributes, $rules, $messages);
}
/** /**
* Set the attributes, rules, and messages for the validator. * Set the attributes, rules, and messages for the validator.
* *
...@@ -104,6 +94,8 @@ class Validator { ...@@ -104,6 +94,8 @@ class Validator {
$this->attributes = $attributes; $this->attributes = $attributes;
$this->messages = $messages; $this->messages = $messages;
$this->rules = $rules; $this->rules = $rules;
return $this;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment