Esempio n. 1
0
public function getTeg($id){
try{
$teg = Teg::findOrFail($id);
return view('topics.index',[
'topics' => Topic::where('teg_id', $teg->id)->orderBy('id','desc')->paginate(),
'titlePage' => 'Статьи с меткой '.$teg->name,
]);
}catch(ModelNotFoundException $e){
return view('errors.404');
}
}
Esempio n. 2
0
 public function getIds($topic_names)
 {
     $topic_ids = [];
     if ($topic_names !== '') {
         foreach (explode(',', $topic_names) as $topic_name) {
             $topic = Topic::where('name', $topic_name)->get()->first();
             if (!$topic) {
                 $topic = new Topic(['name' => $topic_name]);
                 $topic->save();
             }
             $topic_ids[] = $topic->id;
         }
     }
     return $topic_ids;
 }
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //
        $published = Carbon::now();
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 1)->update(['title' => 'Staffing, Training &amp; Talent Retention', 'text' => '<ul>
	<li>- How to recruit and retrain technical staff</li>
	<li>- IT Talent and Training
		<ul>
			<li>Supply and demand of IT talent - how to attract new talent</li>
			<li>The need for more online and virtual IT training</li>
			<li>When to hire and what to look for in a Security Officer</li>
		</ul>
	</li>
	<li>- Talent Retention - Culture and challenges of keeping top talent from leaving</li>
</ul>', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 2)->update(['title' => 'Cyber Security', 'text' => '<ul>
	<li>- BYOD vs Corporate provided devices</li>
	<li>- Multi factor authentication and protecting mobile devices</li>
	<li>- How has web based application changed this paradigm</li>
</ul>', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 3)->update(['title' => 'The Value of IT Solutions', 'text' => '<ul>
	<li>- Office 365</li>
	<li>- Flash Storage</li>
	<li>- Cloud vs on premise</li>
</ul>', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 4)->update(['title' => 'Information Security', 'text' => '<ul>
	<li>- Adaptive security architecture to identify and counter evolving threats</li>
	<li>- Email Security - protocol and enforcement of personal email through corporate mail system</li>
	<li>- System ownership - the psychology of getting end users and operators to take ownership of applications</li>
	<li>- End user security awareness training</li>
</ul>', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 5)->update(['title' => 'Internet of Things', 'text' => '- The effect on businesses of devices being added to the corporate network infrastructure', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 6)->update(['title' => 'New Technology Trends', 'text' => '- This session will focus on new technologies that we can expect to see on the horizon', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '=', 7)->update(['title' => 'Business Continuity Disaster Recovery', 'text' => '<ul>
	<li>- Mitigating risk using cloud vs traditional brick and mortar</li>
	<li>- Resiliency - RPO and RTO, what are stated, tested and recoverable Standards</li>
</ul>', 'published' => $published]);
        Topic::where('conference_slug', '=', '2016/austin')->where('priority', '>', 7)->update(['published' => null]);
        Option::where('slug', '=', '2016/austin')->where('option', '=', 'show_topics')->update(['value' => 1, 'published' => $published]);
    }
 protected function conference($route, $event)
 {
     $venue = Venue::where('slug', '=', $event->venue_slug)->published()->get();
     $venue = !empty($venue[0]) ? (object) $venue[0]->toArray() : null;
     $options = Helpers::options($route, $event->slug, $event);
     //		dd($options);
     $navs = Helpers::navigation($route, $options);
     $sub = Helpers::navigation($route, $options, true);
     $partners = (object) ['companies' => null, 'text' => null];
     if (!empty($event->partners)) {
         $undo = Helpers::unserialize($event->partners);
         $companies = Partner::where(function ($query) use($undo) {
             foreach ($undo['partners'] as $i => $slug) {
                 if ($i === 0) {
                     $query->where('slug', '=', $slug);
                 } else {
                     $query->orWhere('slug', '=', $slug);
                 }
             }
         })->published()->orderBy('company')->get();
         if (!empty($undo['text'])) {
             $partners->text = $undo['text'];
         }
         if (is_object($companies)) {
             $partners->companies = [];
             foreach ($companies as $i => $company) {
                 $partners->companies[] = (object) $company->toArray();
             }
         }
     }
     $unfilteredTopics = Topic::where('conference_slug', '=', $event->slug)->published()->get();
     $topics = [];
     foreach ($unfilteredTopics as $topic) {
         $topics[] = [$topic->title => $topic->text];
     }
     if ((bool) $options->topics_by_alpha === true) {
         sort($topics);
     }
     //dd($topics);
     $agendasRaw = Agenda::where('conference_slug', '=', $event->slug)->published()->orderBy('timeslot')->orderBy('priority')->get();
     $speakerList = [];
     $agendas = [];
     if (is_object($agendasRaw)) {
         foreach ($agendasRaw as $i => $agenda) {
             $agenda = (object) $agenda->toArray();
             list($date, $time) = explode(' ', $agenda->timeslot);
             if (!empty($agenda->speakers)) {
                 //					$agenda->speakers = Helpers::unserialize($agenda->speakers);
                 //					dd($agenda->speakers);
                 $agendaSpeakers = explode(',', $agenda->speakers);
                 $agenda->speakers = [];
                 if (is_array($agendaSpeakers)) {
                     foreach ($agendaSpeakers as $s) {
                         @(list($speakerType, $speakerSlug) = @explode('|', $s));
                         $agenda->speakers[$speakerType][] = $speakerSlug;
                     }
                     //							dd($agenda->speakers);
                 }
             }
             $agendas[$date][$time][] = $agenda;
             if (!empty($agenda->speakers)) {
                 $speakersTypes = $agenda->speakers;
                 if (is_array($speakersTypes)) {
                     ksort($speakersTypes);
                     //						dd($speakersTypes);
                     foreach ($speakersTypes as $speakers) {
                         $speakerList = array_merge($speakerList, $speakers);
                     }
                 }
             }
         }
     }
     //		dd($agendas);
     if (count($speakerList) > 0) {
         $speakers = Speaker::where(function ($query) use($speakerList) {
             $query->where('slug', '=', array_pop($speakerList));
             while (count($speakerList) > 0) {
                 $query->orWhere('slug', '=', array_pop($speakerList));
             }
         })->published()->orderBy('last_name')->get();
         $speakers = Helpers::keysByField($speakers, 'slug', function ($value, $key, $field, $array, $toObj) {
             $value->sessions = [];
             return $value;
         }, true);
     }
     if ((bool) $options->sponsor_levels === true) {
         $sponsors = Lookup::lookup('sponsors', ['conference_slug' => $event->slug], ['published' => true, 'sponsorlevels' => true]);
     } else {
         $sponsors = Lookup::lookup('sponsors', ['conference_slug' => $event->slug], ['published' => true]);
     }
     //		dd($options);
     return view('pages/conference', compact('event', 'venue', 'partners', 'topics', 'agendas', 'speakers', 'sponsors', 'options', 'navs', 'sub'));
 }
Esempio n. 5
0
 static function getProductTopics($id, $limit = 20)
 {
     return Topic::where('product_id', $id)->orderBy('created_at', 'desc')->paginate($limit);
 }