Where it takes a long time

1

I'm using Laravel 5.6

My model is normal

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class MyTable extends Model
{
    protected $table = 'myTable';
    public $timestamps = false;

}

I'm trying to make a simple query where it is to bring 8 records

I'm using it like this:

 public function getDevice( Request $request  ){
        $ip = $request->input('ip');       
        $table = MyTable::where('description', $ip );
        echo "<pre>";
        print_r($table );
        echo "</pre>";
        /*
        return response()->json($table);
        */
    }

But it's crashing and it's not bringing the result

Consider the table

id | description| status | 
1  |  1         |   0    |
2  |  1         |   1    |
3  |  1         |   0    |
4  |  1         |   1    |

But if I use it like this

$query DB::select('SELECT * FROM myTable WHERE description = ?', [1]);

or if you bring only one

$table = MyTable::find(1); 

$table = MyTable::all(); 

It works

    
asked by anonymous 25.09.2018 / 22:22

1 answer

4

The way you are using the query is only being stored, not executed. If you really want to run the query you should use commands like find or get. Try changing the following code

$table = MyTable::where('description', $ip );

by this

$table = MyTable::where('description', $ip )->get();

    
26.09.2018 / 14:39
___ ___ erkimt error in the data change in the existing document header ______ qstntxt ___

Good morning.

I have a function in VB to edit purchase documents.

Everything goes well but if you call %code% the header variables are changed, but when calling %code% always gives an error:

  

8169: Conversion failed when converting from a character string to   uniqueidentifier.

It gives the idea that the doccompra gets lost after %code% .

Thank you for your help

%pre%     
______ azszpr332118 ___

When calling the %code% method with the second parameter equal to 5, it means that we will change the data related to %code% , %code% , %code% , etc. When you change data related to %code% , the %code% method will change the %code% by suggesting the next number in the series. To work around the problem, you can re-assign the %code% after calling the %code% method.

Code:

%pre%

Another solution would be to call the %code% method with the second parameter equal to 2, so it only changes the entity's related data.

Code:

%pre%     
______ azszpr332130 ___

John

In the code you are running there are some improvements you can make, for example, as the property %code% is controlled by PRIMAVERA you do not have to do anything about it. The type of entity also does not have to be indicating, and by utlimo as Flavio Jardim said is to use parameter 2 because in reality it is only changing the entity and only this is that it has impact on other properties of the document. > %pre%

More information about the codes of this method.

%pre%     
___
I'm trying to make a small image slide