Display what subscriptions (if any) a subscriber has
This commit is contained in:
committed by
Graham Campbell
parent
c9f08a3e6e
commit
0b78332a20
@@ -48,6 +48,13 @@ class Subscriber extends Model implements HasPresenter
|
||||
'email' => 'required|email',
|
||||
];
|
||||
|
||||
/**
|
||||
* The relations to eager load on every query.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $with = ['subscriptions'];
|
||||
|
||||
/**
|
||||
* Overrides the models boot method.
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Presenters;
|
||||
use CachetHQ\Cachet\Dates\DateFactory;
|
||||
use CachetHQ\Cachet\Presenters\Traits\TimestampsTrait;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use McCool\LaravelAutoPresenter\BasePresenter;
|
||||
|
||||
class SubscriberPresenter extends BasePresenter implements Arrayable
|
||||
@@ -30,6 +31,16 @@ class SubscriberPresenter extends BasePresenter implements Arrayable
|
||||
return app(DateFactory::class)->make($this->wrappedObject->verified_at)->toDateTimeString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Present formatted subscribed date.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function subscribed_at()
|
||||
{
|
||||
return ucfirst(app(DateFactory::class)->make($this->wrappedObject->subscribed_at)->format(Config::get('setting.incident_date_format', 'l jS F Y H:i:s')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the presenter instance to an array.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user