for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Controllers;
use App\Models\Ban;
use App\Models\User;
use Illuminate\Http\Request;
class UserBanController extends Controller
{
public function __construct()
$this->middleware('permission:admin-user');
}
public function show($userid)
$user = User::whereId($userid)->first();
return view('users.ban.show', [
'user' => $user,
]);
public function ban(Request $request, $userid)
$exp = 0;
if ($request->exists('forever')) {
$exp = '+ 150 years';
} elseif ($request->exists('aday')) {
$exp = '+1 day';
} elseif ($request->exists('aweek')) {
$exp = '+1 week';
} elseif ($request->exists('amonth')) {
$exp = '+1 month';
$user->ban([
'comment' => $request->get('banreason'),
'expired_at' => $exp,
return redirect(action('UserBanController@show', $userid));
public function unban(Request $request, $userid)
$request
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$user->unban();
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.