示例#1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $input = $request::all();
     $repost = new Repost($input);
     $repost->save();
     $userid = $repost->user_id;
     Auth::user()->reposts()->save($repost);
     return redirect('users');
 }
示例#2
0
 public function posted(Post $p)
 {
     $count = Repost::where('post_id', $p->id)->count();
     return $count > 0;
 }
示例#3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $a = Post::all()->lists('content');
     //array de contenidos
     $b = implode(" ", $a);
     // String completo
     $c = explode(" ", $b);
     // array de palabras
     $hola = 5;
     //funcion de filter
     $e = array_filter($c, function ($var) {
         return strlen($var) >= 4;
     });
     //funcion de filter
     $d = array_count_values($e);
     // array con su contador
     arsort($d);
     $arrays = array_slice($d, 0, 5);
     $user = User::where('name', $id)->first();
     $users = User::all();
     $reposts = Repost::where('user_id', $id)->get();
     $follows = Follow::where('userfolow_id', $id)->get();
     return view('users.show', compact('user', 'follows', 'users', 'reposts', 'arrays'));
 }