Elbar /
InvestMe
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | namespace App\Http\Controllers; |
||
| 4 | |||
| 5 | use App\Backer; |
||
| 6 | use App\Category; |
||
| 7 | use App\Comment; |
||
| 8 | use App\Creator; |
||
| 9 | use App\Project; |
||
| 10 | use Illuminate\Foundation\Auth\User; |
||
| 11 | use Illuminate\Http\Request; |
||
| 12 | use Illuminate\Support\Facades\DB; |
||
| 13 | use Illuminate\Support\Facades\Session; |
||
| 14 | |||
| 15 | class AdminController extends Controller |
||
| 16 | {
|
||
| 17 | /** |
||
| 18 | * Display a listing of the resource. |
||
| 19 | * |
||
| 20 | * @return \Illuminate\Http\Response |
||
| 21 | */ |
||
| 22 | public function index() |
||
| 23 | {
|
||
| 24 | $users = User::all(); |
||
| 25 | $count = $users->count(); |
||
| 26 | $projects = Project::all(); |
||
| 27 | $comments = Comment::all(); |
||
| 28 | $categories = Category::all(); |
||
| 29 | $backers = Backer::all(); |
||
| 30 | $creators = Creator::all(); |
||
| 31 | $commentLast = Comment::all()->take(4); |
||
| 32 | return view('Admin.index',compact('creators','count','projects','comments','categories','backers','commentLast'));
|
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Show the form for creating a new resource. |
||
| 37 | * |
||
| 38 | * @return \Illuminate\Http\Response |
||
| 39 | */ |
||
| 40 | public function create() |
||
| 41 | {
|
||
| 42 | // |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Store a newly created resource in storage. |
||
| 47 | * |
||
| 48 | * @param \Illuminate\Http\Request $request |
||
| 49 | * @return \Illuminate\Http\Response |
||
| 50 | */ |
||
| 51 | public function store(Request $request) |
||
|
0 ignored issues
–
show
|
|||
| 52 | {
|
||
| 53 | // |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Display the specified resource. |
||
| 58 | * |
||
| 59 | * @param int $id |
||
| 60 | * @return \Illuminate\Http\Response |
||
| 61 | */ |
||
| 62 | public function show($id) |
||
|
0 ignored issues
–
show
|
|||
| 63 | {
|
||
| 64 | // |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Show the form for editing the specified resource. |
||
| 69 | * |
||
| 70 | * @param int $id |
||
| 71 | * @return \Illuminate\Http\Response |
||
| 72 | */ |
||
| 73 | public function edit($id) |
||
|
0 ignored issues
–
show
|
|||
| 74 | {
|
||
| 75 | // |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * Update the specified resource in storage. |
||
| 80 | * |
||
| 81 | * @param \Illuminate\Http\Request $request |
||
| 82 | * @param int $id |
||
| 83 | * @return \Illuminate\Http\Response |
||
| 84 | */ |
||
| 85 | public function update(Request $request, $id) |
||
|
0 ignored issues
–
show
|
|||
| 86 | {
|
||
| 87 | // |
||
| 88 | } |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Remove the specified resource from storage. |
||
| 92 | * |
||
| 93 | * @param int $id |
||
| 94 | * @return \Illuminate\Http\Response |
||
| 95 | */ |
||
| 96 | public function destroy($id) |
||
|
0 ignored issues
–
show
|
|||
| 97 | {
|
||
| 98 | // |
||
| 99 | } |
||
| 100 | |||
| 101 | public function users(){
|
||
| 102 | $users = User::all(); |
||
| 103 | return view('Admin.users',compact('users'));
|
||
| 104 | } |
||
| 105 | |||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
62% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 106 | public function users_id($id){
|
||
| 107 | $users = User::all(); |
||
| 108 | $user = User::find($id); |
||
| 109 | return view('Admin.edit',compact('users','user'));
|
||
| 110 | } |
||
| 111 | |||
| 112 | public function users_id_post(Request $request, $id){
|
||
| 113 | // $user = User::find($id); |
||
| 114 | // $user->update([ |
||
| 115 | // 'name' => $request['name'], |
||
| 116 | // 'email' => $request['email'], |
||
| 117 | // 'isBacker' => $request['isBacker'], |
||
| 118 | // 'isCreator' => $request['isCreator'], |
||
| 119 | // 'isAdmin' => $request['isAdmin'], |
||
| 120 | // 'isModer' => $request['isModer'], |
||
| 121 | // 'isActive' => $request['isActive'], |
||
| 122 | // ]); |
||
| 123 | $data = [ |
||
| 124 | 'name' => $request['name'], |
||
| 125 | 'email' => $request['email'], |
||
| 126 | 'isBacker' => $request['isBacker'], |
||
| 127 | 'isCreator' => $request['isCreator'], |
||
| 128 | 'isAdmin' => $request['isAdmin'], |
||
| 129 | 'isModer' => $request['isModer'], |
||
| 130 | 'isActive' => $request['isActive'] |
||
| 131 | ]; |
||
| 132 | $i = DB::table('users')->where('id',$id)->update($data);
|
||
|
0 ignored issues
–
show
$i is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 133 | Session::flash('message','Successfully updated');
|
||
| 134 | return redirect(route('users'));
|
||
| 135 | } |
||
| 136 | |||
| 137 | public function users_delete($id){
|
||
| 138 | User::destroy($id); |
||
| 139 | Session::flash('message','Successfully deleted');
|
||
| 140 | return redirect(route('users'));
|
||
| 141 | } |
||
| 142 | } |
||
| 143 |