Question: i need 2 function add and update the user socials with serialize array to string before insert to database here my code

```
    <?php
use Illuminate\Database\Eloquent\Model as Model;
class User extends Model{
    protected $table = 'user';
    protected $primaryKey = 'user_id';

    protected $fillable = [
        'name', 
        'email', 
        'socials',
    ];

    public function getSocialsAttribute($value){
       return unserialize($value);
    }

    public function setSocialsAttribute($value){
        settype($value, 'array');
        $this->attributes['socials'] = serialize($value);
    }

}

```

and in my controller 

```
$user_id = User::insert($request->post);

```

the post array with

```
array(
   'name'=>'A',
   'email'=>'Test@gmail.com',
   'socials'=> array(
     'facebook' => 'facebook.com',
     'twitter' => 'twiter.com'
   )
)

```

but the database does not serialize the data !

Answer: 
I think it doesn't work on `insert` method. Try to use the `create` method to insert data to database.

```
$user = User::create($request->post);

```
No , when i save to database the `Socials` is not serialized 

[![enter image description here](https://i.stack.imgur.com/7ywyV.png)](https://i.stack.imgur.com/7ywyV.png)

This show Array in database , i do like you talk remove `getSocialsAttribute`

and does not work .