public function actionBuyApi($sti_id) { $sticker = new Sticker(); $sticker->sti_id = $sti_id; $sticker->uid = $this->uid; $sticker->create_time = time(); $sticker->save(); $this->echoJsonData(array('isSuccess' => true)); }
public function __construct(\stdClass $data) { parent::__construct($data); $this->checkData("duration", true); $this->checkData("mime_type", false, true); $this->checkData("caption", false, true); }
public function mainStickerPath() { $img = DB::table('sticker')->where('beer_id', $this->id)->first(); if (!$img) { return null; } return Sticker::find($img->id)->image->path; }
/** * Remove the specified resource from storage. * DELETE /beer/{id} * * @param int $id * @return Response */ public function destroy($id) { $beer = Beer::find($id); foreach (Image::where('beer_id', $id) as $img) { $img->delete(); } foreach ($beer->image as $image) { $image->delete(); } foreach (Sticker::where('beer_id', $id) as $sticker) { $sticker->delete(); } $beer->brewer()->sync([]); $beer->delete(); return Redirect::to('/dashboard/beers'); }
/** * @param array $attributes */ public function loadRelated(array $attributes) { parent::loadRelated($attributes); if (isset($attributes['from'])) { $this->from = User::create($attributes['from']); } if (isset($attributes['chat'])) { $this->chat = isset($attributes['chat']->title) ? GroupChat::create($attributes['chat']) : User::create($attributes['chat']); } if (isset($attributes['forward_from'])) { $this->forward_from = User::create($attributes['forward_from']); } if (isset($attributes['forward_from_chat'])) { $this->forward_from_chat = Chat::create($attributes['forward_from_chat']); } if (isset($attributes['reply_to_message'])) { $this->reply_to_message = Message::create($attributes['reply_to_message']); } if (isset($attributes['entities'])) { $this->entities = array_map(function ($entity) { return MessageEntity::create($entity); }, $attributes['entities']); } if (isset($attributes['audio'])) { $this->audio = Audio::create($attributes['audio']); } if (isset($attributes['document'])) { $this->document = Document::create($attributes['document']); } if (isset($attributes['photo'])) { $this->photo = array_map(function ($photo) { return PhotoSize::create($photo); }, $attributes['photo']); } if (isset($attributes['sticker'])) { $this->sticker = Sticker::create($attributes['sticker']); } if (isset($attributes['video'])) { $this->video = Video::create($attributes['video']); } if (isset($attributes['voice'])) { $this->voice = Voice::create($attributes['voice']); } if (isset($attributes['contact'])) { $this->contact = Contact::create($attributes['contact']); } if (isset($attributes['location'])) { $this->location = Location::create($attributes['location']); } if (isset($attributes['venue'])) { $this->venue = Venue::create($attributes['venue']); } if (isset($attributes['new_chat_member'])) { $this->new_chat_member = User::create($attributes['new_chat_member']); } if (isset($attributes['left_chat_member'])) { $this->left_chat_member = new User($attributes['left_chat_member']); } if (isset($attributes['new_chat_photo'])) { $this->new_chat_photo = array_map(function ($photo) { return PhotoSize::create($photo); }, $attributes['new_chat_photo']); } }
public function parseSticker($stickerObject) { $sticker = new Sticker(); $sticker->setFileId($stickerObject->file_id); $sticker->setWidth($stickerObject->width); $sticker->setHeight($stickerObject->height); if (property_exists($stickerObject, 'thumb')) { $sticker->setThumb($this->parsePhotoSize($stickerObject->thumb)); } if (property_exists($stickerObject, 'file_size')) { $sticker->setFileSize($stickerObject->file_size); } return $sticker; }