| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
-
- namespace App\Models;
-
- use Carbon\CarbonInterface;
- use Illuminate\Database\Eloquent\Attributes\Fillable;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
-
- /**
- * A store's connected EasyParcel account. Parcels booked from the store are paid from its credit.
- *
- * @property int $id
- * @property int $store_id
- * @property string|null $account_name
- * @property string $access_token
- * @property string|null $refresh_token
- * @property CarbonInterface|null $expires_at
- * @property-read Store $store
- */
- #[Fillable(['account_name', 'access_token', 'refresh_token', 'expires_at'])]
- class EasyParcelAccount extends Model
- {
- protected $table = 'easyparcel_accounts';
-
- protected $hidden = ['access_token', 'refresh_token'];
-
- /**
- * @return BelongsTo<Store, $this>
- */
- public function store(): BelongsTo
- {
- return $this->belongsTo(Store::class);
- }
-
- /**
- * @return array<string, string>
- */
- protected function casts(): array
- {
- return [
- 'access_token' => 'encrypted',
- 'refresh_token' => 'encrypted',
- 'expires_at' => 'datetime',
- ];
- }
- }
|