DEV Community

Mahmoud Ramadan
Mahmoud Ramadan

Posted on • Edited on

Unlock the Power of the New Easy Model – Available Today! 🎉

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();
}
Enter fullscreen mode Exit fullscreen mode
  • 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();
}
Enter fullscreen mode Exit fullscreen mode
  • 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();
}
Enter fullscreen mode Exit fullscreen mode
  • 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

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay