Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
c6f97346
Commit
c6f97346
authored
Sep 28, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring.
parent
ed3e3e73
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
250 additions
and
175 deletions
+250
-175
blade.php
laravel/blade.php
+4
-8
core.php
laravel/bootstrap/core.php
+4
-24
config.php
laravel/config.php
+8
-8
container.php
laravel/config/container.php
+6
-0
container.php
laravel/container.php
+19
-0
controller.php
laravel/controller.php
+1
-1
connection.php
laravel/database/connection.php
+30
-9
connector.php
laravel/database/connectors/connector.php
+1
-1
model.php
laravel/database/eloquent/model.php
+3
-3
grammar.php
laravel/database/grammars/grammar.php
+108
-87
mysql.php
laravel/database/grammars/mysql.php
+3
-3
manager.php
laravel/database/manager.php
+8
-0
query.php
laravel/database/query.php
+13
-13
loader.php
laravel/loader.php
+39
-17
validator.php
laravel/validation/validator.php
+3
-1
No files found.
laravel/blade.php
View file @
c6f97346
...
@@ -21,11 +21,7 @@ class Blade {
...
@@ -21,11 +21,7 @@ class Blade {
*/
*/
public
static
function
parse_string
(
$value
)
public
static
function
parse_string
(
$value
)
{
{
$value
=
static
::
rewrite_echos
(
$value
);
return
static
::
closings
(
static
::
openings
(
static
::
echos
(
$value
)));
$value
=
static
::
rewrite_openings
(
$value
);
$value
=
static
::
rewrite_closings
(
$value
);
return
$value
;
}
}
/**
/**
...
@@ -34,7 +30,7 @@ class Blade {
...
@@ -34,7 +30,7 @@ class Blade {
* @param string $value
* @param string $value
* @return string
* @return string
*/
*/
protected
static
function
rewrite_
echos
(
$value
)
protected
static
function
echos
(
$value
)
{
{
return
preg_replace
(
'/\{\{(.+)\}\}/'
,
'<?php echo $1; ?>'
,
$value
);
return
preg_replace
(
'/\{\{(.+)\}\}/'
,
'<?php echo $1; ?>'
,
$value
);
}
}
...
@@ -45,7 +41,7 @@ class Blade {
...
@@ -45,7 +41,7 @@ class Blade {
* @param string $value
* @param string $value
* @return string
* @return string
*/
*/
protected
static
function
rewrite_
openings
(
$value
)
protected
static
function
openings
(
$value
)
{
{
return
preg_replace
(
'/@(if|elseif|foreach|for|while)(\s*\(.*?\))\:/'
,
'<?php $1$2: ?>'
,
$value
);
return
preg_replace
(
'/@(if|elseif|foreach|for|while)(\s*\(.*?\))\:/'
,
'<?php $1$2: ?>'
,
$value
);
}
}
...
@@ -56,7 +52,7 @@ class Blade {
...
@@ -56,7 +52,7 @@ class Blade {
* @param string $value
* @param string $value
* @return string
* @return string
*/
*/
protected
static
function
rewrite_
closings
(
$value
)
protected
static
function
closings
(
$value
)
{
{
$value
=
preg_replace
(
'/(\s*)@(else)(.*?)\:/'
,
'$1<?php $2$3: ?>'
,
$value
);
$value
=
preg_replace
(
'/(\s*)@(else)(.*?)\:/'
,
'$1<?php $2$3: ?>'
,
$value
);
$value
=
preg_replace
(
'/(\s*)@(endif|endforeach|endfor|endwhile)(\s*)/'
,
'$1<?php $2; ?> $3'
,
$value
);
$value
=
preg_replace
(
'/(\s*)@(endif|endforeach|endfor|endwhile)(\s*)/'
,
'$1<?php $2; ?> $3'
,
$value
);
...
...
laravel/bootstrap/core.php
View file @
c6f97346
...
@@ -17,13 +17,15 @@ define('CONFIG_PATH', APP_PATH.'config/');
...
@@ -17,13 +17,15 @@ define('CONFIG_PATH', APP_PATH.'config/');
define
(
'CONTROLLER_PATH'
,
APP_PATH
.
'controllers/'
);
define
(
'CONTROLLER_PATH'
,
APP_PATH
.
'controllers/'
);
define
(
'DATABASE_PATH'
,
STORAGE_PATH
.
'database/'
);
define
(
'DATABASE_PATH'
,
STORAGE_PATH
.
'database/'
);
define
(
'LANG_PATH'
,
APP_PATH
.
'language/'
);
define
(
'LANG_PATH'
,
APP_PATH
.
'language/'
);
define
(
'LIBRARY_PATH'
,
APP_PATH
.
'libraries/'
);
define
(
'MODEL_PATH'
,
APP_PATH
.
'models/'
);
define
(
'ROUTE_PATH'
,
APP_PATH
.
'routes/'
);
define
(
'ROUTE_PATH'
,
APP_PATH
.
'routes/'
);
define
(
'SESSION_PATH'
,
STORAGE_PATH
.
'sessions/'
);
define
(
'SESSION_PATH'
,
STORAGE_PATH
.
'sessions/'
);
define
(
'SYS_CONFIG_PATH'
,
SYS_PATH
.
'config/'
);
define
(
'SYS_CONFIG_PATH'
,
SYS_PATH
.
'config/'
);
define
(
'SYS_LANG_PATH'
,
SYS_PATH
.
'language/'
);
define
(
'SYS_LANG_PATH'
,
SYS_PATH
.
'language/'
);
define
(
'VIEW_PATH'
,
APP_PATH
.
'views/'
);
define
(
'VIEW_PATH'
,
APP_PATH
.
'views/'
);
define
(
'EXT'
,
'.php'
);
define
(
'EXT'
,
'.php'
);
define
(
'BLADE_EXT'
,
'.blade.php'
);
define
(
'BLADE_EXT'
,
'.blade.php'
);
/**
/**
...
@@ -35,24 +37,6 @@ require SYS_PATH.'config'.EXT;
...
@@ -35,24 +37,6 @@ require SYS_PATH.'config'.EXT;
require
SYS_PATH
.
'loader'
.
EXT
;
require
SYS_PATH
.
'loader'
.
EXT
;
require
SYS_PATH
.
'arr'
.
EXT
;
require
SYS_PATH
.
'arr'
.
EXT
;
/**
* Determine the application environment. The environment is typically set by an environment
* variable on the server, as this provides the most accident-proof method of handling
* application environments. However, the environment could be manually set by the developer
* in the front controller if access to the environment variables is not available.
* set by an environment variable on the server.
*/
$environment
=
(
isset
(
$_SERVER
[
'LARAVEL_ENV'
]))
?
$_SERVER
[
'LARAVEL_ENV'
]
:
null
;
/**
* Register the path to the configuration files.
*/
$configs
=
array
(
SYS_CONFIG_PATH
,
CONFIG_PATH
);
if
(
!
is_null
(
$environment
))
$configs
[]
=
CONFIG_PATH
.
$environment
.
'/'
;
Config
::
$paths
=
$configs
;
/**
/**
* Bootstrap the application inversion of control (IoC) container. The container provides the
* Bootstrap the application inversion of control (IoC) container. The container provides the
* convenient resolution of objects and their dependencies, allowing for flexibility and
* convenient resolution of objects and their dependencies, allowing for flexibility and
...
@@ -68,11 +52,7 @@ IoC::$container = $container;
...
@@ -68,11 +52,7 @@ IoC::$container = $container;
* Register the application auto-loader. The auto-loader is responsible for the lazy-loading
* Register the application auto-loader. The auto-loader is responsible for the lazy-loading
* of all of the Laravel core classes, as well as the developer created libraries and models.
* of all of the Laravel core classes, as well as the developer created libraries and models.
*/
*/
spl_autoload_register
(
array
(
'Laravel\\Loader'
,
'load'
));
spl_autoload_register
(
array
(
$container
->
resolve
(
'laravel.loader'
),
'load'
));
Loader
::
$paths
=
array
(
BASE_PATH
,
APP_PATH
.
'models/'
,
APP_PATH
.
'libraries/'
,
APP_PATH
);
Loader
::
$aliases
=
Config
::
get
(
'aliases'
);
/**
/**
* Define a few convenient global functions.
* Define a few convenient global functions.
...
...
laravel/config.php
View file @
c6f97346
...
@@ -3,20 +3,20 @@
...
@@ -3,20 +3,20 @@
class
Config
{
class
Config
{
/**
/**
* All of the loaded configuration items.
* The paths to the configuration files.
*
* The configuration arrays are keyed by their owning file name.
*
*
* @var array
* @var array
*/
*/
p
rotected
static
$items
=
array
(
);
p
ublic
static
$paths
=
array
(
SYS_CONFIG_PATH
,
CONFIG_PATH
);
/**
/**
* The paths to the configuration files.
* All of the loaded configuration items.
*
* The configuration arrays are keyed by their owning file name.
*
*
* @var array
* @var array
*/
*/
p
ublic
static
$path
s
=
array
();
p
rotected
static
$item
s
=
array
();
/**
/**
* Determine if a configuration item or file exists.
* Determine if a configuration item or file exists.
...
@@ -122,8 +122,8 @@ class Config {
...
@@ -122,8 +122,8 @@ class Config {
$config
=
array
();
$config
=
array
();
// Configuration files cascade. Typically, the system configuration array is loaded
// Configuration files cascade. Typically, the system configuration array is loaded
// first, followed by the application array,
followed by the environment array.
// first, followed by the application array,
providing the convenient cascading
//
This allows the convenient overriding of configuration options
.
//
of configuration options from system to application
.
foreach
(
static
::
$paths
as
$directory
)
foreach
(
static
::
$paths
as
$directory
)
{
{
if
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
if
(
file_exists
(
$path
=
$directory
.
$file
.
EXT
))
...
...
laravel/config/container.php
View file @
c6f97346
...
@@ -64,6 +64,12 @@ return array(
...
@@ -64,6 +64,12 @@ return array(
}),
}),
'laravel.loader'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
(
$c
)
{
return
new
Loader
(
array
(
BASE_PATH
,
MODEL_PATH
,
LIBRARY_PATH
,
BASE_PATH
),
Config
::
get
(
'aliases'
));
}),
'laravel.request'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
(
$c
)
'laravel.request'
=>
array
(
'singleton'
=>
true
,
'resolver'
=>
function
(
$c
)
{
{
return
new
Request
(
$c
->
resolve
(
'laravel.uri'
),
$_SERVER
,
$_POST
);
return
new
Request
(
$c
->
resolve
(
'laravel.uri'
),
$_SERVER
,
$_POST
);
...
...
laravel/container.php
View file @
c6f97346
...
@@ -130,6 +130,25 @@ class Container {
...
@@ -130,6 +130,25 @@ class Container {
$this
->
singletons
[
$name
]
=
$instance
;
$this
->
singletons
[
$name
]
=
$instance
;
}
}
/**
* Resolve a core Laravel class from the container.
*
* <code>
* // Resolve the "laravel.input" class from the container
* $input = IoC::container()->core('input');
*
* // Equivalent resolution using the "resolve" method
* $input = IoC::container()->resolve('laravel.input');
* </code>
*
* @param string $name
* @return mixed
*/
public
function
core
(
$name
)
{
return
$this
->
resolve
(
"laravel.
{
$name
}
"
);
}
/**
/**
* Resolve an object instance from the container.
* Resolve an object instance from the container.
*
*
...
...
laravel/controller.php
View file @
c6f97346
...
@@ -35,7 +35,7 @@ abstract class Controller {
...
@@ -35,7 +35,7 @@ abstract class Controller {
{
{
if
(
IoC
::
container
()
->
registered
(
"laravel.
{
$key
}
"
))
if
(
IoC
::
container
()
->
registered
(
"laravel.
{
$key
}
"
))
{
{
return
IoC
::
container
()
->
resolve
(
"laravel.
{
$key
}
"
);
return
IoC
::
container
()
->
core
(
$key
);
}
}
elseif
(
IoC
::
container
()
->
registered
(
$key
))
elseif
(
IoC
::
container
()
->
registered
(
$key
))
{
{
...
...
laravel/database/connection.php
View file @
c6f97346
<?php
namespace
Laravel\Database
;
<?php
namespace
Laravel\Database
;
use
PDO
,
PDOStatement
;
use
PDO
;
use
PDOStatement
;
class
Connection
{
class
Connection
{
...
@@ -49,27 +46,43 @@ class Connection {
...
@@ -49,27 +46,43 @@ class Connection {
/**
/**
* Execute a SQL query against the connection and return a scalar result.
* Execute a SQL query against the connection and return a scalar result.
*
*
* @param string $sql
* <code>
* @param array $bindings
* // Get the total number of rows on a table
* @return int|float
* $count = DB::connection()->scalar('select count(*) from users');
*
* // Get the sum of payment amounts from a table
* $sum = DB::connection()->scalar('select sum(amount) from payments')
* </code>
*
* @param string $sql
* @param array $bindings
* @return float
*/
*/
public
function
scalar
(
$sql
,
$bindings
=
array
())
public
function
scalar
(
$sql
,
$bindings
=
array
())
{
{
$result
=
(
array
)
$this
->
first
(
$sql
,
$bindings
);
$result
=
(
array
)
$this
->
first
(
$sql
,
$bindings
);
return
(
strpos
(
strtolower
(
trim
(
$sql
)),
'select count'
)
===
0
)
?
(
int
)
reset
(
$result
)
:
(
float
)
reset
(
$result
);
return
(
float
)
reset
(
$result
);
}
}
/**
/**
* Execute a SQL query against the connection and return the first result.
* Execute a SQL query against the connection and return the first result.
*
*
* <code>
* // Execute a query against the database connection
* $user = DB::connection()->first('select * from users');
*
* // Execute a query with bound parameters
* $user = DB::connection()->first('select * from users where id = ?', array($id));
* </code>
*
* @param string $sql
* @param string $sql
* @param array $bindings
* @param array $bindings
* @return object
* @return object
*/
*/
public
function
first
(
$sql
,
$bindings
=
array
())
public
function
first
(
$sql
,
$bindings
=
array
())
{
{
return
(
count
(
$results
=
$this
->
query
(
$sql
,
$bindings
))
>
0
)
?
$results
[
0
]
:
null
;
if
(
count
(
$results
=
$this
->
query
(
$sql
,
$bindings
))
>
0
)
return
$results
[
0
]
;
}
}
/**
/**
...
@@ -82,6 +95,14 @@ class Connection {
...
@@ -82,6 +95,14 @@ class Connection {
* DELETE -> Number of Rows affected.
* DELETE -> Number of Rows affected.
* ELSE -> Boolean true / false depending on success.
* ELSE -> Boolean true / false depending on success.
*
*
* <code>
* // Execute a query against the database connection
* $users = DB::connection()->query('select * from users');
*
* // Execute a query with bound parameters
* $user = DB::connection()->query('select * from users where id = ?', array($id));
* </code>
*
* @param string $sql
* @param string $sql
* @param array $bindings
* @param array $bindings
* @return mixed
* @return mixed
...
...
laravel/database/connectors/connector.php
View file @
c6f97346
...
@@ -35,7 +35,7 @@ abstract class Connector {
...
@@ -35,7 +35,7 @@ abstract class Connector {
{
{
$options
=
(
isset
(
$config
[
'options'
]))
?
$config
[
'options'
]
:
array
();
$options
=
(
isset
(
$config
[
'options'
]))
?
$config
[
'options'
]
:
array
();
return
array_merge
(
$this
->
options
,
$options
)
;
return
$this
->
options
+
$options
;
}
}
}
}
\ No newline at end of file
laravel/database/eloquent/model.php
View file @
c6f97346
...
@@ -147,7 +147,7 @@ abstract class Model {
...
@@ -147,7 +147,7 @@ abstract class Model {
// Since this method is only used for instantiating models for querying
// Since this method is only used for instantiating models for querying
// purposes, we will go ahead and set the Query instance on the model.
// purposes, we will go ahead and set the Query instance on the model.
$model
->
query
=
IoC
::
resolve
(
'laravel.
database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$class
));
$model
->
query
=
IoC
::
core
(
'
database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$class
));
return
$model
;
return
$model
;
}
}
...
@@ -361,7 +361,7 @@ abstract class Model {
...
@@ -361,7 +361,7 @@ abstract class Model {
// Since the model was instantiated using "new", a query instance has not been set.
// Since the model was instantiated using "new", a query instance has not been set.
// Only models being used for querying have their query instances set by default.
// Only models being used for querying have their query instances set by default.
$this
->
query
=
IoC
::
resolve
(
'laravel.
database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$model
));
$this
->
query
=
IoC
::
core
(
'
database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
$model
));
if
(
property_exists
(
$model
,
'timestamps'
)
and
$model
::
$timestamps
)
if
(
property_exists
(
$model
,
'timestamps'
)
and
$model
::
$timestamps
)
{
{
...
@@ -410,7 +410,7 @@ abstract class Model {
...
@@ -410,7 +410,7 @@ abstract class Model {
// delete statement to the query instance.
// delete statement to the query instance.
if
(
!
$this
->
exists
)
return
$this
->
query
->
delete
();
if
(
!
$this
->
exists
)
return
$this
->
query
->
delete
();
return
IoC
::
resolve
(
'laravel.
database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
return
IoC
::
core
(
'
database'
)
->
connection
(
static
::
$connection
)
->
table
(
static
::
table
(
get_class
(
$this
)))
->
delete
(
$this
->
id
);
}
}
/**
/**
...
...
laravel/database/grammars/grammar.php
View file @
c6f97346
This diff is collapsed.
Click to expand it.
laravel/database/grammars/mysql.php
View file @
c6f97346
...
@@ -3,10 +3,10 @@
...
@@ -3,10 +3,10 @@
class
MySQL
extends
Grammar
{
class
MySQL
extends
Grammar
{
/**
/**
*
Get the keyword identifier wrapper for the connection
.
*
The keyword identifier for the database system
.
*
*
* @
return
string
* @
var
string
*/
*/
p
ublic
function
wrapper
()
{
return
'`'
;
}
p
rotected
$wrapper
=
'`'
;
}
}
\ No newline at end of file
laravel/database/manager.php
View file @
c6f97346
...
@@ -18,6 +18,14 @@ class Manager {
...
@@ -18,6 +18,14 @@ class Manager {
*
*
* Note: Database connections are managed as singletons.
* Note: Database connections are managed as singletons.
*
*
* <code>
* // Get the default database connection for the application
* $connection = DB::connection();
*
* // Get a specific connection by passing the connection name
* $connection = DB::connection('mysql');
* </code>
*
* @param string $connection
* @param string $connection
* @return Connection
* @return Connection
*/
*/
...
...
laravel/database/query.php
View file @
c6f97346
...
@@ -21,7 +21,7 @@ class Query {
...
@@ -21,7 +21,7 @@ class Query {
*
*
* @var array
* @var array
*/
*/
public
$select
;
public
$select
s
;
/**
/**
* If the query is performing an aggregate function, this will contain the column
* If the query is performing an aggregate function, this will contain the column
...
@@ -43,7 +43,7 @@ class Query {
...
@@ -43,7 +43,7 @@ class Query {
*
*
* @var string
* @var string
*/
*/
public
$
table
;
public
$
from
;
/**
/**
* The table joins.
* The table joins.
...
@@ -90,14 +90,14 @@ class Query {
...
@@ -90,14 +90,14 @@ class Query {
/**
/**
* Create a new query instance.
* Create a new query instance.
*
*
* @param Connection
$connection
* @param Connection $connection
* @param Grammars\Grammar
$grammar
* @param Grammars\Grammar $grammar
* @param string
$table
* @param string $table
* @return void
* @return void
*/
*/
public
function
__construct
(
Connection
$connection
,
Grammars\Grammar
$grammar
,
$table
)
public
function
__construct
(
Connection
$connection
,
Grammars\Grammar
$grammar
,
$table
)
{
{
$this
->
table
=
$table
;
$this
->
from
=
$table
;
$this
->
grammar
=
$grammar
;
$this
->
grammar
=
$grammar
;
$this
->
connection
=
$connection
;
$this
->
connection
=
$connection
;
}
}
...
@@ -122,7 +122,7 @@ class Query {
...
@@ -122,7 +122,7 @@ class Query {
*/
*/
public
function
select
(
$columns
=
array
(
'*'
))
public
function
select
(
$columns
=
array
(
'*'
))
{
{
$this
->
select
=
(
array
)
$columns
;
$this
->
select
s
=
(
array
)
$columns
;
return
$this
;
return
$this
;
}
}
...
@@ -139,7 +139,7 @@ class Query {
...
@@ -139,7 +139,7 @@ class Query {
*/
*/
public
function
join
(
$table
,
$column1
,
$operator
,
$column2
,
$type
=
'INNER'
)
public
function
join
(
$table
,
$column1
,
$operator
,
$column2
,
$type
=
'INNER'
)
{
{
$this
->
joins
[]
=
compact
(
't
able'
,
'column1'
,
'operator'
,
'column2'
,
'type
'
);
$this
->
joins
[]
=
compact
(
't
ype'
,
'table'
,
'column1'
,
'operator'
,
'column2
'
);
return
$this
;
return
$this
;
}
}
...
@@ -178,7 +178,7 @@ class Query {
...
@@ -178,7 +178,7 @@ class Query {
*/
*/
public
function
raw_where
(
$where
,
$bindings
=
array
(),
$connector
=
'AND'
)
public
function
raw_where
(
$where
,
$bindings
=
array
(),
$connector
=
'AND'
)
{
{
$this
->
wheres
[]
=
' '
.
$connector
.
' '
.
$where
;
$this
->
wheres
[]
=
array
(
'type'
=>
'raw'
,
'connector'
=>
$connector
,
'sql'
=>
$where
)
;
$this
->
bindings
=
array_merge
(
$this
->
bindings
,
$bindings
);
$this
->
bindings
=
array_merge
(
$this
->
bindings
,
$bindings
);
...
@@ -470,7 +470,7 @@ class Query {
...
@@ -470,7 +470,7 @@ class Query {
// Reset the SELECT clause so more queries can be performed using the same instance.
// Reset the SELECT clause so more queries can be performed using the same instance.
// This is helpful for getting aggregates and then getting actual results.
// This is helpful for getting aggregates and then getting actual results.
$this
->
select
=
null
;
$this
->
select
s
=
null
;
return
$result
;
return
$result
;
}
}
...
@@ -507,13 +507,13 @@ class Query {
...
@@ -507,13 +507,13 @@ class Query {
*/
*/
public
function
get
(
$columns
=
array
(
'*'
))
public
function
get
(
$columns
=
array
(
'*'
))
{
{
if
(
is_null
(
$this
->
select
))
$this
->
select
(
$columns
);
if
(
is_null
(
$this
->
select
s
))
$this
->
select
(
$columns
);
$results
=
$this
->
connection
->
query
(
$this
->
grammar
->
select
(
$this
),
$this
->
bindings
);
$results
=
$this
->
connection
->
query
(
$this
->
grammar
->
select
(
$this
),
$this
->
bindings
);
// Reset the SELECT clause so more queries can be performed using the same instance.
// Reset the SELECT clause so more queries can be performed using the same instance.
// This is helpful for getting aggregates and then getting actual results.
// This is helpful for getting aggregates and then getting actual results.
$this
->
select
=
null
;
$this
->
select
s
=
null
;
return
$results
;
return
$results
;
}
}
...
@@ -582,7 +582,7 @@ class Query {
...
@@ -582,7 +582,7 @@ class Query {
return
$this
->
dynamic_where
(
$method
,
$parameters
,
$this
);
return
$this
->
dynamic_where
(
$method
,
$parameters
,
$this
);
}
}
if
(
in_array
(
$method
,
array
(
'count'
,
'min'
,
'max'
,
'avg'
,
'sum'
)))
if
(
in_array
(
$method
,
array
(
'
abs'
,
'
count'
,
'min'
,
'max'
,
'avg'
,
'sum'
)))
{
{
return
(
$method
==
'count'
)
?
$this
->
aggregate
(
strtoupper
(
$method
),
'*'
)
:
$this
->
aggregate
(
strtoupper
(
$method
),
$parameters
[
0
]);
return
(
$method
==
'count'
)
?
$this
->
aggregate
(
strtoupper
(
$method
),
'*'
)
:
$this
->
aggregate
(
strtoupper
(
$method
),
$parameters
[
0
]);
}
}
...
...
laravel/loader.php
View file @
c6f97346
...
@@ -7,32 +7,56 @@ class Loader {
...
@@ -7,32 +7,56 @@ class Loader {
*
*
* @var array
* @var array
*/
*/
p
ublic
static
$paths
=
array
();
p
rotected
$paths
=
array
();
/**
/**
* The class aliases defined for the application.
* The class aliases defined for the application.
*
*
* @var array
* @var array
*/
*/
public
static
$aliases
=
array
();
protected
$aliases
=
array
();
/**
* Create a new class loader instance.
*
* @param array $paths
* @param array $aliases
* @return void
*/
public
function
__construct
(
$paths
,
$aliases
=
array
())
{
$this
->
paths
=
$paths
;
$this
->
aliases
=
$aliases
;
}
/**
/**
* Load the file for a given class.
* Load the file for a given class.
*
*
* <code>
* // Load the file for the "User" class
* Loader::load('User');
*
* // Load the file for the "Repositories\User" class
* Loader::load('Repositories\\User');
* </code>
*
* @param string $class
* @param string $class
* @return void
* @return void
*/
*/
public
static
function
load
(
$class
)
public
function
load
(
$class
)
{
{
// All Laravel core classes follow a namespace to directory convention.
So, we will
// All Laravel core classes follow a namespace to directory convention.
// replace all of the namespace slashes with directory slashes.
//
We will
replace all of the namespace slashes with directory slashes.
$file
=
strtolower
(
str_replace
(
'\\'
,
'/'
,
$class
));
$file
=
strtolower
(
str_replace
(
'\\'
,
'/'
,
$class
));
// First, we'll check to determine if an alias exists. If it does, we will define the
// Check to determine if an alias exists. If it does, we will define the
// alias and bail out. Aliases are defined for most developer used core classes.
// alias and bail out. Aliases are defined for most used core classes.
if
(
array_key_exists
(
$class
,
static
::
$aliases
))
return
class_alias
(
static
::
$aliases
[
$class
],
$class
);
if
(
array_key_exists
(
$class
,
$this
->
aliases
))
{
return
class_alias
(
$this
->
aliases
[
$class
],
$class
);
}
foreach
(
static
::
$
paths
as
$path
)
foreach
(
$this
->
paths
as
$path
)
{
{
if
(
file_exists
(
$path
=
$path
.
$file
.
EXT
))
if
(
file_exists
(
$path
=
$path
.
$file
.
EXT
))
{
{
...
@@ -46,15 +70,13 @@ class Loader {
...
@@ -46,15 +70,13 @@ class Loader {
/**
/**
* Register a class alias with the auto-loader.
* Register a class alias with the auto-loader.
*
*
* Note: Aliases are lazy-loaded, so the aliased class will not be included until it is needed.
*
* @param string $alias
* @param string $alias
* @param string $class
* @param string $class
* @return void
* @return void
*/
*/
public
static
function
alias
(
$alias
,
$class
)
public
function
alias
(
$alias
,
$class
)
{
{
static
::
$
aliases
[
$alias
]
=
$class
;
$this
->
aliases
[
$alias
]
=
$class
;
}
}
/**
/**
...
@@ -63,9 +85,9 @@ class Loader {
...
@@ -63,9 +85,9 @@ class Loader {
* @param string $path
* @param string $path
* @return void
* @return void
*/
*/
public
static
function
path
(
$path
)
public
function
path
(
$path
)
{
{
static
::
$
paths
[]
=
rtrim
(
$path
,
'/'
)
.
'/'
;
$this
->
paths
[]
=
rtrim
(
$path
,
'/'
)
.
'/'
;
}
}
/**
/**
...
@@ -74,9 +96,9 @@ class Loader {
...
@@ -74,9 +96,9 @@ class Loader {
* @param string $alias
* @param string $alias
* @return void
* @return void
*/
*/
public
static
function
forget_alias
(
$alias
)
public
function
forget_alias
(
$alias
)
{
{
unset
(
static
::
$
aliases
[
$alias
]);
unset
(
$this
->
aliases
[
$alias
]);
}
}
}
}
\ No newline at end of file
laravel/validation/validator.php
View file @
c6f97346
...
@@ -285,7 +285,9 @@ class Validator {
...
@@ -285,7 +285,9 @@ class Validator {
$value
=
$this
->
attributes
[
$attribute
];
$value
=
$this
->
attributes
[
$attribute
];
return
(
array_key_exists
(
$attribute
,
$_FILES
))
?
$value
[
'size'
]
/
1024
:
Str
::
length
(
trim
(
$value
));
$files
=
IoC
::
container
()
->
resolve
(
'laravel.input'
)
->
files
();
return
(
array_key_exists
(
$attribute
,
$files
)
?
$value
[
'size'
]
/
1024
:
Str
::
length
(
trim
(
$value
));
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment