ldc-dam/app/Models/Langue.php

30 lines
592 B
PHP
Raw Normal View History

2019-06-17 09:22:10 +02:00
<?php
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';
// * 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
}