/**
  * Register validator extensions.
  *
  * @return void
  */
 protected function registerValidatorExtensions()
 {
     $this->app->validator->extend('license', function ($attribute, $value, $parameters) {
         $tempFile = temp_file();
         file_put_contents($tempFile, $value);
         return $this->app['ahead4.licensing']->verifyLicense($tempFile, __DIR__ . '/../resources/public.key');
     }, trans('ahead4.licensing::messages.invalid_license_entered'));
 }
Beispiel #2
0
function puede_escribirse($archivo, $tipo = 1)
{
    if ($tipo == 1) {
        if (is_dir($archivo)) {
            $archivo .= "/temp";
            return temp_file($archivo);
        } else {
            if (is_file($archivo)) {
                return temp_file($archivo);
            } else {
                return false;
            }
        }
    }
    if ($tipo == 2) {
        return is_writable($archivo);
    }
}