Allow users to pass unserialized array
This commit is contained in:
parent
70cd832876
commit
e5b48176c4
@ -26,7 +26,7 @@ class Meta extends Model implements FoundationModel, MetaContract
|
||||
* @return callable
|
||||
*/
|
||||
public static function create( array $args = [] ){
|
||||
$args['meta'] = (isset($args['meta'])) ? $args['meta'] : serialize([]);
|
||||
$args['meta'] = (isset($args['meta'])) ? ((gettype($args['meta']) === 'array') ? serialize($args['meta']) : $args['meta']) : serialize([]);
|
||||
$args['uuid'] = (isset($args['uuid'])) ? $args['uuid'] : Uuid::uuid4();
|
||||
|
||||
return parent::create($args);
|
||||
|
@ -34,7 +34,7 @@ class MetaTest extends \PHPUnit_Framework_TestCase
|
||||
public function testUuidQuery ()
|
||||
{
|
||||
$model = Meta::create([
|
||||
'meta' => serialize(['name' => 'Tony'])
|
||||
'meta' => ['name' => 'Tony']
|
||||
]);
|
||||
|
||||
$queried = Meta::withUuid($model->getUuid())->first();
|
||||
|
Loading…
Reference in New Issue
Block a user