Print the value of a variable with php [closed]

-2

How can I get the value of a variable that comes from a query to the database? I want to know what value that query brings me and for that I need to print it in console.

    
asked by LLaza 28.03.2016 в 06:02
source

1 answer

2

This is a basic example:

In your controller it would go like this:

$data = DB::table('data')->where('id','3')->first();
return View::make('hello',['data'=>$data->info]); 

Where:

table('data')table('data') Is the name of the table.

where('id','3') Extract the data where   id=3

'hello' It is the name of the view where you want to show the data.

['data'=>$data->info] Show the info in the table.

Now in the view you put this:

{{ $data }}

This variable will show the data of ['data'=>$data->info] .

In console I do not know exactly how to print directly, but it goes like this:

    Log::info("mensaje: " . $variable);

For more info click here

    
answered by 28.03.2016 / 07:05
source