Improve Jqhtml_Integration.js documentation with hydration system explanation Add jqhtml-laravel integration packages for traditional Laravel projects 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
635 B
635 B
whenNotEmpty()
The whenNotEmpty method will execute the given callback when the collection is not empty:
const collection = collect(['Darwin Núñez']);
collection.whenNotEmpty(c => c.push('Mohamed Salah'));
collection.all();
// [
// 'Darwin Núñez',
// 'Mohamed Salah',
// ]
const collection = collect(['Darwin Núñez']);
collection.whenNotEmpty(
c => c.push('Mohamed Salah'),
c => c.push('Xherdan Shaqiri'),
);
collection.all();
// [
// 'Darwin Núñez',
// 'Mohamed Salah',
// ];