"ext-dom": "*",
"ext-libxml": "*",
"ext-json": "*",
- "backpack/crud": "^4.1.53",
+ "backpack/crud": "^4.1.54",
"backpack/backupmanager": "^3.0",
"backpack/logmanager": "^4.0",
"backpack/permissionmanager": "^6.0",
"digitallyhappy/toggle-field-for-backpack": "^2.0",
"calebporzio/parental": "^v0.11",
"cache/filesystem-adapter": "^1.1",
- "laravel/framework": "^v8.61"
+ "laravel/framework": "^v8.61",
+ "php-ffmpeg/php-ffmpeg": "^0.18.0",
+ "spatie/pdf-to-image": "^2.1"
},
"require-dev": {
"filp/whoops": "^2.14",
--- /dev/null
+<?php
+
+namespace Cubist\Backpack\Http\Controllers\Base;
+
+use Cubist\Util\Files\Files;
+use Illuminate\Routing\Controller;
+
+class XSendFileController extends Controller
+{
+ protected function xSendFile($path)
+ {
+ if (file_exists($path)) {
+ return response(null)->header('Content-Type', Files::_getMimeType($path))->header('X-Sendfile', $path);
+ } else {
+ return response(null)->setStatusCode(404);
+ }
+ }
+}
--- /dev/null
+<?php
+
+namespace Cubist\Backpack\Http\Controllers;
+
+use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
+use Illuminate\Support\Facades\Auth;
+
+class CubistStorageController extends XSendFileController
+{
+ public function storage($file)
+ {
+ if (!Auth::check()) {
+ dd(401);
+ return response(null)->setStatusCode('401');
+ }
+ if (!can('edition')) {
+ dd(403);
+ return response(null)->setStatusCode('403');
+ }
+ return $this->xSendFile(storage_path('app/public/' . $file));
+ }
+}
protected $_adminType = 'tags';
protected $_cast = 'array';
protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+ protected $_columnType = 'array';
}
protected function onAdmin()
{
- return strpos($this->request->getPathInfo(), '/admin') === 0;
+ return strpos($this->request->getPathInfo(), backpack_url()) === 0;
}
public function handle(Request $request, Closure $next)
--- /dev/null
+<?php
+
+Route::group([
+ //'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' => '.*']);
+});