I try to make some documentation page, with several pages.
(I'm using Laragon and virtual host, so URLs are like mysite.dev/something
)
I created 2 routes :
Route::get('docs','DocsController@index');
Route::get('docs/{text}','DocsController@index');
So when I write URL mysite.dev/docs
, I get kinda like a docs home page.
Here's the controller :
class DocsController extends Controller
{
public function index($text = '', $f = '') {
if ($text != '')
if (Storage::has('testText/'.$text.'.html'))
$f = Storage::get('testText/'.$text.'.html');
else
$f = 'File doesn\'t exist...';
return view('docs')->with('text',$f);
}
}
I tested it on some text files, and it work pretty good with Storage, but in this code, you can see '.html' because i tried to do the same thing with html files. The result is the page containing the html code but written as text.
Is there a way to get this code from html files, and make it work as html ? Maybe there is a better Facade than Storage to do this, but I don't know very well Laravel.
Your docs blade template probably needs {!! $text !!} where you have {{ $text }}