NASER fix some issues

This commit is contained in:
gholak tala
2026-02-16 09:29:37 +00:00
parent 6c30722d7d
commit ba8e2950e4
230 changed files with 354 additions and 7 deletions
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class File extends Model
{
use HasFactory;
use Selector;
protected $fillable = [
'original_name',
'title',
'ext',
'src',
'size',
'user_id',
'type',
'has_thumb',
'url',
];
protected $casts = [
"has_thumb"=>"boolean"
];
public function getSrcAttribute(){
return 'https://bazarsaat.com/kernel/'.$this->attributes['src'];
// return url($this->attributes['src']);
}
}
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class OfferCode extends Model
{
use HasFactory,Selector,SoftDeletes;
protected $table='offer_codes';
protected $fillable=[
'code',
'title',
'description',
'start_at',
'end_at',
'type',
'discount_percent',
'discount_price',
'is_active',
'use_only',
'use_count'
];
static $TYPES = [
1=>"محصول",
2=>"دسته بندی",
3=>"مشتری",
4=>"برند",
5=>""
];
static $TYPE_CUSTOMER = [
1=>"تکی",
2=>"عمده",
];
protected $casts=[
'is_active' => 'boolean',
];
// public static function safeDelete($promotionID){
// Promotion::findOrFail($promotionID)->delete();
// PromotionItem::where('promotion_id',$promotionID)->delete();
// PromotionProduct::where('promotion_id',$promotionID)->delete();
// return true;
// }
}
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+1 -1
View File
@@ -70,7 +70,7 @@ class Product extends Model
return $this->hasOne(Wallet::class)->where('owner',auth()->user()->id);
}
public function file(){
return $this->belongsTo(File::class);
return $this->belongsTo(File::class, 'original_image_id');
}
public function price(){
return $this->hasOne(Price::class)->orderBy('id','desc');
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File