⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
hospital.dev-unit.com
/
app
/
Models
/
View File Name :
Medicine.php
<?php namespace App\Models; use App\Traits\PopulateTenantID; use Eloquent as Model; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Support\Carbon; use Stancl\Tenancy\Database\Concerns\BelongsToTenant; /** * App\Models\Medicine * * @property int $id * @property int|null $category_id * @property int|null $brand_id * @property string $name * @property float $selling_price * @property float $buying_price * @property string $effect * @property Carbon $mfg_date * @property Carbon|null $created_at * @property Carbon|null $updated_at * * @method static Builder|Medicine newModelQuery() * @method static Builder|Medicine newQuery() * @method static Builder|Medicine query() * @method static Builder|Medicine whereBrandId($value) * @method static Builder|Medicine whereBuyingPrice($value) * @method static Builder|Medicine whereCategoryId($value) * @method static Builder|Medicine whereCreatedAt($value) * @method static Builder|Medicine whereId($value) * @method static Builder|Medicine whereName($value) * @method static Builder|Medicine whereSellingPrice($value) * @method static Builder|Medicine whereUpdatedAt($value) * * @mixin Model * * @property-read Brand|null $brand * @property-read Category|null $category * @property string $salt_composition * @property string|null $side_effects * @property string|null $description * * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Medicine whereDescription($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Medicine whereSaltComposition($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Medicine whereSideEffects($value) * * @property int $is_default * * @method static Builder|Medicine whereIsDefault($value) */ class Medicine extends Model { use BelongsToTenant, PopulateTenantID; public $table = 'medicines'; public $fillable = [ 'id', 'category_id', 'brand_id', 'name', 'selling_price', 'buying_price', 'side_effects', 'description', 'salt_composition', 'quantity', 'available_quantity', ]; /** * Validation rules * * @var array */ public static $rules = [ 'category_id' => 'required', 'brand_id' => 'required', 'name' => 'required|min:2|is_unique:medicines,name', 'selling_price' => 'required', 'buying_price' => 'required', 'side_effects' => 'nullable', 'quantity' => 'integer', 'available_quantity' => 'integer|lte:quantity', ]; /** * Get the attributes that should be cast. * * @return array<string, string> */ protected function casts(): array { return [ 'id' => 'integer', 'category_id' => 'integer', 'brand_id' => 'integer', 'name' => 'string', 'selling_price' => 'double', 'buying_price' => 'double', 'side_effects' => 'string', 'quantity' => 'integer', 'available_quantity' => 'integer', ]; } public function category(): BelongsTo { return $this->belongsTo(Category::class); } public function brand(): BelongsTo { return $this->belongsTo(Brand::class); } public function prescriptionMedicines(): BelongsTo { return $this->belongsTo(PrescriptionMedicineModal::class, 'medicine'); } public function usedMedicines(): BelongsTo { return $this->belongsTo(UsedMedicine::class); } public function purchasedMedicine(): BelongsTo { return $this->belongsTo(PurchasedMedicine::class); } }