Search code examples
mysqllaravellaravel-4reserved-words

Laravel - How to INSERT rows with Reserved Words and dashes


I have a MySQL table and I can't change the structure because is from Asterisk. Two columns have troubled names and I don't know how to handle it using Eloquent.

$row = new Extension;
$row->call-limit = $calllimit; 
$row->dynamic = $dynamic;
$row->save();

call-limit have a dash and dynamic is a reserved word.

Thanks


Solution

  • Try this:

    $row->getAttribute('call-limit');
    
    $row->setAttribute('call-limit', $limit);