Dinesh Uprety
@dineshuprety ·
Public
Read the affected row count
PHPOriginal CodeSnap example inspired by Laravel News. Source: https://laravel-news.com/eloquent-tips-tricks
PHP
CodeSnap // free canvas
Read the affected row count
<?php
$updated = Product::query()
->whereNull('category_id')
->update(['category_id' => $fallbackCategoryId]);
logger()->info("Updated {$updated} products");
// Further reading: https://laravel-news.com/eloquent-tips-tricks