Friday, April 14, 2017

Laravel webwizo shortcodes package Shortcodes class not found

I recently started using laravel so i'm a beginner, and right now i'm working on a small project which requires me use shortcodes(like the ones in wordpress). So i searched for a little bit and found this package:

https://packagist.org/packages/webwizo/laravel-shortcodes

I ran the installation and usage the way it's written but i get the error : Class 'App\Providers\Shortcode' not found in the provider I have to make using the laravel make:provider command as specified in the package instructions, below is my exact usage and install code.

  1. added this to the providers array :

     /*
     * shortcodes providers
     */
    Webwizo\Shortcodes\ShortcodesServiceProvider::class,
    App\Providers\ShortcodesServiceProvider::class,
    
    
  2. Added this to aliases:

    'Shortcode' => Webwizo\Shortcodes\Facades\Shortcode::class,

  3. this is the content of my ShortcodesServiceProvider in app/providers:

    namespace App\Providers;

    use Illuminate\Support\ServiceProvider; use App\Shortcodes\JobsForm;

    class ShortcodesServiceProvider extends ServiceProvider { /**

    • Bootstrap the application services. *
    • @return void */ public function boot() { // }

    /**

    • Register the application services. *
    • @return void */ public function register() { Shortcode::register('jobs', JobsForm::class); } }

I use laravel 5.4 so that might be an issue.

The thing is the class obviously exists, it gives the Shortcodes class not found error because I think it searches for it in the app/providers/ShortcodesServiceProvider file, and obviously it's not there it's in the vendor file.

Is there something I'm missing i've checked and double checked, I can't seem to get this thing to work.

It shoould work considering it has an alias defined right ?

I used it in the view like this:

return view('quarx-frontend::pages.' . $page->template)->with('page', $page)->withShortcodes();

Thanks for taking the time to read this any help would be much appreciated.

If you need any more info I'll be glad to supply it.

p.s. sorry for bad english ,not a native speaker :P



via PhpJunior

Advertisement