[ 'type' => 'bigint', ], 'campaign_id' => [ 'type' => 'bigint', 'required' => true, ], 'ad_id' => [ 'type' => 'bigint', 'required' => true, ], 'display_order' => [ 'type' => 'int', 'default' => 0, ], 'created_at' => [ 'type' => 'datetime', 'nullable' => true, ], 'updated_at' => [ 'type' => 'datetime', 'nullable' => true, ], ]; } public static function table() { return static::TABLE; } /** * Count how many campaign_ads rows exist for a given ad. * Used before delete to warn the user. */ public static function countByAd( int $adId ): int { return DB::get( static::TABLE ) ->where( 'ad_id', $adId ) ->count(); } /** * Delete all campaign_ads rows for a given ad. * Called after the user confirms deletion. */ public static function deleteByAd( int $adId ): int|false { return DB::get( static::TABLE ) ->where( 'ad_id', $adId ) ->delete(); } }