// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (Exception $e) {
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}
return $result;
// Here we will run this query. If an exception occurs we'll determine if it was
// caused by a connection that has been lost. If that is the cause, we'll try
// to re-establish connection and re-run the query with a fresh connection.
try {
$result = $this->runQueryCallback($query, $bindings, $callback);
} catch (QueryException $e) {
$result = $this->handleQueryException(
$e, $query, $bindings, $callback
);
}
$this->bindValues($statement, $this->prepareBindings($bindings));
$statement->execute();
return $statement->fetchAll();
});
}
/**
* Run a select statement against the database and returns a generator.
*
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->connection()->$method(...$parameters);
}
}
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
}
public function courseInformation($id)
{
return DB::select('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme
INNER join training_type on training_type.type_id = training_theme.type_id
INNER join training_form on training_type.form_id = training_form.form_id
where theme_id = ?', [$id]
);
}
}
{
private $course = null;
public function index($id, $type = '')
{
$info = $this->courseInformation($id);
if (collect($info)->isNotEmpty()) {
$info = $info[0];
return view('ur', compact(['info']));
}
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
* @param mixed $value
* @return mixed
*/
public static function unwrapIfClosure($value)
{
return $value instanceof Closure ? $value() : $value;
}
/**
* Get the class name of the given parameter's type, if possible.
*
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return Util::unwrapIfClosure($default);
}
/**
* Normalize the given callback into a Class@method string.
*
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
*
* @throws \InvalidArgumentException
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
/**
* Get a closure to resolve the given type from the container.
*
*/
protected function callControllerCallable(callable $callable, array $parameters = [])
{
try {
return $this->prepareResponse(
$this->call($callable, $parameters)
);
} catch (HttpResponseException $e) {
return $e->getResponse();
}
}
if ($instance instanceof LumenController) {
return $this->callLumenController($instance, $method, $routeInfo);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
}
/**
protected function callActionOnArrayBasedRoute($routeInfo)
{
$action = $routeInfo[1];
if (isset($action['uses'])) {
return $this->prepareResponse($this->callControllerAction($routeInfo));
}
foreach ($action as $value) {
if ($value instanceof Closure) {
$callable = $value->bindTo(new RoutingClosure);
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
}
/**
* Call the Closure or invokable on the array based route.
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException;
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
/**
* Handle a route found by the dispatcher.
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
/**
* Prepare the response for sending.
*
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
}
* @param SymfonyRequest|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
// For select statements, we'll simply execute the query and return an array
// of the database result set. Each element in the array will be a single
// row from the database table, and will either be an array or objects.
$statement = $this->prepared(
$this->getPdoForSelect($useReadPdo)->prepare($query)
);
$this->bindValues($statement, $this->prepareBindings($bindings));
$statement->execute();
// For select statements, we'll simply execute the query and return an array
// of the database result set. Each element in the array will be a single
// row from the database table, and will either be an array or objects.
$statement = $this->prepared(
$this->getPdoForSelect($useReadPdo)->prepare($query)
);
$this->bindValues($statement, $this->prepareBindings($bindings));
$statement->execute();
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try {
$result = $callback($query, $bindings);
}
// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
// Here we will run this query. If an exception occurs we'll determine if it was
// caused by a connection that has been lost. If that is the cause, we'll try
// to re-establish connection and re-run the query with a fresh connection.
try {
$result = $this->runQueryCallback($query, $bindings, $callback);
} catch (QueryException $e) {
$result = $this->handleQueryException(
$e, $query, $bindings, $callback
);
}
$this->bindValues($statement, $this->prepareBindings($bindings));
$statement->execute();
return $statement->fetchAll();
});
}
/**
* Run a select statement against the database and returns a generator.
*
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->connection()->$method(...$parameters);
}
}
if (! $instance) {
throw new RuntimeException('A facade root has not been set.');
}
return $instance->$method(...$args);
}
}
public function courseInformation($id)
{
return DB::select('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme
INNER join training_type on training_type.type_id = training_theme.type_id
INNER join training_form on training_type.form_id = training_form.form_id
where theme_id = ?', [$id]
);
}
}
{
private $course = null;
public function index($id, $type = '')
{
$info = $this->courseInformation($id);
if (collect($info)->isNotEmpty()) {
$info = $info[0];
return view('ur', compact(['info']));
}
if (static::isCallableWithAtSign($callback) || $defaultMethod) {
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
* @param mixed $value
* @return mixed
*/
public static function unwrapIfClosure($value)
{
return $value instanceof Closure ? $value() : $value;
}
/**
* Get the class name of the given parameter's type, if possible.
*
if ($container->hasMethodBinding($method)) {
return $container->callMethodBinding($method, $callback[0]);
}
return Util::unwrapIfClosure($default);
}
/**
* Normalize the given callback into a Class@method string.
*
return static::callClass($container, $callback, $parameters, $defaultMethod);
}
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return $callback(...array_values(static::getMethodDependencies($container, $callback, $parameters)));
});
}
/**
* Call a string reference to a class using Class@method syntax.
*
*
* @throws \InvalidArgumentException
*/
public function call($callback, array $parameters = [], $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
/**
* Get a closure to resolve the given type from the container.
*
*/
protected function callControllerCallable(callable $callable, array $parameters = [])
{
try {
return $this->prepareResponse(
$this->call($callable, $parameters)
);
} catch (HttpResponseException $e) {
return $e->getResponse();
}
}
if ($instance instanceof LumenController) {
return $this->callLumenController($instance, $method, $routeInfo);
} else {
return $this->callControllerCallable(
[$instance, $method], $routeInfo[2]
);
}
}
/**
protected function callActionOnArrayBasedRoute($routeInfo)
{
$action = $routeInfo[1];
if (isset($action['uses'])) {
return $this->prepareResponse($this->callControllerAction($routeInfo));
}
foreach ($action as $value) {
if ($value instanceof Closure) {
$callable = $value->bindTo(new RoutingClosure);
return $this->callActionOnArrayBasedRoute($this['request']->route());
}));
}
return $this->prepareResponse(
$this->callActionOnArrayBasedRoute($routeInfo)
);
}
/**
* Call the Closure or invokable on the array based route.
case Dispatcher::NOT_FOUND:
throw new NotFoundHttpException;
case Dispatcher::METHOD_NOT_ALLOWED:
throw new MethodNotAllowedHttpException($routeInfo[1]);
case Dispatcher::FOUND:
return $this->handleFoundRoute($routeInfo);
}
}
/**
* Handle a route found by the dispatcher.
if (isset($this->router->getRoutes()[$method.$pathInfo])) {
return $this->handleFoundRoute([true, $this->router->getRoutes()[$method.$pathInfo]['action'], []]);
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
->send($this->make('request'))
->through($middleware)
->then($then);
}
return $then($this->make('request'));
}
/**
* Prepare the response for sending.
*
}
return $this->handleDispatcherResponse(
$this->createDispatcher()->dispatch($method, $pathInfo)
);
});
} catch (Throwable $e) {
return $this->prepareResponse($this->sendExceptionToHandler($e));
}
}
* @param SymfonyRequest|null $request
* @return void
*/
public function run($request = null)
{
$response = $this->dispatch($request);
if ($response instanceof SymfonyResponse) {
$response->send();
} else {
echo (string) $response;
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$app->run();
[2/2]
QueryException
|
---|
Illuminate\Database\QueryException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'short.training_theme' doesn't exist (SQL: SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = 432) at C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:692 at Illuminate\Database\Connection->runQueryCallback('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'), object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:652) at Illuminate\Database\Connection->run('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'), object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:360) at Illuminate\Database\Connection->select('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432')) (C:\xampp\fcgie.training\vendor\illuminate\database\DatabaseManager.php:388) at Illuminate\Database\DatabaseManager->__call('select', array('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'))) (C:\xampp\fcgie.training\vendor\illuminate\support\Facades\Facade.php:261) at Illuminate\Support\Facades\Facade::__callStatic('select', array('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'))) (C:\xampp\fcgie.training\app\Http\Controllers\FillingDataController.php:612) at App\Http\Controllers\FillingDataController->courseInformation('432') (C:\xampp\fcgie.training\app\Http\Controllers\FillingDataController.php:15) at App\Http\Controllers\FillingDataController->index('432', '') (C:\xampp\fcgie.training\vendor\illuminate\container\BoundMethod.php:36) at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() (C:\xampp\fcgie.training\vendor\illuminate\container\Util.php:40) at Illuminate\Container\Util::unwrapIfClosure(object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\container\BoundMethod.php:93) at Illuminate\Container\BoundMethod::callBoundMethod(object(Application), array(object(FillingDataController), 'index'), object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\container\BoundMethod.php:37) at Illuminate\Container\BoundMethod::call(object(Application), array(object(FillingDataController), 'index'), array('id' => '432'), null) (C:\xampp\fcgie.training\vendor\illuminate\container\Container.php:651) at Illuminate\Container\Container->call(array(object(FillingDataController), 'index'), array('id' => '432')) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:386) at Laravel\Lumen\Application->callControllerCallable(array(object(FillingDataController), 'index'), array('id' => '432')) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:329) at Laravel\Lumen\Application->callControllerAction(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:279) at Laravel\Lumen\Application->callActionOnArrayBasedRoute(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:264) at Laravel\Lumen\Application->handleFoundRoute(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:234) at Laravel\Lumen\Application->handleDispatcherResponse(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:170) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(object(Request)) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:426) at Laravel\Lumen\Application->sendThroughPipeline(array(), object(Closure)) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:172) at Laravel\Lumen\Application->dispatch(null) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:109) at Laravel\Lumen\Application->run() (C:\xampp\fcgie.training\public\index.php:28) |
[1/2]
PDOException
|
---|
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'short.training_theme' doesn't exist at C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:352 at PDO->prepare('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?') (C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:352) at Illuminate\Database\Connection->Illuminate\Database\{closure}('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432')) (C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:685) at Illuminate\Database\Connection->runQueryCallback('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'), object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:652) at Illuminate\Database\Connection->run('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'), object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\database\Connection.php:360) at Illuminate\Database\Connection->select('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432')) (C:\xampp\fcgie.training\vendor\illuminate\database\DatabaseManager.php:388) at Illuminate\Database\DatabaseManager->__call('select', array('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'))) (C:\xampp\fcgie.training\vendor\illuminate\support\Facades\Facade.php:261) at Illuminate\Support\Facades\Facade::__callStatic('select', array('SELECT * , training_type.name as type_name , training_form.name as form_name FROM training_theme INNER join training_type on training_type.type_id = training_theme.type_id INNER join training_form on training_type.form_id = training_form.form_id where theme_id = ?', array('432'))) (C:\xampp\fcgie.training\app\Http\Controllers\FillingDataController.php:612) at App\Http\Controllers\FillingDataController->courseInformation('432') (C:\xampp\fcgie.training\app\Http\Controllers\FillingDataController.php:15) at App\Http\Controllers\FillingDataController->index('432', '') (C:\xampp\fcgie.training\vendor\illuminate\container\BoundMethod.php:36) at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() (C:\xampp\fcgie.training\vendor\illuminate\container\Util.php:40) at Illuminate\Container\Util::unwrapIfClosure(object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\container\BoundMethod.php:93) at Illuminate\Container\BoundMethod::callBoundMethod(object(Application), array(object(FillingDataController), 'index'), object(Closure)) (C:\xampp\fcgie.training\vendor\illuminate\container\BoundMethod.php:37) at Illuminate\Container\BoundMethod::call(object(Application), array(object(FillingDataController), 'index'), array('id' => '432'), null) (C:\xampp\fcgie.training\vendor\illuminate\container\Container.php:651) at Illuminate\Container\Container->call(array(object(FillingDataController), 'index'), array('id' => '432')) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:386) at Laravel\Lumen\Application->callControllerCallable(array(object(FillingDataController), 'index'), array('id' => '432')) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:329) at Laravel\Lumen\Application->callControllerAction(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:279) at Laravel\Lumen\Application->callActionOnArrayBasedRoute(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:264) at Laravel\Lumen\Application->handleFoundRoute(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:234) at Laravel\Lumen\Application->handleDispatcherResponse(array(1, array('as' => 'theme', 'uses' => 'App\\Http\\Controllers\\FillingDataController@index'), array('id' => '432'))) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:170) at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(object(Request)) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:426) at Laravel\Lumen\Application->sendThroughPipeline(array(), object(Closure)) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:172) at Laravel\Lumen\Application->dispatch(null) (C:\xampp\fcgie.training\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php:109) at Laravel\Lumen\Application->run() (C:\xampp\fcgie.training\public\index.php:28) |