Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
namespace App\Http\Resources\App;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Number;
use Laravel\Cashier\Cashier;
use Laravel\Cashier\Discount;
/**
* The coupon on the subscription, so the billing page can say why the
* invoice is lower than the plan price.
*
* @mixin Discount
*/
class SubscriptionDiscountResource extends JsonResource
{
/**
* @return array{value: string, duration: string, ends_at: string|null}
*/
public function toArray(Request $request): array
{
$coupon = $this->coupon();
return [
'value' => $coupon->isPercentage()
? Number::percentage($coupon->percentOff(), maxPrecision: 2, locale: App::currentLocale())
: Cashier::formatAmount($coupon->rawAmountOff(), $coupon->asStripeCoupon()->currency, App::currentLocale()),
'duration' => $coupon->duration(),
'ends_at' => $this->end()?->toIso8601String(),
];
}
}