123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Repositories;
- use App\Models\EmailQueue;
- use App\Models\SmsQueue;
- use Prettus\Repository\Eloquent\BaseRepository;
- use Prettus\Repository\Criteria\RequestCriteria;
- /**
- * Class EmailQueueRepository.
- *
- * @package namespace App\Repositories;
- */
- class EmailQueueRepository extends BaseRepository
- {
- /**
- * Specify Model class name
- *
- * @return string
- */
- public function model()
- {
- return EmailQueue::class;
- }
-
- /**
- * Boot up the repository, pushing criteria
- */
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- /**
- * @param $template
- * @param $email
- * @param int $batch_id
- * @return SmsQueue
- * @throws \Prettus\Validator\Exceptions\ValidatorException
- */
- public function createRecord($template, $email, $batch_id = 0)
- {
- $attribute['batch_id']=$batch_id;
- $attribute['m_address']=$email;
- $attribute['m_subject']=$template->title;
- $attribute['m_body']=$template->value;
- return $this->create($attribute);
- }
- public function saveRecord($id, $status, $message = "")
- {
- $attribute['m_status']=$status;
- $attribute['m_sendtime']=time();
- $attribute['error_message']=$message;
- $this->update($attribute, $id);
- }
- }
|