Closed noesnaterse closed 4 years ago
There is no Mail
facade in this package, and you don't need to publish anything. All you need to do is install the package, and if you already rendered a view with this syntax, clear your view cache so it gets compiled again with the package.
There is a test that shows this stuff working on Laravel 7: https://github.com/GrahamCampbell/Laravel-Markdown/blob/master/tests/Functional/stubs/qux.blade.php; https://github.com/GrahamCampbell/Laravel-Markdown/blob/master/tests/Functional/MarkdownViewTest.php#L67-L72.
Whoops, I copied the wrong line.
I meant I added 'Markdown' => GrahamCampbell\Markdown\Facades\Markdown::class,
to the aliases in config/app.php
as described in the readme: You can also optionally alias our facade.
The point is, that when I take the first snippet and paste it into my file.blade.php and try to render it using a browser. It just literally renders it out. So the output stays exactly the same.
I am not able to replicate this, and we have tests to prove that it works, as I posted above. Are you able to produce an example failing test?
hmmm, this always happens.
So I create a new Laravel app. Do according to the instructions:
composer require graham-campbell/markdown
php artisan vendor:publish
@markdown($var)
See it work :(Well, actually that is good, but in my real project it still goes wrong.
It probably isn't something of this package...
Do you have other packages messing about with views? Maybe those packages are doing something wrong which messes up view rendering.
Not sure, but since I have two versions now (one working and one not) I can compare.
So, in my version not working, inside the MarkdownServiceProvider
the boot
function there is a statement if ($this->app->config->get('markdown.views'))
This statement returns 1 in the version that is working but doesn't return anything in the version that is not working.
I thought it might have to do with config/markdown.php
but with both projects this file is identical. I.e. no diff is being generated.
Did you clear/regenerate your config cache?
To get back on your question about other packages messing with views. I diffed the two package.json files and the only difference is guzzlehttp/guzzle version 6.3 and 6.5 So I don't think that is the answer.
cache:clear also clears the config cache right? To be certain I did a config:clear and a config:cache after the cache:clear but still it isn't working.
Did you use the same version of composer? The current stable release of Laravel won't discover packages properly if you use the newest composer (any 2.x version). You'll need a composer 1.x version (until laravel releases a fix tomorrow).
Yes, installed globally.
$ composer --version
Composer version 1.10.0 2020-03-10 14:08:05
$ which composer
/usr/local/bin/composer
If anyone has this issue, I was having same issue. I ran php artisan view:clear and it started working.
I did al the setup instructions:
composer require graham-campbell/markdown
php artisan vendor:publish
Then added'Mail' => Illuminate\Support\Facades\Mail::class,
to thealiases
inconfig/app.php
That should be enough, so I do
@markdown($page->body)
in ablade.php
file, and then it just outputs literally@markdown($page->body)
When I change that toit just print the @markdown the content (in markdown) end the endmarkdown.
I am using Laravel 7.0