【发布时间】:2017-09-30 09:22:11
【问题描述】:
我想改组一个数组。但它不会起作用。这是我在 Laravel 中的查询
$spielerArray = Spieler::join('PlanungSpieler', 'PlanungSpieler.Player_ID', '=', 'Spieler.Player_ID')
->select('Spieler.Player_ID')->get();
在下一步中,我只想对 Spieler.Player 列进行洗牌。
$finalShuffleResult = shuffle($spielerArray->Player_ID)
我得到Player_ID Instance does not exist on this collection
这是我收藏的一部分
Illuminate\Database\Eloquent\Collection Object
(
[items:protected] => Array
(
[0] => App\Spieler Object
(
[table:protected] => Spieler
[connection:protected] => mysql
[primaryKey:protected] => id
[keyType:protected] => int
[incrementing] => 1
[with:protected] => Array
(
)
[withCount:protected] => Array
(
)
[perPage:protected] => 15
[exists] => 1
[wasRecentlyCreated] =>
[attributes:protected] => Array
(
[Player_ID] => 101
)
我怎样才能获得 Player_ID 并以洗牌为目标?
【问题讨论】:
-
inRandomOrder可能会更好。
标签: php arrays json laravel shuffle