i learning laravel , got error. suggestions whats wrong? tried "composer dump-autoload" didn't solved problem.
errorexception in container.php line 738: class app\http\views\composers\catformcomposer not exist (view: /applications/mamp/htdocs/lar/furbook.com/resources/views/cats/create.blade.php)
reflectionexception in container.php line 738: class app\http\views\composers\catformcomposer not exist
here code: app\http\views\composers\catformcomposer.php
<?php namespace furbook\http\views\composers; use furbook\breed; use illuminate\contracts\view\view; class catformcomposer { protected $breeds; public function __construct (breed $breeds) { $this->breeds = $breeds; } public function compose(view $view) { $view->with('breeds', $this->breeds->lists('name', 'id'); } }
app/providers/appserviceprovider.php
<?php namespace furbook\providers; use illuminate\support\serviceprovider; use illuminate\contracts\view\factory viewfactory; class appserviceprovider extends serviceprovider { /** * bootstrap application services. * * @return void */ public function boot(viewfactory $view) { $view->composer('partials.forms.cat', 'app\http\views\composers\catformcomposer'); } /** * register application services. * * @return void */ public function register() { // } }
your catformcomposer
class defined within furbook\http\views\composers
namespace, you're looking in app\http\views\composers
. need pass correct namespace $view->composer()
call.
Comments
Post a Comment