-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into admin_module
- Loading branch information
Showing
62 changed files
with
17,939 additions
and
11,101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,52 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
use App\Models\Meo; | ||
use Validator; | ||
|
||
use Illuminate\Support\Facades\Hash; | ||
use App\Http\Requests\loginForm; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\DB; | ||
use App\Models\loginModel; | ||
use App\Models\usersModel; | ||
use App\Models\requestsModel; | ||
|
||
class loginController extends Controller | ||
class LoginMeoController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
return view("login.login"); | ||
} | ||
public function logout(Request $req) | ||
{ | ||
$req->session()->flush(); | ||
return redirect("/login"); | ||
return view("login.index"); | ||
} | ||
public function loginVarify(loginForm $req) | ||
{ | ||
$user_name = $req->user_name; | ||
$password = bcrypt($req->password); | ||
|
||
$user = loginModel::where('user_name', $user_name) | ||
->first(); | ||
|
||
//checking users | ||
if ($user) { | ||
//checking account status | ||
if ($user['account_Status'] == 'pending') { | ||
public function verify (Request $req) | ||
|
||
$req->session()->flash('msg', 'Your account is in pending'); | ||
return redirect()->route('login.login'); | ||
} elseif ($user['account_Status'] == 'Block') { | ||
|
||
$req->session()->flash('msg', 'Your account is Blocked'); | ||
return redirect()->route('login.login'); | ||
} else { | ||
{ | ||
$validation = Validator::make($req->all(), [ | ||
'user_name' => 'required', | ||
'password' => 'required|min:5', | ||
]); | ||
|
||
if (Hash::check($req->password, $user['password'])) { | ||
if ($user['user_type'] == 'admin') { | ||
$req->session()->put('status', true); | ||
$req->session()->put('user_name', $req->user_name); | ||
$req->session()->put('user_id', $user['id']); | ||
$req->session()->put('user_type', $user['user_type']); | ||
return redirect()->route('user.dashbord'); | ||
} elseif ($user['user_type'] == 'clients') { | ||
// client | ||
$req->session()->put('status', true); | ||
$req->session()->put('user_name', $req->user_name); | ||
$req->session()->put('user_id', $user['id']); | ||
$req->session()->put('user_type', $user['user_type']); | ||
return redirect()->route('client.index'); | ||
} elseif ($user['user_type'] == 'bank_manager') { | ||
//code | ||
} elseif ($user['user_type'] == 'noney_exchange_officer') { | ||
//code | ||
} else { | ||
$req->session()->flash('msg', 'invaild request'); | ||
return redirect()->route('login.login'); | ||
} | ||
} else { | ||
$req->session()->flash('msg', 'invaild User Name or password'); | ||
return redirect()->route('login.login'); | ||
} | ||
} | ||
} else { | ||
$req->session()->flash('msg', 'invaild User Name or password'); | ||
return redirect()->route('login.login'); | ||
} | ||
} | ||
public function dashbord() | ||
{ | ||
return view("user.index"); | ||
} | ||
public function signUP() | ||
|
||
if ($validation->fails()) | ||
{ | ||
return view('registration.register'); | ||
return back() | ||
->with ('errors',$validation->errors()) | ||
->withInput(); | ||
} | ||
|
||
$user=Meo::where ('user_name',$req->user_name) | ||
->where ('password',$req->password) | ||
->where ('user_type',$req->user_type) | ||
->first(); | ||
|
||
if (count ((array)$user)>0 ) | ||
{ | ||
$req->session()-> put('name',$req->user_name); | ||
$req->session()-> put('user_type',$req->user_type); | ||
$req->session()->put('password', $req->password); | ||
return redirect ('/homeMeo'); | ||
} | ||
|
||
else{ | ||
$req->session()->flash('msg','Name Or Password is Wrong'); | ||
return redirect('/login/meo'); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class editprofile extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize() | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
'address' => ['required', 'min:5', 'max:50'], | ||
'user_name' => ['required', 'min:3', 'max:10', 'unique:users'], | ||
'email' => ['required', 'email', 'unique:users', 'min:8', 'max:30', 'email:rfc'], | ||
'phone_number' => ['required', 'min:11', 'max:15'] | ||
]; | ||
} | ||
|
||
public function messages() | ||
{ | ||
return [ | ||
'email.email' => 'Invalid email address', | ||
'user_name.required' => 'User Name required ', | ||
'email.required' => 'Email required ', | ||
'phone_number.required' => 'Phone Number required ' | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.