Answers for "share data with view php"

PHP
4

laravel load view in variable

$html = view('users.edit', compact('user'))->render();
Posted by: Guest on October-07-2020
0

laravel data share all views

<?php

namespace App\Providers;

use Illuminate\Support\Facades\View;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('key', 'value');
    }
}
Posted by: Guest on December-22-2020
4

laravel load view in variable

$html = view('users.edit', compact('user'))->render();
Posted by: Guest on October-07-2020
0

laravel data share all views

<?php

namespace App\Providers;

use Illuminate\Support\Facades\View;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('key', 'value');
    }
}
Posted by: Guest on December-22-2020

Browse Popular Code Answers by Language