public static function findOrMakeTemplate($code) { if (!($template = self::whereCode($code)->first())) { $template = new self(); $template->code = $code; $template->fillFromView(); } return $template; }