I know a lot of Laravel developer makes use of $request->all()when making a POST request in Laravel.

So I did this website for a client and it has been live for some time, then suddenly the website became popular and hackers came to attack it, for weeks I kept fighting all forms of attack, what baffled me most is that the hacker keeps giving himself an admin account! yes, you read that right, he keeps granting himself an admin account.

I didn't know how he kept doing this, not until I went to the basics and started reading on all…


By default you can login with E-mail on laravel if you are using the default laravel auth system, and i have been seeing a lot of people asking me how they can change this and start login in with Username or E-mail at ate same time.

Well here is a very simple and straightforward way to do that,

Open you Login controller and type in this code:

public function login(Request $request)


$input = $request->all();

$this->validate($request, [

‘username’ => ‘required’,

‘password’ => ‘required’,


$fieldType = filter_var($request->username, FILTER_VALIDATE_EMAIL) ? ‘email’ : ‘username’;

if (auth()->attempt(array($fieldType => $input[‘username’], ‘password’ => $input[‘password’]))) {

Hello Everyone, This is my first Medium Post and i hope it can help someone,

i am assuming you want to upload a profile picture and you are on the Register controller and you have typed the input validation

now under the validation in the store method type type this:

if (request()->has(‘avatar’)) {

// this is assuming the file input field is named avatar

$avataruploaded = request()->file(‘avatar’);

$avatarname = time() .’.’. $avataruploaded->getClientOriginalExtension();

$avatarpath = public_path(‘/profile/’); //this will create a folder named profile in your public folder

$avataruploaded->move($avatarpath, $avatarname);

return User::create([ ‘fullname’ => $data[‘fullname’],

‘level’ => $data[‘level’],

‘avatar’=> ‘/profile/’ . $avatarname…

Adewale Ogundiran Charles

Full Stack Developer | Laravel(PHP) | Vue Js Developer | Frontend Developer | Backend Developer | WordPress Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store