2019-06-17 09:22:10 +02:00
|
|
|
<?php
|
|
|
|
|
|
2019-09-12 11:08:25 +02:00
|
|
|
namespace App\Models;
|
2019-06-17 09:22:10 +02:00
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class Langue extends Model
|
|
|
|
|
{
|
2022-04-19 16:07:27 +02:00
|
|
|
/**
|
|
|
|
|
* The primary key associated with the table.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $primaryKey = 'langue_id';
|
2022-06-20 14:57:58 +02:00
|
|
|
|
|
|
|
|
// * METHODS
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get default language instance
|
|
|
|
|
*
|
|
|
|
|
* @return self
|
|
|
|
|
* @throws \RuntimeException If fetching default language fails.
|
|
|
|
|
*/
|
|
|
|
|
public static function getDefaultLang(): self
|
|
|
|
|
{
|
|
|
|
|
return self::whereLangueId(1)->first() ??
|
|
|
|
|
throw new \RuntimeException('Failed to fetch default language');
|
|
|
|
|
}
|
2019-06-17 09:22:10 +02:00
|
|
|
}
|