Open estelle-zeuk opened 3 years ago
Hi, currently the project would match any route and handle the request in the phpagebuilder router to load and construct the right page. So that could be why your Laravel controller is not reached. Although your routes.php
file should be matched before the Laravel Pagebuilder's routes.php
, so maybe you can check whether that is the case.
Alternatively you could also use a custom Laravel controller to render all pagebuilder pages, see here. In that case you have more control over the routes and the order in which they are matched.
Or you could create a controller.php file in your contact block and handle the form over there.
Thank you @HansSchouten I will try it
Hi all!!! I tried to send data to my controller, even to a simple php page, but my ajax call is empty with the status ok! I don't understand @HansSchouten
Possibly you are sending the request to an URL that does not exist and the router of PHPageBuilder routes this request to an empty error page. Do you have a page with the route /*, this is a catch all that might handle the request right now.
Or you could create a controller.php file in your contact block and handle the form over there. I have done this, but, still, the data are not being sent to my php file @HansSchouten
So if you try using an exit(); in the handleRequest method of the controller you have created, the pages with that block should all react and become empty. If that works you might need to check the link you are using in the request.
Hello everyone! I've had a contact block in my pagebuilder, and i would like to the user input and send them by mail, but i'm stuck. The controller i've created is not reached.
This is my controller `namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller; use Illuminate\Http\Request;
class ContactController extends Controller { public function contact(Request $request){ $inputs = $request->all(); dd('testons'); try { $email = "essytelle@gmail.com"; //$view = 'landing-page.email'; //dd($inputs['subject']); / \Mail::send($view, compact('inputs'), function ($message) use ($email, $inputs) { $message->to($email, 'Equipe vente')->subject($inputs['subject']); }); /
}` Need your help please @HansSchouten