public function index()
 {
     $analytics = new Analytics();
     $optimalTweetTime = $analytics->optimalTweetTime();
     $tweets = Tweet::all();
     return view('tweets.index', ['tweets' => $tweets, 'time' => $optimalTweetTime]);
 }
 public function gestionesRealizadasExport(Request $request)
 {
     Excel::create('Gestiones Realizadas', function ($excel) {
         $excel->sheet('Gestiones', function ($sheet) {
             $tweets = Tweet::all();
             $sheet->fromArray($tweets, null, 'A1', false, false);
         });
     })->export('csv');
 }
예제 #3
0
 public function getLengthOfTweets()
 {
     $tweets = Tweet::all();
     $tweet_lengths = [];
     foreach ($tweets as $tweet) {
         $len = strlen($tweet->getAttribute('text'));
         array_push($tweet_lengths, $len);
     }
     return $tweet_lengths;
 }
예제 #4
0
 public function index()
 {
     $tweet_all = Tweet::all();
     $follow_all = Follow::all();
     $user_follow = $follow_all->filter(function ($item) {
         return $item['user_id'] == Auth::user()->id;
     })->pluck('follow_id');
     $data['tweets'] = $tweet_all;
     $data['followed'] = $user_follow->toArray();
     return view('tweet/home', $data);
 }
예제 #5
0
 public function getall()
 {
     return Tweet::all();
 }
예제 #6
-1
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $tweets = Tweet::all();
     $words = [];
     $aux = [];
     if ($tweets->count() != 0) {
         foreach ($tweets as $tweet) {
             $aux = (array) $tweet->tweet;
             $aux = $aux[0];
             $aux = str_replace(',', '', $aux);
             $aux = explode(' ', $aux);
             $words = array_merge($aux, $words);
         }
         $words = array_count_values($words);
         arsort($words);
         $words = array_keys($words);
         $aux = [];
         for ($i = 0; $i < sizeof($words); $i++) {
             if (strlen($words[$i]) > 3) {
                 $aux[] = $words[$i];
             }
         }
     }
     $words = $aux;
     $user = Auth::user();
     return view('home', compact('user', 'words'));
 }