Пример #1
0
 public function index($token)
 {
     if ($token === 'W2Xcoiq28sLNasiszA819qgLk42CTc5b') {
         $addressees = Model::all();
         $news = News::getForDelivery();
         $tenders = Tender::getForDelivery();
         $vacancies = Vacancy::getForDelivery();
         $shares = Share::getForDelivery();
         $expert_advices = ExpertAdvice::getForDelivery();
         foreach ($addressees as $addressee) {
             $params['title'] = $addressee->locale . '_title';
             $params['text'] = $addressee->locale . '_text';
             $params['locale'] = $addressee->locale;
             $addressee->news && count($news) ? $params['delivery']['news'] = $news : null;
             $addressee->tenders && count($tenders) ? $params['delivery']['tenders'] = $tenders : null;
             $addressee->vacancies && count($vacancies) ? $params['delivery']['vacancies'] = $vacancies : null;
             $addressee->shares && count($shares) ? $params['delivery']['shares'] = $shares : null;
             $addressee->expert_advices && count($expert_advices) ? $params['delivery']['expert_advices'] = $expert_advices : null;
             if (isset($params['delivery'])) {
                 Mail::send('emails.delivery', $params, function ($message) use($addressee) {
                     $from_address = MailConfig::first();
                     $from_name = Config::get('mail.from');
                     $message->from($from_address->feedback_mail, $from_name['name']);
                     $message->to($addressee->email)->subject(trans('front-end' . DS . 'emails' . DS . 'delivery.subject'));
                 });
             }
             unset($params);
         }
         News::where('sended', 0)->update(['sended' => 1]);
         Tender::where('sended', 0)->update(['sended' => 1]);
         Vacancy::where('sended', 0)->update(['sended' => 1]);
         Share::where('sended', 0)->update(['sended' => 1]);
         ExpertAdvice::where('sended', 0)->update(['sended' => 1]);
     }
 }
 public function show($id)
 {
     $infoConfig = InfoConfig::first()->toArray();
     $object = Model::find($id);
     if (!$object) {
         $object = Model::where('alias', $id)->first();
     }
     if ($object) {
         return view('info.expert-advice', ['object' => $object, 'type' => 'expert_advices', 'infoConfig' => $infoConfig]);
     }
     return redirect('info-center');
 }
Пример #3
0
 public function show(Request $request)
 {
     if (!$request->has('q')) {
         return redirect('/' . LANG);
     }
     $params = $request->only('q');
     $searchParams = explode(" ", trim($params['q']));
     $productsResults = Product::search($searchParams);
     $portfoliosResults = Portfolio::search($searchParams);
     $newsResults = News::search($searchParams);
     $tendersResults = Tender::search($searchParams);
     $vacanciesResults = Vacancy::search($searchParams);
     $sharesResults = Share::search($searchParams);
     $experEdvicesResults = ExpertAdvice::search($searchParams);
     $count = count($productsResults) + count($portfoliosResults) + count($newsResults) + count($tendersResults) + count($vacanciesResults) + count($sharesResults) + count($experEdvicesResults);
     return view('search', ['products' => $productsResults, 'portfolios' => $portfoliosResults, 'news' => $newsResults, 'tenders' => $tendersResults, 'vacancies' => $vacanciesResults, 'shares' => $sharesResults, 'experEdvices' => $experEdvicesResults, 'count' => $count, 'title' => LANG . '_title', 'description' => LANG . '_description', 'adderss' => LANG . '_adderss', 'type' => 'news']);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $object = Model::find($id);
     if ($object) {
         $object->delete();
     }
     return redirect()->back();
 }