Hello everyone please i clone my KYC Page to Wallet Connect, were users can submit information and it would reflect on the admin side just as the KYC works,i have duplicated everything and changed the names were its applicable but i am getting errors from the client side and the admin side, please i would be happy if you can assist me it would go a long way
enter image description hereI tried adding a wallet connect to my HYIP website and it'senter image description here returning this error
compact('type', 'operator', 'query', 'boolean');
in /home/investmentsite/public_html/app/Http/Controllers/Backend/WalletController.php (line 108)
* #return Application|Factory|View / public function edit($id) { $Wallet = Wallet::find($id); return view('backend.wallet.edit', compact('wallet')); } /* * Remove the specified resource from storage. *
enter image description here
The problem is that you variable is uppercase while you are passing a lowercase variable so just do either one of the following
compact('Wallet');
or change the variable name
$wallet = (...)
return view(...)->compact('wallet');
UPDATE 1#:
So from your comment my guess is that this will be your solution
$wallet = Wallet::findOrFail($id);
return view('backend.wallet.edit', compact('wallet'));
Related
I am running into an issue where I'm getting the following error in my laravel.log file.
[2020-12-20 13:43:43] production.ERROR: URI must be a string or UriInterface
However my code works in development, which is super weird. I'm trying to figure out why this isn't working and i'm just really at a loss and no amount of googling or searching here has answered my question as to why in development vs production this error is occuring.
Heres my function:
/**
* Returns the user avatar or the placeholder avatar
* depending on the Discord Status Code
*
* #param \App\Models\Auth\User $user
* #return \Illuminate\Http\RedirectResponse|mixed|string
*/
public static function getUserAvatar(\App\Models\Auth\User $user) {
$client = new Client();
try {
$response = $client->head($user->avatar);
} catch(BadResponseException $e) {
return "https://dummyimage.com/128x128/888ea8/ebedf2.png?text=No+Image+Found";
}
if($response->getStatusCode() == 200) {
return $user->avatar;
} else {
return "https://dummyimage.com/128x128/888ea8/ebedf2.png?text=No+Image+Found";
}
}
The main functionality is this... whenever a User logs in, their avatar updates from discord (using socialite as the login provider). However if the user changes their avatar in discord, but hasn't logged into our site in a while, that avatar link will just go dead as discord no longer wants to serve it. So the avatar link returns a 404 code. I'm basically just trying to handle this 404 code and not display a broken image on the site. Rather it just be a placeholder image instead.
Edit: When i die and dump on $user->avatar I get the following result:
I've also tried the following as well to no avail:
$response = $client->request('GET', (string) $user->avatar, ['allow_redirects' => false, 'verify' => false]);
Thanks.
I'd like to customize the forgotten password form in Laravel.
When asking to reset the password, the user will have to answer a simple question (the name your first pet, the name of your childhood best friend, etc) besides inserting his/her email. This is to avoid other people asking password reset if they know the account's email, but are not the owner of the account.
I also would like to custom the errors messages to, actually, not show errors. For example, if an invalid email is inserted, it would not show the error message "We can't find a user with that e-mail address." I don't like it because someone may guess the email of a user by trying different emails until she/he stops getting the error message. Instead, I would like to show the message "If the information provided is correct, you will receive an email with the link to reset your password."
How to add these functionalities to Laravel auth?
I am looking for a solution that I don't have to create an entire login system from scratch (I think that if I try to design everything from scratch I'd probably miss something and create security vulnerabilities). I'd like to keep the Laravel auth system and just add these two features.
Feel free to suggest other ways to achieve the desired result and to make my question clearer. I'll appreciate that.
The good news is you don't need to rewrite everything.
The bad news is, you need to understand traits and how to extend/override them, which can be a little confusing.
The default controller that Laravel creates ForgotPasswordController doesn't do much. Everything it does is in the trait. The trait SendsPasswordResetEmails contains a few methods, most importantly for the validation in validateEmail method.
You can override this validateEmail method with one that checks for an answered question. You override traits by altering the 'use' statement.
For example change;
use SendsPasswordResetEmails
to:
use SendsPasswordResetEmails {
validateEmail as originValidateEmail
}
This will tell the code to re-name the original method validateEmail to originValidateEmail allowing you to create a new validateEmail in your own ForgotPasswordController.
You can then, inside ForgotPasswordController add a replacement which will be called by the default reset password code:
protected function validateEmail(Request $request)
{
// add in your own validation rules, etc.
$request->validate(['email' => 'required|email', 'questionfield' => 'required']);
}
To alter the error message, you can simply edit the language file found in resources/lang/en/passwords.php
Hope that helps.
Thanks to the user #Darryl E. Clarke, I managed to solve the problem. Here is what I did:
Add this line at the top of the file ForgotPasswordController, after namespace:
use App\User;
Add these 3 methods in the same file:
/**
* Send a reset link to the given user.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
public function sendResetLinkEmail(Request $request)
{
$this->validateRequest($request);
// We will send the password reset link to this user. Regardless if that
// worked, we will send the same response. We won't display error messages
// That is because we do not want people guessing the users' email. If we
// send an error message telling that the email is wrong, then a malicious
// person may guess a user' email by trying until he/she stops getting that
// error message.
$user = User::whereEmail($request->email)->first();
if ($user == null) {
return $this->sendResponse();
}
if ($user->secrete_question != $request->secrete_question) {
return $this->sendResponse();
}
$this->broker()->sendResetLink(
$this->credentials($request)
);
return $this->sendResponse();
}
/**
* Validate the given request.
*
* #param \Illuminate\Http\Request $request
* #return void
*/
protected function validateRequest(Request $request)
{
$request->validate(['email' => 'required|email', 'secrete_question' => 'required|string']);
}
/**
* Get the response for a password reset link.
*
* #return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
*/
protected function sendResponse()
{
$response = 'If the information provided is correct, you will receive an email with a link to reset your password.';
return back()->with('status', $response);
}
Customize it the way you want.
Hope that it will helps others!!
When I click on my first record to delete from my application, I get method not found error but when I click on another record apart from first one it easily gets deleted.
What is the issue?
Below is the code for Delete:
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
$video = Video::findOrFail($id);
$delete = $video->delete();
if ($delete){
return redirect()->back()->with('trueDelete','Data Not Deleted');
}else{
return redirect()->back()->with('falseDelete','Data Deleted Successfully');
}
}
While clicking on first record from list shows below error,
Route::get('delete-video/{id}','VideoController#destroy');
First of all, that is too much work you are putting into deleting the record. Check out the link below on the official docs to see how to delete in a single line.
https://laravel.com/docs/5.6/eloquent#deleting-models
As for the image, you have a
Method not allowed exception.
This means that, on the place you are deleting from link one, you are using a different route variable than the one specified in the web.php file. Check that you aren't confusing a GET and POST and/or PUT.
I am facing issue, I want to use different field name for password. let us say in users table, when I use this code with User model it works perfectly
/**
* Override required, otherwise existing Authentication system will not match credentials
* #return mixed
*/
public function getAuthPassword()
{
return $this->userPassword;
}
but when I use it with another Model let us say Customer model with same table structure , it doesnt work??!!! does anyone have idea about this issue
Thanks in advance.
In your config folder there is a file "auth.php" in this file you found authentication driver set to 'model' => 'App\User'
Instead of User you can use any of your model.
Hope this will help you :)
Does anybody know where I might find the functions for where a forgotten password reset link is generated in the email that is sent to the user?
For some odd reason mine is generating the reset password link with a different store view in the URL than the store view that was used to reset the password.
The link should be:
example.com/customer/account/resetpassword/?id=555&token=55555555555555555
But it is being generated as such:
example.com/otherStoreView/customer/account/resetpassword/?id=555&token=55555555555555555
To fix this, open the file "app\code\local\Mage\Customer\Model\Customer.php".
Look for the function sendPasswordResetConfirmationEmail(). It is near the line 685.
This function looks like this:
/**
* Send email with reset password confirmation link
*
* #return Mage_Customer_Model_Customer
*/
public function sendPasswordResetConfirmationEmail()
{
$storeId = $this->getStoreId();
if (!$storeId) {
$storeId = $this->_getWebsiteStoreId();
}
$this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
array('customer' => $this), $storeId);
return $this;
}
In this function, Magento is getting the store id where the user was registered, but we need the store id where he made the password reset request. We just need to remove some lines and add a new one:
public function sendPasswordResetConfirmationEmail()
{
# this will get the current store ID
$storeId = Mage::app()->getStore()->getStoreId();
$this->_sendEmailTemplate(self::XML_PATH_FORGOT_EMAIL_TEMPLATE, self::XML_PATH_FORGOT_EMAIL_IDENTITY,
array('customer' => $this), $storeId);
return $this;
}
This worked for me, I hope it helps.
The email template for that is:
app/locale/langcode_COUNRTYCODE/template/email/account_password_reset_confirmation.html
And the line that generates the URL is
{{store url="customer/account/resetpassword/" _query_id=$customer.id _query_token=$customer.rp_token}}