123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Repositories;
- use App\Models\SmsQueue;
- use Prettus\Repository\Eloquent\BaseRepository;
- use Prettus\Repository\Criteria\RequestCriteria;
- /**
- * Class SmsQueueRepository.
- *
- * @package namespace App\Repositories;
- */
- class SmsQueueRepository extends BaseRepository
- {
- /**
- * Specify Model class name
- *
- * @return string
- */
- public function model()
- {
- return SmsQueue::class;
- }
-
- /**
- * Boot up the repository, pushing criteria
- */
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- /**
- * @param $template
- * @param $mobile
- * @param int $utype
- * @param int $sender_id
- * @param int $batch_id
- * @return SmsQueue
- * @throws \Prettus\Validator\Exceptions\ValidatorException
- */
- public function createRecord($template, $mobile, $utype = 0, $sender_id = 0, $batch_id = 0)
- {
- $attribute['batch_id']=$batch_id;
- $attribute['utype']=$utype;
- $attribute['sender_id']=$sender_id;
- $attribute['s_number']=$mobile;
- $attribute['s_body']=$template->value;
- $attribute['sms_id']=$template->id;
- return $this->create($attribute);
- }
- public function saveRecord($id, $status, $message = "")
- {
- $attribute['s_status']=$status;
- $attribute['s_sendtime']=time();
- $attribute['error_message']=$message;
- $this->update($attribute, $id);
- }
- }
|