/** * Update the specified resource in storage. * PUT /campaigns/{id} * * @param int $id * @return Response */ public function update($id) { $campaigns = Campaign::where('id', $id)->update(Input::all()); if ($campaigns) { return ['status' => true, 'data' => $campaigns]; } else { return ['status' => false]; } }
public function showDetails($id) { $category = Category::find($id); // If no item in database if (empty($category) || empty($category->id)) { return Redirect::route('home')->with('message', Lang::get('admin/categories.inexistant')); } $campaigns = Campaign::where('category_id', '=', $id)->get(); $this->layout->content = View::make('public.categories.details'); $this->layout->content->category = $category; $this->layout->content->campaigns = $campaigns; $this->layout->content_title = Lang::get('categories.details.title', array('category' => $category->title)); }
function index($name) { $a = new Account(); if ($name != "") { $c = new Campaign(); $c->where('nickname', $name)->get(); if ($c->id > 0) { $data['campaign_id'] = $c->id; $data['name'] = $c->name; $data['description'] = $c->description; $data['photo'] = $c->photo; $data['countryid'] = $c->countryid; $data['categoryid'] = $c->categoryid; $data['isInfo'] = $c->isInfo; $data['title'] = $c->name; /* * get comments for the campaign */ $com = new Comment(); $com->where('campaign_id', $c->id)->get(); //$comments = new ArrayObject(); $commentsStr = "["; $flag = 0; foreach ($com->all as $comment) { $usr = new Account(); $usr->where('id', $comment->user_id)->get(); $preCom = "<img src = '" . base_url() . "/images/profile/" . $usr->photo . "' align='left'><i>says </i>"; if ($flag) { $commentsStr = $commentsStr . ","; } $flag = 1; $commentsStr = $commentsStr . "\"" . $preCom . $comment->comment . "\""; //$data['comments'][] = $comment->comment; //$data['comments_uid'][] = $comment->user_id; } $commentsStr = $commentsStr . "]"; $data['commentsStr'] = $commentsStr; $data['commentsNum'] = $com->count(); } } $data['a'] = $a; $_SESSION['url'] = site_url('destination/index/' . $name); $this->load->view('destination', $data); }
public function showManage() { $campaigns = Campaign::where('item_vendor_id', Auth::user()->id); if (Input::get('s', '') != '') { $campaigns->where('title', 'LIKE', '%' . Input::get('s') . '%')->orWhere('description', 'LIKE', '%' . Input::get('s') . '%')->orWhere('item_title', 'LIKE', '%' . Input::get('s') . '%')->orWhere('item_description', 'LIKE', '%' . Input::get('s') . '%')->orWhere('target_title', 'LIKE', '%' . Input::get('s') . '%'); } $campaigns->orderBy('id', 'desc'); $this->layout->content = View::make('public.campaigns.manage'); $this->layout->content->campaigns = $campaigns->get(); $this->layout->content_title = Lang::get('campaigns.manage.title'); }