-1

i'm trying to insert values from laravel seeder. All other tables data inserted but i'm stuck on input_fields table. Even it's working on my local Mamp server absoultely fine but when i try to run on Live server getting error but as i seen the table name is existed in my database. I run "composer dumpautoload" too but still face same issue.

inputField.php

namespace App;

use Illuminate\Database\Eloquent\Model;

class inputField extends Model
{
    protected $table = 'input_fields';

    public function dropDown()
    {
        return $this->belongsTo('App\dropDown', 'drop_id');
    }
}

2017_10_13_093801_input_Fields

Schema::create('input_Fields', function (Blueprint $table) {
            $table->increments('id');
            $table->string('field_name');
            $table->string('cat_id');
            $table->string('description');
            $table->string('drop_id')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });

InputFieldsTableSeeder.php

        $inputvalue = new inputField();
        $inputvalue->field_name = 'Bilirubin Total';
        $inputvalue->cat_id = '1';
        $inputvalue->description = '0.0 - 1.2';
        $inputvalue->save();

M.Awais
  • 31
  • 4
  • 2
    Looks like you're a bit inconsistent with the letter casing. `$table = 'input_fields'` vs `create('input_Fields', ...`. I don't know if Laravel normalizes the names to lower when you create tables, but if not, that could be an issue. Different environments/configurations can have different settings for case sensitivity for table names. Try and be consistent (change to `create('input_fields', ...`) and see if that works better. – M. Eriksson Sep 02 '19 at 13:57
  • So, did that do the trick or does the error persist? – M. Eriksson Sep 02 '19 at 15:32
  • Thank you so much. It's perfectly work for me. But can you please let me know why it's working before local but not on live server. :-). – M.Awais Sep 02 '19 at 18:45
  • Like I said in my first comment: _"Different environments/configurations can have different settings for case sensitivity for table names"_ – M. Eriksson Sep 03 '19 at 05:11
  • I posted an answer. Feel free to accept it so others know the issue have been resolved. – M. Eriksson Sep 03 '19 at 05:14
  • thank you for quick solution. – M.Awais Sep 03 '19 at 10:22

1 Answers1

0

You're a bit inconsistent with the letter casing.

$table = 'input_fields' 

and

create('input_Fields', .... 

Different environments/configurations can have different settings for case sensitivity for table names. Try and be consistent and change to

create('input_fields', ...) 

and it should work better.

M. Eriksson
  • 13,450
  • 4
  • 29
  • 40