/** * Get A Single File * * @param int $identifier The id or filename * @return array * **/ public function getFile($identifier = 0) { // they could have specified the row id or the actual filename $results = strlen($identifier) !== 30 ? File::find($identifier)->toArray() : File::findByFilename($identifier)->toArray(); //Make sure other code that uses this uses $file->folder->slug instead of $file->folder_slug (and same for folder name) $message = $results ? null : trans('files.no_records_found'); return $this->result((bool) $results, $message, null, $results); }