Beispiel #1
0
 /**
  * Display the specified resource.
  *
  * @return Response
  */
 public function show()
 {
     $offset = Input::get('offset');
     $news = App\News::latest('created_at')->skip($offset)->take(6)->get();
     \DB::table('news')->count() > 7 + $offset ? $hide = false : ($hide = true);
     foreach ($news as $item) {
         $item['url'] = IndexController::translitURL($item['title']);
         $item['created'] = IndexController::restyleDate($item['created_at']);
     }
     return ['news' => $news, 'hide' => $hide];
 }
Beispiel #2
0
 public static function toAlias2($string)
 {
     $tmp = array("”", "–", "~", "`", "!", "@", "#", "\$", "%", '%', "^", "&", "*", "(", ")", "-", "_", "=", "+", "{", "[", "]", "}", "|", "\\", ":", ";", "'", "\"", "<", ",", ">", ".", "?", "/");
     $string = mb_strtolower($string, "UTF-8");
     $string = IndexController::tranferData2($string);
     $string = strip_tags($string);
     $string = trim($string, " \n\t.");
     $string = str_replace($tmp, "", $string);
     $arr = explode(" ", $string);
     $string = "";
     foreach ($arr as $key) {
         if (!empty($key)) {
             $string .= "-" . preg_replace('/[^A-Za-z0-9\\-]/', '', $key);
         }
     }
     $string = str_replace("-–-", "", $string);
     return mb_strtolower(substr($string, 1));
 }
Beispiel #3
0
 public function search($pattern)
 {
     /*if(!Session::has('ID_User')){
     			return view('login-form');
     		}else{*/
     $path = public_path() . DIRECTORY_SEPARATOR . 'videos' . DIRECTORY_SEPARATOR;
     //global $result;
     IndexController::find_file($path, $pattern);
     //$path = public_path().DIRECTORY_SEPARATOR.'videos';
     //var_dump($result);
     return View::make('Index/search')->with('result', IndexController::$result)->with('path', $path)->with('pattern', $pattern)->render();
     //}
 }