Answers for "how to get data in view in laravel"

PHP
4

laravel load view in variable

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

laravel load view in variable

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

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);
  }
}
Posted by: Guest on October-22-2020
0

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);
  }
}
Posted by: Guest on October-22-2020

Code answers related to "how to get data in view in laravel"

Browse Popular Code Answers by Language