I'm thrilled to announce the release of Easy Model v1.1.1, bringing key improvements and new features:
- Updatable Trait: Perform batch updates efficiently with streamlined methods.
/**
* Store a newly created resource in storage.
*/
public function store()
{
return $this
->updateOrCreateModel(['name' => 'Mahmoud Ramadan', 'email' => 'easymodel@updatable.org'], [
'password' => bcrypt('admin'),
], incrementEach: ['points' => 2])
->fetch();
}
- ignoreGlobalScopes Method: Exclude specific global scopes to customize your queries with more control.
/**
* Display a listing of the resource.
*/
public function index()
{
return $this
->setChainableModel(User::class)
->addWheres([
['name', 'Mahmoud Ramadan']
])
->usingScopes([
UserIsAdminScope::class,
EmailVerifiedScope::class,
])
->ignoreGlobalScopes([UserIsAdminScope::class])
->execute()
->get();
}
- includeSoftDeleted Method: Retrieve soft-deleted records in your results, offering a more comprehensive data set.
/**
* Display a listing of the resource.
*/
public function index()
{
return $this
->setChainableModel(User::class)
->addWheres([
['name', 'Mahmoud Ramadan']
])
->includeSoftDeleted()
->execute()
->get();
}
Renamed setModel Method: The setModel method is now setSearchableModel for clarity and better function.
Code Refactor: Improved structure for easier maintenance.
Enhanced Readability: Code updates to improve readability and speed up development.
Full Changelog: v1.1.0...v1.1.1
Top comments (0)