results for blacklist search
This commit is contained in:
@@ -112,13 +112,41 @@ class BlacklistController extends Controller
|
|||||||
|
|
||||||
//Validate the input from the form
|
//Validate the input from the form
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'name' => 'required',
|
'parameter' => 'required',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Get the data being requested
|
$blacklistName = BlacklistUser::where(['name', 'like', $request->parameter])->get();
|
||||||
$blacklistCount = BlacklistUser::where([
|
$blacklistAlt = BlacklistUser::where(['alts', 'like', $request->parameter])->get();
|
||||||
'name' => $request->name,
|
$blacklistReason = BlacklistUser::where(['reason', 'like', $request->paraemter])->get();
|
||||||
])->count();
|
|
||||||
|
$blacklist = new BlacklistUser;
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach($blacklistName as $bl) {
|
||||||
|
$blacklist[$i]->character_id = $bl->character_id;
|
||||||
|
$blacklist[$i]->name = $bl->name;
|
||||||
|
$blacklist[$i]->reason = $bl->reason;
|
||||||
|
$blacklist[$i]->alts = $bl->alts;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($blacklistAlt as $bl) {
|
||||||
|
$blacklist[$i]->character_id = $bl->character_id;
|
||||||
|
$blacklist[$i]->name = $bl->name;
|
||||||
|
$blacklist[$i]->reason = $bl->reason;
|
||||||
|
$blacklist[$i]->alts = $bl->alts;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($blacklistReason as $bl) {
|
||||||
|
$blacklist[$i]->character_id = $bl->character_id;
|
||||||
|
$blacklist[$i]->name = $bl->name;
|
||||||
|
$blacklist[$i]->reason = $bl->reason;
|
||||||
|
$blacklist[$i]->alts = $bl->alts;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$blacklistCount = $i;
|
||||||
|
|
||||||
//If the count for the blacklist is greater than 0, then get the details, and send it to the view
|
//If the count for the blacklist is greater than 0, then get the details, and send it to the view
|
||||||
if($blacklistCount > 0) {
|
if($blacklistCount > 0) {
|
||||||
@@ -127,13 +155,13 @@ class BlacklistController extends Controller
|
|||||||
|
|
||||||
//Send the data to the view
|
//Send the data to the view
|
||||||
return view('blacklist.list')->with('blacklist', $blacklist)
|
return view('blacklist.list')->with('blacklist', $blacklist)
|
||||||
->with('success', 'Name was found on the blacklist');
|
->with('success', 'Results were found on the blacklist');
|
||||||
} else {
|
} else {
|
||||||
//If they aren't found, then null out the blacklist variable, and send to the view
|
//If they aren't found, then null out the blacklist variable, and send to the view
|
||||||
$blacklist = null;
|
$blacklist = null;
|
||||||
|
|
||||||
return view('blacklist.list')->with('blacklist', $blacklist)
|
return view('blacklist.list')->with('blacklist', $blacklist)
|
||||||
->with('error', 'Name was not found on the blacklist.');
|
->with('error', 'Results were not found on the blacklist.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
{!! Form::open(['action' => 'Blacklist\BlacklistController@SearchInBlacklist', 'method' => 'POST']) !!}
|
{!! Form::open(['action' => 'Blacklist\BlacklistController@SearchInBlacklist', 'method' => 'POST']) !!}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ Form::label('name', 'Character Name') }}
|
{{ Form::label('parameter', 'Seach Parameter') }}
|
||||||
{{ Form::text('name', '', ['class' => 'form-control']) }}
|
{{ Form::text('parameter', '', ['class' => 'form-control']) }}
|
||||||
</div>
|
</div>
|
||||||
{{ Form::submit('Search', ['class' => 'btn btn-primary']) }}
|
{{ Form::submit('Search', ['class' => 'btn btn-primary']) }}
|
||||||
{!! Form::close() !!}
|
{!! Form::close() !!}
|
||||||
|
|||||||
Reference in New Issue
Block a user