laravel values to all views code example
Example 1: Pass all data to all pages laravel
use Illuminate\Support\Facades\View;
class BaseController extends Controller
{
public function __construct()
{
//its just a dummy data object.
$user = User::all();
// Sharing is caring
View::share('user', $user);
}
}
Example 2: Pass all data to all pages laravel
this work :)
use Illuminate\Support\Facades\View;