initial commit
This commit is contained in:
37
app/Models/PlanV1.php
Normal file
37
app/Models/PlanV1.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user