/**
  * Fill a Bulletin model from request values
  *
  * @param BulletinModel $model
  *
  * @return BulletinModel
  */
 public function fill(BulletinModel $model)
 {
     $request_values = $this->all();
     foreach ($model->getFillable() as $property) {
         $key = sprintf('bulletin-%s', $property);
         if (isset($request_values[$key])) {
             $model->{$property} = $request_values[$key];
         }
     }
     return $model;
 }
 /**
  * @param integer $id
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function delete($id)
 {
     $bulletin = Bulletin::find($id);
     $response = redirect()->route('bulletins.list');
     if ($bulletin) {
         $bulletin->delete();
         $bulletin->with('message', 'Bulletin has been deleted sucessfully');
     } else {
         $bulletin->with('message', 'Invalid bulletin.');
     }
     return $response;
 }
 /**
  * @return mixed
  */
 public static function getBulletinList($campaignId)
 {
     $fields = ['id', 'name', 'start_at', 'ended_at'];
     $bulletins = Bulletin::select($fields)->where('campaign_id', '=', $campaignId)->orderBy('id', 'asc')->get();
     return $bulletins;
 }