Use table created phpmyadmin in Laravel

0

I have a table with more than a thousand records, which in its day import to phpmyadmin, with which I did not migrate from that table. I made its respective model respecting the singular and plurals corresponding. To say that in " local " the table works perfectly, but the problem comes when it is in a remote server when I execute a query in said table, it gives me this error.

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'rwebstu2_bpm_aplicacion4.V9prices' doesn't exist (SQL: select * from 'V9prices' where 'referencia' = 10200.RF.W-AQ.MP)

Some suggestions I have searched but I have not found anything about it.

Greetings.

    
asked by Luis Ve 28.12.2017 в 15:13
source

2 answers

0

Create a model with a readable name and write the table variable by assigning the name of that table.

protected $table = 'nombreDeLaTabla';

Example of documentation:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'my_flights';
}

link

Greetings

    
answered by 29.12.2017 в 01:50
0

Thanks to all, in the end I found the fault, I do not know why it worked for me and not on the server. To the point, the name of the table was written like "v9prices", the model and the calls to make this query were with, "V9price" model and "V9prices" the queries respectively. In local they worked perfectly it did not give any type of error, but in the remote server yes. Until I was tired looking for a while desperate the error screen and I said "There is the failure".

What I'm still wondering is why it worked locally and not remotely.

Thank you all, you are very kind !!

    
answered by 31.12.2017 в 02:16