12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- /**
- * Created by PhpStorm.
- * User: tandunzhao
- * Date: 2018/1/19
- * Time: 上午9:59
- */
- namespace App\Modules\Book\Models;
- use Illuminate\Database\Eloquent\Model;
- class ChapterImage extends Model
- {
- protected $table = 'chapter_images';
- protected $fillable = ['bid', 'cid', 'sequence', 'cid_sequence', 'image_url','image_height','image_width','file_size'];
- public static function deleteChapterImage($bid, $cid = '') {
- $search_object = self::where('bid', $bid);
- if($cid) {
- $search_object -> where('cid', $cid);
- }
- $search_object->delete();
- }
- /**
- * @param $bid
- * @param string $cids [1,2,3,4,5]
- * @return mixed
- */
- public static function getChapterImage($bid, $cids = '') {
- $search_object = self::orderBy('bid', 'asc')->orderBy('cid_sequence', 'asc')->orderBy('sequence', 'asc');
- $search_object -> where('bid', $bid);
- if($cids) {
- $search_object -> whereIn('cid', $cids);
- }
- return $search_object->get();
- }
- }
|