laravel eloquent count code example

Example 1: laravel updateOrCreate

// If there's a flight from Oakland to San Diego, set the price to $99.
// If no matching model exists, create one.
$flight = App\Flight::updateOrCreate(
    ['departure' => 'Oakland', 'destination' => 'San Diego'],
    ['price' => 99, 'discounted' => 1]
);

Example 2: get count laravel

$count = Model::where('status','=','1')->count();

Example 3: laravel create model and migration

# If you would like to generate a database migration when you 
# generate the model, you may use the --migration or -m option:

php artisan make:model Flight --migration
php artisan make:model Flight -m

Example 4: count in laravel'

$count = ModelName::where('id',$id)->count();

Example 5: {{count laravel

{{ $threads->count() }}

Example 6: update query in laravel eloquent

$data = DB::table('cart')
                ->where('crt_id', $id)
               ->update(['crt_status' =>'0']);

Tags:

Css Example