I have been testing out Laravel, I ran the following query:
$site = Sites::where('url', '=', Request::server('HTTP_HOST'));
The database only contains 1 record and I var_dump $site and I get the output similar to below except is has nearly 900,000 characters returned.
If I keep the query simple, such as:
$site = Sites::all();
the output is:
object(Illuminate\Database\Eloquent\Collection)#121 (1) { ["items":protected]=> array(1) { [0]=> object(App\Sites)#122 (26) { ["connection":protected]=> string(5) "mysql" ["table":protected]=> NULL ["primaryKey":protected]=> string(2) "id" ["keyType":protected]=> string(3) "int" ["incrementing"]=> bool(true) ["with":protected]=> array(0) { } ["withCount":protected]=> array(0) { } ["perPage":protected]=> int(15) ["exists"]=> bool(true) ["wasRecentlyCreated"]=> bool(false) ["attributes":protected]=> array(9) { ["id"]=> int(75) ["name"]=> string(4) "test" ["url"]=> string(7) "test.oo" ["site_type"]=> string(4) "CASH" ["active"]=> int(1) ["site_vat"]=> string(6) "20.000" ["theme"]=> string(4) "test" ["api"]=> string(8) "test.php" ["order_prepend"]=> string(4) "TEST" } ["original":protected]=> array(9) { ["id"]=> int(75) ["name"]=> string(4) "test" ["url"]=> string(7) "test.oo" ["site_type"]=> string(4) "CASH" ["active"]=> int(1) ["site_vat"]=> string(6) "20.000" ["theme"]=> string(4) "test" ["api"]=> string(8) "test.php" ["order_prepend"]=> string(4) "TEST" } ["changes":protected]=> array(0) { } ["casts":protected]=> array(0) { } ["dates":protected]=> array(0) { } ["dateFormat":protected]=> NULL ["appends":protected]=> array(0) { } ["dispatchesEvents":protected]=> array(0) { } ["observables":protected]=> array(0) { } ["relations":protected]=> array(0) { } ["touches":protected]=> array(0) { } ["timestamps"]=> bool(true) ["hidden":protected]=> array(0) { } ["visible":protected]=> array(0) { } ["fillable":protected]=> array(0) { } ["guarded":protected]=> array(1) { [0]=> string(1) "*" } } } }
Which is considerably less (1,600 ish characters), the performance when running the first query is slow, am I doing something wrong as I am concerned about performance (why is the first query so slow).
Thanks