1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Modules\WechatMaterial\Models;
- use Illuminate\Database\Eloquent\Model;
- class WechatMaterial extends Model
- {
- protected $table = 'wechat_materials';
- protected $connection = 'api_mysql';
- protected $fillable = ['batch_id', 'bid', 'url', 'book_name', 'title', 'cover_url', 'desc', 'sort_no', 'created_at', 'content_mode', 'content',
- 'updated_at'];
- public static function delByBatchId($batch_id)
- {
- return self::where('batch_id', $batch_id)->delete();
- }
- public static function getWeChatMaterials($batch_id)
- {
- return self::where('batch_id', $batch_id)->orderBy('sort_no', 'asc')->get();
- }
- public static function getWeChatMaterial($materialId)
- {
- $result = self::where('id', $materialId)->first();
- return $result ? $result->toArray() : [];
- }
- }
|