1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Casts;
7
8use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
9
10class PresentString implements CastsAttributes
11{
12 public function get($model, string $key, $value, array $attributes)
13 {
14 return presence($value);
15 }
16
17 // presence check is only done when retrieving the value
18 public function set($model, string $key, $value, array $attributes)
19 {
20 return get_string($value);
21 }
22}