0
votes

I'd like to add a table in resources\views\welcome.blade.php. So I add the html table code there and it works. Then I try to edit app\Http\Controllers\HomeController.php to see a vardump in welcome.blade.php but nothing shows there, continue only my table.

Any ideas what I'm doing wrong? I'm new using laravel.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Model\ModelHome;
use App\User;

class HomeController extends Controller
{
    
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
        $this->objUser=new User();
        $this->objBook=new ModelFuncionarios();
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        dd($this->objUser);
        return view('home');
    }
}
2
Your Homecontroller doesn't use welcome.blade.php but home.blade.php. dd(...) is short for "dump & die" - it dumps the information and stops script execution. Also, you need to be logged in/auth'd to use HomeController, probably redirected you to welcome.blade.php before executing your index methodbrombeer
@brombeer - just answer :)cssBlaster21895
Thanks friends!RGS
@cssBlaster21895 Was doing it, had to feed my cat first! ;) Thxbrombeer

2 Answers

2
votes

Your Homecontroller doesn't use welcome.blade.php but home.blade.php. dd(...) is short for "dump & die" - it dumps the information and stops script execution.

Also, you need to be logged in/auth'd to use HomeController, you are redirected to welcome.blade.php before executing your index method.

Edit: if you want to "var_dump" information and not stop script execution but continue to show the view you can use dump() instead of dd()

0
votes

When you do dd() the view will not load as this function ends the execution of the script.

Have a look here: laravel 8 dd function