$response = response(null);
$request = request();
if (!file_exists($path)) {
- return $response->setStatusCode(404);
+ abort(404,'File not found');
}
$mtime = filemtime($path);
$fsize = filesize($path);
return $response->header('X-Sendfile', $path);
}
- public static function sendfileNoCache($path){
- return self::sendfile($path,0);
+ public static function sendfileNoCache($path)
+ {
+ return self::sendfile($path, 0);
}
}
public function storage($file)
{
if (!Auth::check()) {
- return response(null)->setStatusCode('401');
+ return abort(401);
}
if (!can('edition')) {
- return response(null)->setStatusCode('403');
+ return abort(403);
}
- return $this->xSendFile(storage_path('app/public/' . $file));
+ XSendFileController::sendfile(storage_path('app/public/' . $file));
}
}
{
protected $_adminType = 'form_separator';
protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+
+ protected function _postSetAttributes()
+ {
+ parent::_postSetAttributes();
+ $this->setAttribute('name', 'sep_' . rand(100000, 10000000));
+ }
}
+@include('crud::fields.inc.wrapper_start')
<p>{{$field['label']}}</p>
+@include('crud::fields.inc.wrapper_end')
//'prefix' => config('backpack.base.route_prefix', 'admin'),
'middleware' => ['web', config('backpack.base.middleware_key', 'admin')],
], function () { // custom admin routes
- Route::any('storage/{file?}', '\Cubist\Backpack\Http\Controllers\CubistStorageController@storage')->where(['file' => '.*']);
+ Route::any('storage/{file?}', config('cubist.storage_controller', \Cubist\Backpack\Http\Controllers\CubistStorageController::class) . '@storage')->where(['file' => '.*']);
});