| 1 |
<?php |
| 2 |
|
| 3 |
namespace IAWPSCOPED\Illuminate\Database\Concerns; |
| 4 |
|
| 5 |
use IAWPSCOPED\Illuminate\Support\Collection; |
| 6 |
/** @internal */ |
| 7 |
trait ExplainsQueries |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Explains the query. |
| 11 |
* |
| 12 |
* @return \Illuminate\Support\Collection |
| 13 |
*/ |
| 14 |
public function explain() |
| 15 |
{ |
| 16 |
$sql = $this->toSql(); |
| 17 |
$bindings = $this->getBindings(); |
| 18 |
$explanation = $this->getConnection()->select('EXPLAIN ' . $sql, $bindings); |
| 19 |
return new Collection($explanation); |
| 20 |
} |
| 21 |
} |
| 22 |
|