/** * Run the database seeds. * * @return void */ public function run() { $file = fopen(substr(__FILE__, 0, -4) . '.csv', 'r'); $headers = fgetcsv($file, 1024, ';'); while ($line = fgetcsv($file, 1024, ';')) { CrawledContent::create(array_combine($headers, $line)); } }
public function mostPopular($page, $resultsPerPage = null) { return $this->view('result', CrawledContent::popular()->select('crawled_contents.id', 'url', 'title', 'content', 'language', DB::raw('COUNT(log_outgoing_links.id) AS count'))->orderBy('count', 'desc')->paginatedData($page, $resultsPerPage, array('q' => '', 'pageUrl' => '/most-popular/%d{keepResultsPerPage}', 'resultsPerPageUrl' => '/most-popular/' . $page . '/%d'))); }