Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function generatePath()
- {
- $attempts = 5;
- for ($i = 0; $ i<= $attempts; $i++) {
- $path = 'public/photos/'. Str::random(40). '.jpg';
- if (!Storage::exists($path) {
- return $path;
- }
- }
- throw new Exception('Can\'t find a file name');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement