@@ -43,7 +43,7 @@ public function getFiles(Request $request)
4343 }
4444 $ dirs = $ this ->getDirectories ($ path );
4545
46- $ files = Medium ::whereRaw ("REPLACE(path, SUBSTRING_INDEX(path, '/', -1), '') = ' " . $ path . "/' " )->limit ($ limit )->offset ($ offset )->orderBy ('created_at ' , 'desc ' )->orderBy ('id ' , 'desc ' )->get ()->map (function ($ item ) {
46+ $ files = AtriatechMedia:: medium_model () ::whereRaw ("REPLACE(path, SUBSTRING_INDEX(path, '/', -1), '') = ' " . $ path . "/' " )->limit ($ limit )->offset ($ offset )->orderBy ('created_at ' , 'desc ' )->orderBy ('id ' , 'desc ' )->get ()->map (function ($ item ) {
4747 $ item ->visibility = $ item ->visibility ;
4848 $ item ->size = $ item ->size ;
4949 $ item ->basename = $ item ->basename ;
@@ -123,7 +123,7 @@ public function deleteItem(Request $request)
123123 if (Storage::exists ($ item )) {
124124 $ this ->rrmdir (((!empty (config ('atriatech_media.url_prefix ' ))) ? trim (config ('atriatech_media.url_prefix ' ), '/ ' ) . '/ ' : '' ) . ltrim (Storage::url ($ item ), '/ ' ));
125125 } else {
126- $ media = Medium ::path ([['path ' => $ item ]])->first ();
126+ $ media = AtriatechMedia:: medium_model () ::path ([['path ' => $ item ]])->first ();
127127 if (!empty ($ media )) {
128128 $ attributes = $ media ->getAttributes ();
129129 $ item_path [] = $ attributes ['path ' ];
@@ -153,7 +153,7 @@ public function renameItem(Request $request)
153153 $ newName = $ request ->input ('newName ' );
154154
155155 if (Storage::exists ($ item )) {
156- $ media = Medium ::whereRaw ("REPLACE(path, SUBSTRING_INDEX(path, '/', -1), '') = ' " . $ item . "/' " )->get ();
156+ $ media = AtriatechMedia:: medium_model () ::whereRaw ("REPLACE(path, SUBSTRING_INDEX(path, '/', -1), '') = ' " . $ item . "/' " )->get ();
157157 $ newPath = substr ($ item , 0 , strpos ($ item , strrchr (rtrim ($ item , '/ ' ), '/ ' ))) . "/ " . $ newName ;
158158 foreach ($ media as $ medium ) {
159159 $ medium ->update ([
@@ -175,7 +175,7 @@ public function renameItem(Request $request)
175175 }
176176 Storage::move ($ item , $ newPath );
177177 } else {
178- $ medium = Medium ::path ([$ item ])->first ();
178+ $ medium = AtriatechMedia:: medium_model () ::path ([$ item ])->first ();
179179
180180 $ attributes = $ medium ->getAttributes ();
181181 $ newPath = str_replace (pathinfo ($ attributes ['path ' ], PATHINFO_FILENAME ), $ newName , $ attributes ['path ' ]);
@@ -243,7 +243,7 @@ private function rrmdir($dir)
243243 if (is_dir ($ dir . '/ ' . $ object ) && !is_link ($ dir . "/ " . $ object )) {
244244 $ this ->rrmdir ($ dir . '/ ' . $ object );
245245 } else {
246- Medium ::where ('path ' , 'public ' . mb_substr (ltrim ($ dir . '/ ' . $ object , './ ' ), 7 ))->delete ();
246+ AtriatechMedia:: medium_model () ::where ('path ' , 'public ' . mb_substr (ltrim ($ dir . '/ ' . $ object , './ ' ), 7 ))->delete ();
247247 unlink ($ dir . '/ ' . $ object );
248248 }
249249 }
0 commit comments