Files
snipe-it/app/models/Company.php
T
Abdullah Alansari 23d10a8f7f Make company field optional
Company field is now optional for the user,
although still required in the controllers.
2015-11-13 09:19:18 +03:00

26 lines
709 B
PHP

<?php
use Lang;
final class Company extends Elegant
{
protected $table = 'companies';
// Declare the rules for the form validation
protected $rules = ['name' => 'required|alpha_space|min:2|max:255|unique:companies,name,{id}'];
public static function getSelectList()
{
$select_company = Lang::get('admin/companies/general.select_company');
return ['0' => $select_company] + DB::table('companies')->orderBy('name', 'ASC')->lists('name', 'id');
}
public static function getIdFromInput($input)
{
$escapedInput = e($input);
if ($escapedInput == '0') { return NULL; }
else { return $escapedInput; }
}
}