MediaPushRelationBooks.php 793 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: hp
  5. * Date: 2017/11/21
  6. * Time: 8:59
  7. */
  8. namespace App\Modules\MediaPush\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class MediaPushRelationBooks extends Model
  11. {
  12. protected $table = 'media_push_book_relations';
  13. protected $fillable = ['id', 'pro_bids', 'bid', 'created_at', 'updated_at'];
  14. static function getByBid($bid)
  15. {
  16. return self::where('bid', $bid)->first();
  17. }
  18. static function updateItem($bid, $params = [])
  19. {
  20. return self::where('bid', $bid)->update($params);
  21. }
  22. static function addItem($data)
  23. {
  24. return self::create($data);
  25. }
  26. static function createdOrUpdated($insertArray, $updateArray)
  27. {
  28. return self::updateOrInsert($insertArray, $updateArray);
  29. }
  30. }