add offers count, & minor fixes code standards

This commit is contained in:
Ludovic CANDELLIER
2021-11-01 16:26:31 +01:00
parent e97f54f126
commit 18f1f8a13a
66 changed files with 526 additions and 574 deletions

View File

@@ -21,10 +21,8 @@ class Upload
{
$data = (is_array($data)) ? (object) $data : $data;
$pos = strrpos($file, '/');
$uuid = substr($file, $pos+1);
$uuid = substr($file, $pos + 1);
$uuid = pathinfo($uuid, PATHINFO_FILENAME);
// $uuid = str_replace('.' . strtolower($data->filetype), '', $uuid);
// $uuid = str_replace('.' . $data->filetype, '', $uuid);
return $uuid;
}
@@ -36,6 +34,7 @@ class Upload
// $path = Storage::putFile('avatars', $request->file('avatar'));
// $path = $request->file('avatar')->storeAs('avatars',$request->user()->id,'s3');
// $path = $request->file('avatar')->storePublicly('avatars', 's3');
$request = Request();
return $request->has($var) ? basename($request->file($var)->store($path)) : false;
}
@@ -128,27 +127,17 @@ class Upload
if (Storage::exists($dest)) {
self::delete($dest);
}
return Storage::move($source, $dest); // transfère et renomme le fichier du dossier temporaire au dossier du client
return Storage::move($source, $dest);
}
public static function delete($file)
{
// Storage::delete($file);
// return unlink($file);
return Storage::delete($file);
}
public static function deleteFile($path)
{
if (!Storage::exists($path)) {
return false;
}
return Storage::delete($path);
return Storage::exists($file) ? Storage::delete($file) : false;
}
public static function deleteRecursive($path)
{
rmdir_recursive($targetDir);
return rmdir_recursive($path);
}
public function make_dir($path, $permissions = 0777)