You may pass multiple arguments to the groupBy method to group by multiple columns:1$users = DB::table('users') 2 ->groupBy('first_name', 'status') 3 ->having('account_id', '>', 100) 4 ->get();For more advanced
The chunkWhile method breaks the collection into multiple, smaller collections based on the evaluation of the given callback. The $chunk variable passed to the closure may be used to inspect the previous element:$collection = collect(str_split('AABBCCCD')); $chunks = $collection->chunkWhile(...
However, if you know the primary key of the model, you may delete the model without explicitly retrieving it by calling the destroy method. In addition to accepting the single primary key, the destroy method will accept multiple primary keys, an array of primary keys, or a collection of ...
The cards method on the billable model instance returns a collection of Laravel\Cashier\Card instances:$cards = $user->cards(); To retrieve the default card, the defaultCard method may be used;$card = $user->defaultCard(); Determining If A Card Is On FileYou may check if a ...
Of course, in addition to retrieving all of the records for a given table, you may also retrieve single records using find or first. Instead of returning a collection of models, these methods return a single model instance: 通过find或first方法来检索单条记录 ...
You can also perform raw expressions on the internal MongoCollection object. If this is executed on the model class, it will return a collection of models. If this is executed on the query builder, it will return the original response. ...
useIlluminate\Support\Facades\Notification;// Recipients can be an array of chat IDs or collection of notifiable entities.Notification::send($recipients,newInvoicePaid()); Available Methods For more information on supported parameters, check out thesedocs. ...
If different models use different columns for ownership, you can register them separately:Bouncer::ownedVia(Post::class, 'created_by'); Bouncer::ownedVia(Order::class, 'entered_by');For greater control, you can pass a closure with your custom logic:...
Added ability for BooleanGroup field to use a Collection or Closure to return options Added ability to add custom header components for all Nova's views. Added abiltity for Nova custom scripts and styles to be cached by the browser. Added new Sparkline field for showing small line graphs on...
Illuminate\Contracts\Queue\QueueableCollection Illuminate\Contracts\Queue\QueueableEntity Illuminate\Contracts\Queue\ShouldQueue Illuminate\Contracts\Redis\Factory Redis Illuminate\Contracts\Routing\BindingRegistrar Route Illuminate\Contracts\Routing\Registrar Route Illuminate\Contracts\Routing\ResponseFact...