Download the PHP package jokersk/sonata without Composer
On this page you can find all versions of the php package jokersk/sonata. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sonata
Sonata
Make your laravel test easier
Install
in your test file add Sonata\Traits\LetsPlaySonata
trait, that it!
Use
asume you have a model \App\Models\Post
, we can create model like this
if you want to get the created post model, you can
create with relations
now we have a model \App\Models\Comment
, and in \App\Models\Post
model have HasMany relation like
we can create the models without sonata like this
but with sonata, you can create the models like
no matter HasMany, BelongsTo, BelongsToMany, morphMany, morphToMany
, you can just use with
function, sonata will handle the save, associate, or attach
for you
if you want to get created models you can
or
Create with attributes
or
to set attributes to with
function, we can do that
Overvide function name
by default Sonata will find the currect function name, but sometimes your function name is unpredictable
eg. Post
model has many Comment
, so you will have a function call comments
, but sometimes will call the function
activeComments
, in this case, you can call
Create relations from existing model
can use methods to create relation with existing model
Mocking
now you call $foo->where()->first()->content, will equal to 'hello'