SUKOHI / SaveWithoutEvent by Sukohi

A Laravel package to prevent firing a specific event(s) of model when saving.
14
0
2
Package Data
Maintainer Username: Sukohi
Maintainer Contact: capilano.sukohi@gmail.com (Sukohi)
Package Create Date: 2017-08-01
Package Last Update: 2017-08-01
Language: PHP
License: MIT
Last Refreshed: 2024-05-11 03:07:38
Package Statistics
Total Downloads: 14
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

SaveWithoutEvent

A Laravel package to prevent firing a specific event(s) of model when saving.

Installation

Execute composer command.

composer require sukohi/save-without-event:1.*

Preparation

In your model, set SaveWithoutEventTrait.

<?php

namespace App;
use Sukohi\SaveWithoutEvent\SaveWithoutEventTrait;

class User {

    use SaveWithoutEventTrait;
    

That's all. Now you can use saveWithoutEvent method.

Usage

Use saveWithoutEvent() instead of save() like so.

$user = new \App\User;
// Something..
$user->saveWithoutEvent('saved');

// or with array

$user->saveWithoutEvent(['saving', 'saved']);
  • saveWithoutEvent() will return boolean result value as save() do.

License

This package is licensed under the MIT License.

Copyright 2017 Sukohi Kuhoh