Ejemplo n.º 1
0
 /**
  * Execute the job.
  *
  * @param \Imagine\Image\ImagineInterface $imagine
  *
  * @return void
  */
 public function handle(ImagineInterface $imagine)
 {
     $data = $this->getFilteredOptions($this->options);
     $path = $data['path'];
     $source = Str::replace('{filename}.{extension}', $data);
     $destination = Str::replace($data['format'], $data);
     $this->handleImageManipulation($imagine->open("{$path}/{$source}"), $data)->save("{$path}/{$destination}");
 }
Ejemplo n.º 2
0
 /**
  * Write the migration file to disk.
  *
  * @param  string  $driver
  * @param  string  $name
  * @param  string  $table
  * @param  bool    $create
  *
  * @return string
  */
 protected function writeMigration($driver, $name, $table, $create)
 {
     $migrator = $this->tenant->driver($driver);
     $files = $this->creator->getFilesystem();
     $path = $migrator->getMigrationPath();
     if (!$files->isDirectory($path)) {
         $files->makeDirectory($path, 0755, true);
     }
     $name = implode('_', [$driver, 'tenant', $name]);
     $table = Str::replace($migrator->getTablePrefix() . "_{$table}", ['id' => '{$id}']);
     $file = pathinfo($this->creator->create($name, $path, $table, $create), PATHINFO_FILENAME);
     $this->line("<info>Created Migration:</info> {$file}");
 }
Ejemplo n.º 3
0
 /**
  * Resolve table name.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $entity
  * @param  string|null  $name
  *
  * @return string|null
  */
 protected function bindWithKey(Model $entity, $name)
 {
     if (is_null($name) || strpos($name, '{') === false && strpos($name, '}') === false) {
         return $name;
     }
     $id = $entity->getKey();
     if (!isset($this->data[$id])) {
         $data = array_merge(Arr::dot(['entity' => $entity->toArray()]), compact('id'));
         $this->data[$id] = $data;
     }
     return Str::replace($name, $this->data[$id]);
 }
Ejemplo n.º 4
0
 /**
  * Resolve table name.
  *
  * @param  \Illuminate\Database\Eloquent\Model  $entity
  * @param  string|null  $name
  *
  * @return string|null
  */
 protected function bindWithKey(Model $entity, $name)
 {
     if (is_null($name)) {
         return $name;
     }
     $id = $entity->getKey();
     if (!isset($this->data[$id])) {
         $data = Arr::dot(['entity' => $entity->toArray()]);
         $data['id'] = $id;
         $this->data[$id] = $data;
     }
     return Str::replace($name, $this->data[$id]);
 }
Ejemplo n.º 5
0
 /**
  * Get HTML::title() format for page.
  *
  * @param  array  $data
  *
  * @return mixed
  */
 protected function getHtmlTitleFormatForPage(array $data)
 {
     if (empty($data['page']['title'])) {
         return $data['site']['name'];
     }
     $format = get_meta('html::title.format.page', '{page.title} &mdash; {site.name}');
     return Str::replace($format, $data);
 }
Ejemplo n.º 6
0
 /**
  * Run rules bindings.
  *
  * @return array
  */
 protected function getBindedRules()
 {
     $rules = $this->getValidationRules();
     if (!empty($this->validationBindings)) {
         foreach ($rules as $key => $value) {
             $rules[$key] = Str::replace($value, $this->validationBindings);
         }
     }
     return $rules;
 }
Ejemplo n.º 7
0
 /**
  * Parse HTML/Content from string.
  *
  * @param  string  $content
  * @param  string  $version
  *
  * @return string
  */
 public function parseContent($content, $version)
 {
     $replacement = ['doc-url' => handles('app::docs') . "/{$version}"];
     return Str::replace($content, $replacement);
 }