38 lines
806 B
PHP
38 lines
806 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class PlanV1 extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'plans_v1';
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'currency',
|
|
'price',
|
|
'list_one_title',
|
|
'list_two_title',
|
|
'list_sub_title',
|
|
'image_url',
|
|
'slug',
|
|
'domain',
|
|
'medication_category_id',
|
|
'product_file_path',
|
|
'is_prescription_required',
|
|
'shipping_cost'
|
|
];
|
|
|
|
public static function generateUniqueSlug($title)
|
|
{
|
|
$slug = Str::slug($title);
|
|
$count = self::where('slug', 'like', "$slug%")->count();
|
|
return $count ? "{$slug}-{$count}" : $slug;
|
|
}
|
|
}
|