%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/shaban/duassis/api/app/Models/
Upload File :
Create Path :
Current File : //var/www/html/shaban/duassis/api/app/Models/Tag.php

<?php

namespace App\Models;

/**
 * @property integer id
 * @property string name
 *
 */
class Tag extends BaseModel
{
    protected $fillable = [
        'name',
    ];

    protected $casts = [
        'id'   => 'integer',
        'name' => 'string',
    ];

    public static function updateOrCreateByName($tag)
    {
        /** @var Tag $tagModel */
        $tagModel = self::query()
                        ->whereRaw("BINARY `name`= ?", [$tag])
                        ->first();
        if (!$tagModel) {
            $tagModel = Tag::query()
                           ->create([
                               'name' => $tag,
                           ]);
        }
        return $tagModel;
    }

}

Zerion Mini Shell 1.0