How can I make a column for putting arrays in a database migration in Laravel for use of eloquent ORM? i.e. I want to make the following possible:
class Foo extends Model {
}
$foo = new Foo();
$foo->scores = [1, 2, 3, 4, 5];
$foo->save;
How can I make a column for putting arrays in a database migration in Laravel for use of eloquent ORM? i.e. I want to make the following possible:
class Foo extends Model {
}
$foo = new Foo();
$foo->scores = [1, 2, 3, 4, 5];
$foo->save;
Using serialize()
function:
$foo=new foo();
$scores=array(1,2,3);
$foo->scores=serialize($scores);
$foo->save();