/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('campaign')->truncate();
     $campaigns = json_decode(File::get('database/migrations/jsondata/campaigns.json'));
     foreach ($campaigns as $campaign) {
         Campaign::create(array('id' => $campaign->id, 'name' => $campaign->name));
     }
 }
Пример #2
0
 public function post()
 {
     try {
         $brand = new Brand(UserSession::get('user._id'));
         $binfo = $brand->get();
         $data = $this->_get_data($binfo);
         $campaign = new Campaign(null);
         $id = $campaign->create($data);
         (new NotifyBrandCampaign())->create($id);
         Alert::once('success', 'Campaign queued for admin approval', Url::current());
     } catch (\Exception $e) {
         Alert::once('error', $e->getMessage(), Url::current());
     }
 }