/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $speakers = $this->getSpeakers();
     foreach ($speakers as $speaker) {
         Speaker::create(['name' => $speaker]);
     }
 }
示例#2
0
 public function getSpeakerFile(Request $request)
 {
     $speaker = Speaker::select('file_id')->where('slug', $request->slug)->first();
     if (count($speaker->file)) {
         $speaker->file_name = $speaker->file->name;
     }
     return response()->json($speaker);
 }
示例#3
0
 /**
  * @param array $talk
  * @return Talk
  */
 private function createTalk($talk)
 {
     $data = ['is_talk' => (int) $talk['is_talk'], 'track' => (int) $talk['track'] > 0 ? (int) $talk['track'] : null, 'title' => $talk['title'], 'starts_at' => $talk['starts_at'], 'ends_at' => $talk['ends_at']];
     if (isset($talk['author']) && ($speaker = Speaker::whereName($talk['author'])->first())) {
         return $speaker->talks()->create($data);
     }
     return Talk::create($data);
 }
示例#4
0
 public function getIndex()
 {
     $banners = File::where('img_type', 'banner')->where("created_at", "like", $this->year . "%")->get();
     $speakers = Speaker::where("created_at", "like", $this->year . "%")->limit(4)->get();
     $cooperations = File::where('img_type', 'cooperation')->where("created_at", "like", $this->year . "%")->get();
     $supporteds = File::where('img_type', 'supported')->where("created_at", "like", $this->year . "%")->get();
     $organizeds = File::where('img_type', 'organized')->where("created_at", "like", $this->year . "%")->get();
     $news = News::where('is_hide', 0)->where("created_at", "like", $this->year . "%")->orderBy('id', 'desc')->limit(4)->get();
     return view('frontend.home.index', compact('banners', 'speakers', 'cooperations', 'supporteds', 'organizeds', 'news'))->with('year', $this->curYear);
 }
 public function postDelete(Request $request)
 {
     $file = Speaker::find($request->get('id'))->delete();
     return response()->json(['status' => 'success'], 200);
 }
 public function get($id)
 {
     $speaker = Speaker::findOrFail($id);
     return $speaker;
 }