App\Traits\BaseModelTrait::resolve PHP Метод

resolve() публичный статический Метод

Confirm the proper type of the model, or find the instance of the model based on the id or a column, which defaults to 'name'.
public static resolve ( $id, $column = "name" ) : BaseModel | null
$id
Результат BaseModel | null
    public static function resolve($id, $column = "name")
    {
        $modelObj = null;
        if ($id instanceof self) {
            $modelObj = $id;
        } elseif (is_numeric($id)) {
            $modelObj = self::find($id);
        } else {
            $modelObj = self::where($column, '=', $id)->first();
        }
        return $modelObj;
    }
BaseModelTrait