Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public static function tracker()
 {
     $keywords = Keywords::all();
     $referents = TwitterReferent::all();
     $match = Self::referentTracker($keywords, $referents);
     return $match;
 }
Пример #2
0
 public function index()
 {
     $keywords = Keywords::all();
     $user = $this->checkUserDetails();
     return view('admin.keywords', compact('keywords', 'user'));
 }
Пример #3
0
 /**
  *
  * Create new tag in database and attach it to movie
  * @return Response
  *
  */
 public function addNewTag()
 {
     if ($this->isAdmin) {
         if (Request::ajax()) {
             $data = Request::all();
             $movie_id = $data['id'];
             $word = ucwords(strtolower(trim($data['word'])));
             if ($word !== "") {
                 if (!Keywords::where('word', $word)->exists()) {
                     $created = Keywords::create(['word' => $word]);
                     DB::table('tags')->insert(['movie_id' => $movie_id, 'keyword_id' => $created->keyword_id]);
                     $app = app();
                     $options = $app->make('stdClass');
                     $tags = DB::table('tags')->where('movie_id', $movie_id)->lists('keyword_id');
                     $options->keywords = Keywords::all();
                     foreach ($options->keywords as $keyword) {
                         $keyword->selected = in_array($keyword->keyword_id, $tags) ? true : false;
                     }
                     return (string) view('movies.tags', compact('options'));
                 }
                 return "exists";
             }
             return "blank";
         }
     }
     return "error";
 }