/** * Get the Complete Name for the user. * * @return string */ public function setPathAttribute($path) { if (!empty($path)) { $title = Carbon::now()->second . $path->getClientOriginalName(); $this->attributes['path'] = $title; \Storage::disk('local')->put($title, \File::get($path)); } }
public function get_content($format = null) { $path = $this->get_file_path($format); try { return \File::get($path); } catch (Illuminate\Filesystem\FileNotFoundException $e) { $content = DocContent::where('doc_id', '=', $this->attributes['id'])->where('parent_id')->first()->content; if ($format == 'html') { $content = Markdown::render($content); } return $content; } }