0
저는 Laravel의 초보자이며 그것에 대해 첫발을 내딛고 있습니다. 그래서 난이 쿼리를 만든 :이 결과의 값에 액세스하는 방법
public function getPaymentHistory($user_id)
{
return $this->where('created_by', '=', $user_id)->orderBy('created_at', 'desc')->get();
}
을 그리고 이것은 결과입니다
Pyro\Module\Streams\Entry\EntryCollection Object
(
[model:protected] => Pyro\Module\Payment\Model\PaymentModel Object
(
[table:protected] => payment
[timestamps] => 1
[columns:protected] => Array
(
[0] => *
)
[guarded:protected] => Array
(
[0] => id
)
[createdByUserColumns:protected] => Array
(
[0] => id
[1] => username
[2] => email
)
[searchIndexTemplate:protected] =>
[collectionClass:protected] => Pyro\Module\Streams\Entry\EntryCollection
[presenterClass:protected] => Pyro\Module\Streams\Entry\EntryPresenter
[cacheMinutes:protected] =>
[skip_validation] =>
[replicated:protected] =>
[orderByColumn:protected] => id
[connection:protected] =>
[primaryKey:protected] => id
[perPage:protected] => 15
[incrementing] => 1
[attributes:protected] => Array
(
)
[original:protected] => Array
(
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[fillable:protected] => Array
(
)
[dates:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] =>
[softDelete:protected] =>
)
[items:protected] => Array
(
[0] => Pyro\Module\Payment\Model\PaymentModel Object
(
[table:protected] => payment
[timestamps] => 1
[columns:protected] => Array
(
[0] => *
)
[guarded:protected] => Array
(
[0] => id
)
[createdByUserColumns:protected] => Array
(
[0] => id
[1] => username
[2] => email
)
[searchIndexTemplate:protected] =>
[collectionClass:protected] => Pyro\Module\Streams\Entry\EntryCollection
[presenterClass:protected] => Pyro\Module\Streams\Entry\EntryPresenter
[cacheMinutes:protected] =>
[skip_validation] =>
[replicated:protected] =>
[orderByColumn:protected] => id
[connection:protected] =>
[primaryKey:protected] => id
[perPage:protected] => 15
[incrementing] => 1
[attributes:protected] => Array
(
[id] => 2
[created_at] => 2014-06-17 16:03:15
[updated_at] =>
[created_by] => 18
[ordering_count] => 2
[transactionID] => 93P86838PY273320N
[orderTime] => 2014-06-20 02:02:38
[toReload] => 54.680000305176
[amt] => 56
[feeAmt] => 1.9199999570847
[currencyCode] => USD
[paymentStatus] => Completed
[pendingReason] => None
)
[original:protected] => Array
(
[id] => 2
[created_at] => 2014-06-17 16:03:15
[updated_at] =>
[created_by] => 18
[ordering_count] => 2
[transactionID] => 93P86838PY273320N
[orderTime] => 2014-06-20 02:02:38
[toReload] => 54.680000305176
[amt] => 56
[feeAmt] => 1.9199999570847
[currencyCode] => USD
[paymentStatus] => Completed
[pendingReason] => None
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[fillable:protected] => Array
(
)
[dates:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[softDelete:protected] =>
)
)
)
질문, 어떻게 얻거나 아래의 값에 액세스 할 :
[attributes:protected] => Array
(
[id] => 2
[created_at] => 2014-06-17 16:03:15
[updated_at] =>
[created_by] => 18
[ordering_count] => 2
[transactionID] => 93P86838PY273320N
[orderTime] => 2014-06-20 02:02:38
[toReload] => 54.680000305176
[amt] => 56
[feeAmt] => 1.9199999570847
[currencyCode] => USD
[paymentStatus] => Completed
[pendingReason] => None
)
이것은 어떻게 모델명 :
$payment = new PaymentModel();
$payment_history = $payment->getPaymentHistory($user->id);