so i have followed many tutorials and videos and checked here and cant seem to get this to work, really need help. im going to provide my code and explain what im trying to so and hopefully someone can help me sort this out. so what im trying to so is to pass my $user and $company data from my database to my partial layout though view composer. i used php artisan to make a composerserviceprovider and and dashboardcomposer in my view/composer folder and i get errors.
my composerserviceprovider.php is as follows
<?php
namespace App\Providers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use App\companies;
use App\user;
class ComposerServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
view()->composer("layouts.dashboard","App\View\Composers\dashboardnavComposer");
}
}
my dashboardnavcomposer.php is as follows
<?
namespace App\View\Composers;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Auth;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
use App\companies;
use App\user;
class dashboardnavComposer
{
public function compose(View $view)
{
$view->with('user', ComposerServiceProvider::all());
}
}
im probably doing something completely wrong or completely missing a step, i already did the php artisan dumpautoload, so this is not the problem. any help would be appreciated. also to let you know, i use to do this 10+ years ago and i quit to be a truck driver and so last time i did this php4 was king. so please understand i just starting relearning this about 30 days ago.
thanks in advance for any help you can provide.