public function delete($id)
 {
     if (Portfolio::destroy($id)) {
         return redirect()->back()->with('msg', 'Портфолио удалено');
     }
     return redirect()->back()->with('warning', 'Не удалось удалить');
 }
 public function postImageDestroy()
 {
     $portfolio_item = Portfolio::find(Input::get('id'));
     if ($portfolio_item) {
         $portfolio_item->image = '';
         $portfolio_item->save();
         return Redirect::back()->with('message', 'Элемент удален');
     }
     return Redirect::back()->with('message', "Ошибка");
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Portfolio::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'caption', $this->caption])->andFilterWhere(['like', 'alt', $this->alt])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
Beispiel #4
0
 /**
  * Show the form for editing the specified resource.
  * GET /projects/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($society, $id)
 {
     $project = Project::find($id);
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society) or $project->individual_id == Auth::user()->individual_id) {
         $portfolios = Portfolio::orderBy('portfolio')->lists('portfolio', 'id');
         $individuals = Individual::orderBy('surname')->get();
         return View::make('projects.edit')->with('project', $project)->with('individuals', $individuals)->with('portfolios', $portfolios)->with('society', $society);
     } else {
         return view('shared.unauthorised');
     }
 }
 /**
  * Remove the specified resource from storage.
  * DELETE /portfolios/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $portfolio = Portfolio::find($id);
     $portfolio->delete();
     return Redirect::to('/portfolios')->with('okmessage', 'Portfolio deleted');
 }
 /**
  * Finds the Portfolio model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Portfolio the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Portfolio::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function getDetails($id = null)
 {
     return view('portfolio.details', ['portfolio' => Portfolio::findOrFail($id)]);
 }
Beispiel #8
0
 public function actionPortfolio()
 {
     $filter = Yii::$app->request->get("filter", "all");
     $page = Yii::$app->request->get("page", 1);
     $data = Portfolio::getPortfolio($filter, $page);
     return $this->render('portfolio', ['elements' => $data['elements'], 'pagination' => $data['pagination'], 'filter' => $filter]);
 }
Beispiel #9
0
 public function index()
 {
     return view('home.index', ['services' => Service::where('on_the_home', 1)->orderBy('weight')->get(), 'portfolios' => Portfolio::where('on_the_home', 1)->orderBy('weight')->get()]);
 }