return response()->download($tmpfile, $filename)->deleteFileAfterSend();
}
- /**
- * @param $sheet Worksheet
- * @param $links array
- * @param $columns array
- * @return void
- */
- protected function _setDataInSheet($sheet, $links, $columns)
+ public static function getCodesMessages()
{
- $codes = [
+ return [
200 => __('Everything is fine'),
301 => __('Permanent redirection: the page has definitively moved, please update the url; the former URL may not be valid indefinitely'),
308 => __('Permanent redirection: the page has definitively moved, please update the url; the former URL may not be valid indefinitely'),
696 => __('There is a problem with the SSL certificate. The auditing tool could not check if the URL is valid or not. Please check manually'),
697 => __('There is a problem with the SSL certificate. The auditing tool could not check if the URL is valid or not. Please check manually'),
];
+ }
+
+ /**
+ * @param $sheet Worksheet
+ * @param $links array
+ * @param $columns array
+ * @return void
+ */
+ protected function _setDataInSheet($sheet, $links, $columns)
+ {
+ $codes = self::getCodesMessages();
$row = 1;
$col = 1;
namespace App\Models;
use App\Models\Base\ToolboxModel;
+use Cubist\Backpack\CubistBackpackServiceProvider;
use Cubist\Backpack\Magic\Fields\Hidden;
use Cubist\Backpack\Magic\Fields\Integer;
use Cubist\Backpack\Magic\Fields\SelectFromArray;
$this->addField('server', SelectFromArray::class, __('Serveur'), ['type' => 'hidden', 'options' => LinkShortener::getAvaiableShorteners()]);
$this->addField('url', URL::class, __('URL'), ['column' => true]);
- $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => 'url', 'database_unique' => true]);
- $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true]);
+ $this->addField('shortlink', URL::class, __('URL courte'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'database_unique' => true]);
+ $this->addField('http_code', Integer::class, __('Code HTTP'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns',]);
$this->addField('code_date', \Cubist\Backpack\Magic\Fields\Datetime::class, __('Code observé le'), ['type' => 'hidden_visible', 'column' => true]);
- $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true]);
- $this->addField('target_url', URL::class, __('URL finale'), ['type' => 'hidden_visible', 'column' => true]);
- $this->addField('fluidbook_links', Textarea::class, __('Présence dans les fluidbooks'), ['type' => 'hidden_visible', 'column' => true]);
+ $this->addField('target_code', Integer::class, __('Code final'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'http_code', 'column_view_namespace' => 'columns']);
+ $this->addField('target_url', URL::class, __('URL finale'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url']);
+ $this->addField('fluidbook_links', Textarea::class, __('Présence dans les fluidbooks'), ['type' => 'hidden_visible', 'column' => true, 'column_type' => 'shortlinks_fluidbooks','column_view_namespace'=>'columns']);
$this->addOwnerField(['column' => false, 'type' => Hidden::class]);
}
} else {
continue;
}
- $d['fluidbook_links']=json_encode($d['fluidbook_links']);
+ $d['fluidbook_links'] = json_encode($d['fluidbook_links']);
$data[$d['id']] = $d;
}
}