SHARE
TWEET

Untitled

a guest Oct 17th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. public function generatePath()
  4. {
  5.     $attempts = 5;
  6.    
  7.     for ($i = 0; $ i<= $attempts; $i++) {
  8.         $path = 'public/photos/'. Str::random(40). '.jpg';
  9.  
  10.         if (!Storage::exists($path) {
  11.             return $path;
  12.         }
  13.     }
  14.    
  15.     throw new Exception('Can\'t find a file name');
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top