diff --git a/app/Http/Controllers/ColleaguesController.php b/app/Http/Controllers/ColleaguesController.php index 8d42b5d8..81a9303e 100644 --- a/app/Http/Controllers/ColleaguesController.php +++ b/app/Http/Controllers/ColleaguesController.php @@ -7,6 +7,9 @@ class ColleaguesController extends Controller { + use PublicUrl; + const DISK = 'colleagues_images'; + public function listColleagues(Request $request) { $colleagues = Colleagues::orderBy('name')->get(); @@ -20,11 +23,6 @@ public function listColleagues(Request $request) return $colleagues; } - private static function _publicUrl($file, $disk = 'colleagues_images') - { - return asset(\Storage::disk($disk)->url($file)); - } - private static function _expandUrls($colleague) { if ($colleague instanceof Colleagues) { diff --git a/app/Http/Controllers/PostsController.php b/app/Http/Controllers/PostsController.php index 6855cc07..76171df5 100644 --- a/app/Http/Controllers/PostsController.php +++ b/app/Http/Controllers/PostsController.php @@ -14,6 +14,8 @@ class PostsController extends Controller { _after as _after_original; } + use PublicUrl; + const DISK = 'posts_images'; const PAGESIZE = 20; public function byId(Request $request) @@ -210,11 +212,6 @@ private static function _expandUrls($post) return $post; } - private static function _publicUrl($file, $disk = 'posts_images') - { - return asset(\Storage::disk($disk)->url($file)); - } - private static function _makeThumbnail($posts, $enabled = true) { $result = $posts->paginate(self::PAGESIZE); diff --git a/app/Http/Controllers/PublicUrl.php b/app/Http/Controllers/PublicUrl.php new file mode 100644 index 00000000..790b82f0 --- /dev/null +++ b/app/Http/Controllers/PublicUrl.php @@ -0,0 +1,14 @@ +url($file)); + } +}