Current File : /home/tradevaly/demo.tradevaly.com.bd/app/Models/PackageLead.php |
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class PackageLead extends Model
{
use HasFactory;
use SoftDeletes;
protected $fillable = [
'created_user_id', 'modified_user_id', 'deleted_user_id', 'name', 'type', 'status', 'updated_at'
];
public function packageDetails()
{
return $this->hasMany('App\Models\PackageLeadDetail');
}
protected function getPackage($conditions = [])
{
$data = PackageLead::where('status', 1)->where($conditions)->pluck('name', 'id')->toArray();
return $data;
}
protected function getPackageWithDetails($conditions = [])
{
// dd($conditions);
$data = PackageLead::where($conditions)
->with (['packageDetails' => function($mm){
return $mm->select('id', 'package_lead_id', 'duration_id', 'price', 'description', 'status');
}])->get()->toArray();
return $data;
}
}