phparrayslaravellaravel-5pluck

Laravel 5.4 skip first value in Pluck array


I have this query

$orderStates = OrderState::listsTranslations( 'states' )->pluck( 'states', 'id' )->toArray();

which will output something like

array:3 [▼
  1 => "waiting"
  2 => "agreed"
  3 => "canceled"
]

I need to skip the first one to be something like

array:3 [▼
      2 => "agreed"
      3 => "canceled"
    ]

How this can be done please?


Solution

  • First thanks for Namoshek guide but skip(1) didn't work with this but slice(1) did

    Here is the last query

    $orderStates = OrderState::listsTranslations( 'states' )
                                     ->pluck( 'states', 'id' )
                                     ->slice( 1 )
                                     ->toArray();
    

    Worked fine.