Coder Social home page Coder Social logo

Comments (19)

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

What exactly are you injecting?

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Have you registered the service provider correctly, and cleared the services.json file?

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

In my controller, I'm doing:

use Illuminate\Support\Facades\App;
use League\CommonMark\Converter;

And then:

public function __construct(Converter $converter)
    {
        $this->converter = $converter;
    }

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Is the service provider registered correctly?

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

In my providers I have:

GrahamCampbell\Markdown\MarkdownServiceProvider::class,

and in aliases:

'Markdown' => GrahamCampbell\Markdown\Facades\Markdown::class,

cache is cleared. Restarted php artisan serve

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Does the facade work out of interest?

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

Doesn't look like it. Using your example:

use GrahamCampbell\Markdown\Facades\Markdown;
Markdown::convertToHtml('foo'); // <p>foo</p>

I get:

ReflectionException in /Users/jblyberg/git/dl_org-laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php line 737:
Class markdown does not exist

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Looks like you've not registered the service provider correctly then.

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

The test suite for this package proves that the facade does work.

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

GrahamCampbell\Markdown\MarkdownServiceProvider::class, should be correct though, right?

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Try 'GrahamCampbell\Markdown\MarkdownServiceProvider'.

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

I will keep fiddling. Thanks for the help!

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Are you sure you removed the services.json file?

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

I just stopped the server, did php artisan config:cache .. cache:clear and that seemed to solve it. Not sure why it didn't work the first time I did it.

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Probably opcache caching the config file. ;)

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

Restarting php-fpm probably flushed that cache.

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

In future, reloading the service rather than restarting should do it.

from laravel-markdown.

jblyberg avatar jblyberg commented on June 18, 2024

Yup! Cheers!

from laravel-markdown.

GrahamCampbell avatar GrahamCampbell commented on June 18, 2024

np ;)

from laravel-markdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.