Basic search
This commit is contained in:
@@ -7,30 +7,38 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CountryCode extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'c_ikea_country_code';
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'c_ikea_country_code';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'currency_code';
|
||||
/**
|
||||
* Indicates if the model's ID is auto-incrementing.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $incrementing = false;
|
||||
|
||||
use HasFactory;
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'currency_code';
|
||||
/**
|
||||
* Indicates if the model's ID is auto-incrementing.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $incrementing = false;
|
||||
|
||||
protected function active(String $status)
|
||||
{
|
||||
return $this->where('status', $status)->get();
|
||||
}
|
||||
use HasFactory;
|
||||
|
||||
protected function active(String $status)
|
||||
{
|
||||
return $this->where('status', $status)->get();
|
||||
}
|
||||
|
||||
protected function countryHash()
|
||||
{
|
||||
$codes = $this->select('country_name', 'country_code')->get();
|
||||
return $codes->mapWithKeys(function ($item) {
|
||||
return [$item['country_name'] => $item['country_code']];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user