<?php

namespace App\Observers;

use App\Models\Bucket;

class BucketObserver
{
    public function created(Bucket $bucket): void
    {
        $board = $bucket->board;

        $bucket->order = $board->buckets->count() - 1;
        $bucket->save();
    }
}
