File Manager Lite
Dir:
/home/u540325668/domains/mkjsindia.org/public_html-chash/app/Http/Controllers
Upload
[..]
Admin/
Rename
Del
Auth/
Rename
Del
Author/
Rename
Del
Controller.php (361 B)
Edit
Rename
Del
HomeController.php (651 B)
Edit
Rename
Del
Manager/
Rename
Del
Operator/
Rename
Del
User/
Rename
Del
followController.php (3.57 KB)
Edit
Rename
Del
frontEndController.php (8.05 KB)
Edit
Rename
Del
pagemgdController.php (4.77 KB)
Edit
Rename
Del
postmgdController.php (3.33 KB)
Edit
Rename
Del
welcomeController.php (3.67 KB)
Edit
Rename
Del
Edit: followController.php
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Follow; use Auth; use DB; class followController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function follow($id) { if(Auth::check()) { if(Follow::where('followuser_id', $id)->where('floweruser_id', Auth::user()->id )->first()){ $followid = Follow::where('followuser_id', $id)->where('floweruser_id', Auth::user()->id )->first(); $followdelete = Follow::find($followid->id); $followdelete->delete(); $notification = array('message' => 'You unfollow successfuly', 'alert-type' => 'error' ); return redirect()->back()->with($notification); } $follow = new Follow(); $follow->followuser_id = $id; $follow->floweruser_id = Auth::user()->id; $follow->save(); $notification = array('message' => 'You follow successfuly', 'alert-type' => 'success' ); return redirect()->back()->with($notification); } return redirect('/login'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function following($id) { if(Auth::check()){ if($followers = Follow::where('floweruser_id', $id)->first()){ $followers = DB::table('follows') ->where('floweruser_id', $id) ->join('users','users.id','=','follows.followuser_id') ->select('follows.*','users.id','users.name','users.image') ->paginate(20); return view('user.frontEnd.followInfo', ['followers' => $followers]); } $notification = array('message' => 'This user have no following any user', 'alert-type' => 'success' ); return redirect()->back()->with($notification); } return redirect('/login'); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function flower($id) { if(Auth::check()){ if($followers = Follow::where('followuser_id', $id)->first()){ $followers = DB::table('follows') ->where('followuser_id', $id) ->join('users','users.id','=','follows.floweruser_id') ->select('users.id','users.name','users.image') ->paginate(20); return view('user.frontEnd.followInfo', ['followers' => $followers]); } $notification = array('message' => 'This user have no follower', 'alert-type' => 'success' ); return redirect()->back()->with($notification); } return redirect('/login'); } public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }
Simpan