Enabling email verification in laravel 5.2 - InvalidArgumentException in FileViewFinder.php - laravel-5

To enable email verification in laravel 5.2 , I found this error :
InvalidArgumentException in FileViewFinder.php line 137: View [**Activate account** <ahref="http:..localhost:8000.user.activation.3223338c9bef4f1ea34e4caff92fff2497c5c94b77e2665bfc975a9684df6e32">click here<.a>] **not found**.
I used
$link = route('user.activate', $token);
$message = sprintf('**Activate account** %s', $link, $link);
$this->mailer->send($message , [$message], function (Message $m) use ($user)
{
$m->to($user->email)->subject('Activation mail');
I used this route:
Route::get('user/activation/{token}', 'Auth\AuthController#activateUser')->name('user.activate');

Related

Laravel abort( 404 ) Throwing NotFoundHttpException

When using the following Laravel helper function in a view:
abort( 404 );
Instead of displaying the default Laravel 404 error page, I'm getting:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Stack Trace:
public function abort($code, $message = '', array $headers = [])
{
if ($code == 404) {
throw new NotFoundHttpException($message);
}
throw new HttpException($code, $message, null, $headers);
}
How can I get abort( 404 ); to display the stock Laravel 404 error page?

POST: 500 Internal Server Error from Messenger Bot in laravel

I setup my Webhok by Ngrok URL for my Facebook page, and I applied all of the requirements for the Messenger Platform, but when I send the messages to my Facebook page I encounter the following error:
POST /Facebook_Messenger_Token 500 Internal Server Error
and in routs file in Laravel I use Get and Post functions as follow:
Route::get('Facebook_Messenger_Token', 'MessengerController#index');
Route::post('Facebook_Messenger_Token', 'MessengerController#index');
When I send the messages I get the following error in storage/app.logs/laravel:
[2020-06-08 18:44:21] local.ERROR: Undefined variable: id {"exception":"[object] (ErrorException(code: 0): Undefined variable: id at C:\\xampp\\htdocs\\AzadApp\\app\\Http\\Controllers\\MessengerController.php:17)
[stacktrace]
my public function index:
public function index()
{
// here we can verify the webhook.
// i create a method for that.
$this->verifyAccess();
$user = json_decode($this->getUser($id)); --this is line 17
$input = json_decode(file_get_contents('php://input'), true);
$id = $input['entry'][0]['messaging'][0]['sender']['id'];
$message = $input['entry'][0]['messaging'][0]['message']['text'];
$response = [
'recipient' => ['id' => $id ],
'message' => ['text' => "Thanks for watching {$user->first_name} {$user->last_name}! :)"]
];
$this->sendMessage($response);
}
Please support and thanks.
The $id is being defined on line 19 (that is after line 17). in order to use it on
$user = json_decode($this->getUser($id));
you should place the above line after line 19
$id = $input['entry'][0]['messaging'][0]['sender']['id'];
do not move line 19 up (as i said in my comment) instead move line 17 down since
$id = $input['entry'][0]['messaging'][0]['sender']['id'];
is using $input that is defined before.
all you have to do is move line 17 under line 19.
so the full function now should look like this:
public function index()
{
// here we can verify the webhook.
// i create a method for that.
$this->verifyAccess();
$input = json_decode(file_get_contents('php://input'), true);
$id = $input['entry'][0]['messaging'][0]['sender']['id'];
$message = $input['entry'][0]['messaging'][0]['message']['text'];
$user = json_decode($this->getUser($id));
$response = [
'recipient' => ['id' => $id ],
'message' => ['text' => "Thanks for watching {$user->first_name} {$user->last_name}! :)"]
];
$this->sendMessage($response);
}

When i am trying to send mail from contactUS form getting this error using swiftmailer in Laravel 5.2

when i am trying to send Mail through Contact Us Form receiving this Error
"Address in mailbox given [] does not comply with RFC 2822, 3.6.2."
I try search to find solution but I cannot find one. I edited config/mail.php
public function sendContactInfo(ContactMeRequest $request)
{
$data = $request->only('name', 'email');
$emailto="******#gmail.com";
$data['messageLines'] = explode("\n", $request->get('message'));
Mail::send('publicPages.contactus', $data, function ($message) use ($emailto) {
$message->subject('Contact Us Form: ')
->to(config('blog.contact_email'))
->replyTo($data['email']);
});
return back()
->withSuccess("Thank you for your message. It has been sent.");
}
with configuration file
i am following this tutorial
Laravel Send Mail
use $data['email']
Mail::send('publicPages.contactus', $data, function ($message) use ($emailto,$data['email']) {
$message->subject('Contact Us Form: ')
->to(config('blog.contact_email'))
->replyTo($data['email']);
});

RequestException while sending Plivo sms in latest laravel 5.1.26

I am doing project in laravel. I followed all the steps mentioned in
plivo.com .
As I had done same steps in my another old project and this worked perfectly, but after updating my composer its not working and throwing same error message as like my new laravel project. Error message is as follow,
Fatal error: Uncaught exception 'GuzzleHttp\Exception\RequestException' with message 'cURL error 60: SSL certificate problem: self signed certificate in certificate chain
My Plivo folder is inside the root folder. Guzzle installed is "guzzlehttp/guzzle": "v6.1.1".
composer.json is,
{
"require": {
"plivo/plivo-php": "~1.1.0"
}
}
Controller.php
<?php
namespace App\Http\Controllers;
use Plivo;
public function signup(Request $request){
$number = $request->input('owner_phone');
$output = $this->validatenumber($number);
}
public function validatenumber($number){
$auth_id = "MAZJFKNTU3OGQ5NMM5YJ";
$auth_token = "NDcyYjU5NmMxMmQzMzYzMjIzODExMTg3NzZmOWVj";
$p = new Plivo\RestAPI($auth_id, $auth_token);
$params = array(
'src' => '14154847489', // Sender's phone number with country code
'dst' => '91'.$number, // Receiver's phone number with country code
'text' => 'Your TaaraGo verification code is '.$otpnumber. '.', // Your SMS text message
'url' => 'http://localhost/untitled/sentsms.php', // The URL to which with the status of the message is sent
'method' => 'POST' // The method used to call the url
);
return $response = $p->send_message($params);
}
?>
and route.php is,
Route::post('auth/signup', 'AuthController#signup');
Is there any solution to this problem? any one having same problem with laravel version 5.1.26, give me solution.

Socialite Library throwing error curl_reset() undefined in laravel 5

I am using socialite package with my laravel 5 project. I am hosting my site in hostgator. I have checked thrice that my php version in hostgator is 5.5.22 .
But still i am getting this error.
FatalErrorException in CurlFactory.php line 69:
Call to undefined function GuzzleHttp\Handler\curl_reset()
in CurlFactory.php line 69
I have tried Facebook as well as Google plus login using socialite but in both cases when redirects to my controller/function it throws this error.
Please help me. What can be possible errors
My Auth controller functions are
public function getFacebookLogin(){
return Socialite::driver('facebook')->redirect();
}
public function getHandleFbLogin(){
//echo "hey";
$user = Socialite::driver('facebook')->user();
print_r($user);
}
public function getGoogleLogin(){
return Socialite::driver('google')->redirect();
}
public function getHandleGpLogin(){
echo "hey";
$user = Socialite::driver('google')->user();
print_r($user);
}
I am very new to Stackoverflow. I also got stucked in this, so I did the following :-
Go to
/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
line no. 69 and replace
curl_reset($resource);
with
curl_setopt($resource, CURLOPT_HTTPGET, 1);
curl_setopt($resource, CURLOPT_POST, false);

Resources