*/
public function createConnection($dsn, array $config, array $options)
{
$username = array_get($config, 'username');
$password = array_get($config, 'password');
return new PDO($dsn, $username, $password, $options);
}
<?php namespace Illuminate\Database\Connectors;
use PDO;
class Connector {
/**
* The default PDO connection options.
*
* @var array
$dsn = $this->getDsn($config);
// We need to grab the PDO options that should be used while making the brand
// new connection instance. The PDO options control various aspects of the
// connection's behavior, and some might be specified by the developers.
$options = $this->getOptions($config);
$connection = $this->createConnection($dsn, $config, $options);
$collation = $config['collation'];
* @param string $name
* @return \Illuminate\Database\Connection
*/
public function make(array $config, $name = null)
{
$config = $this->parseConfig($config, $name);
$pdo = $this->createConnector($config)->connect($config);
return $this->createConnection($config['driver'], $pdo, $config['database'], $config['prefix'], $config);
// and will call the Closure if so, which allows us to have a more generic
// resolver for the drivers themselves which applies to all connections.
if (isset($this->extensions[$driver]))
{
return call_user_func($this->extensions[$driver], $config);
}
return $this->factory->make($config, $name);
}
$name = $name ?: $this->getDefaultConnection();
// If we haven't created this connection, we'll create it based on the config
// provided in the application. Once we've created the connections we will
// set the "fetch mode" for PDO which determines the query return types.
if ( ! isset($this->connections[$name]))
{
$connection = $this->makeConnection($name);
$this->connections[$name] = $this->prepare($connection);
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return call_user_func_array(array($this->connection(), $method), $parameters);
}
switch (count($args))
{
case 0:
return $instance->$method();
case 1:
return $instance->$method($args[0]);
case 2:
switch (count($args))
{
case 0:
return $instance->$method();
case 1:
return $instance->$method($args[0]);
case 2:
->with('frases_home', $frases_home)
->with('todas_marcas', $todas_marcas)
->with('page_info', $page_info);
});
Route::get('/contactos',function()
{
$page_info = DB::table('pages')->where('nome_page','=','Contactos')->first();
$conteudo_contactos = DB::table('contactos')->first();
->with('frases_home', $frases_home)
->with('todas_marcas', $todas_marcas)
->with('page_info', $page_info);
});
Route::get('/contactos',function()
{
$page_info = DB::table('pages')->where('nome_page','=','Contactos')->first();
$conteudo_contactos = DB::table('contactos')->first();
*
* @return mixed
*/
protected function callCallable()
{
$variables = array_values($this->getParametersWithoutDefaults());
return call_user_func_array($this->getOption('_call'), $variables);
}
// We will only call the router callable if no "before" middlewares returned
// a response. If they do, we will consider that the response to requests
// so that the request "lifecycle" will be easily halted for filtering.
$response = $this->callBeforeFilters($request);
if ( ! isset($response))
{
$response = $this->callCallable();
}
// Once we have the route, we can just run it to get the responses, which will
// always be instances of the Response class. Once we have the responses we
// will execute the global "after" middlewares to finish off the request.
else
{
$this->currentRoute = $route = $this->findRoute($request);
$response = $route->run($request);
}
if ($this->isDownForMaintenance())
{
$response = $this['events']->until('illuminate.app.down');
if ( ! is_null($response)) return $this->prepareResponse($response, $request);
}
return $this['router']->dispatch($this->prepareRequest($request));
}
/**
* Handles the given request and delivers the response.
*
* @return void
*/
public function run()
{
$response = $this->dispatch($this['request']);
$this['router']->callCloseFilter($this['request'], $response);
| Once we have the application, we can simply call the run method,
| which will execute the request and send the response back to
| the client's browser allowing them to enjoy the creative
| and wonderful applications we have created for them.
|
*/
$app->run();
/*