/** * Return log type id that match the given key * * @param string $key * @return int */ public function getLogTypeId($key) { $logType = new LogType(); $log = $logType->where('key', $key)->first(); return $log->id; }