Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function filenameFormatter($entityType, $entityId, $mimeType)
- {
- $timestamp = Carbon::now()->format('YmdHis');
- // Extract MIME Type
- $explodedMimeType = explode('/', $mimeType);
- $type = $explodedMimeType[0];
- $subType = $explodedMimeType[1];
- return "{$timestamp}_{$entityType}_{$entityId}_{$type}.{$subType}";
- }
- public function filenameFormatterTest()
- {
- $newFilename = $this->filenameFormatter('post', '1234', 'image/png');
- echo $newFilename;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement