<?php
namespace App\Http\Controllers\Admin\Auth;
use Backpack\CRUD\app\Http\Controllers\Auth\RegisterController as BackpackRegisterController;
class RegisterController extends BackpackRegisterController
{
/**
* Get a validator for an incoming registration request.
*
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
$user_model_fqn = config('backpack.base.user_model_fqn');
$user = new $user_model_fqn();
$users_table = $user->getTable();
$email_validation = backpack_authentication_column() == 'email' ? 'email|' : '';
return Validator::make($data, [
'first_name' => 'required|max:255',
'last_name' => 'required|max:255',
backpack_authentication_column() => 'required|'.$email_validation.'max:255|unique:'.$users_table,
'password' => 'required|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
*
* @return User
*/
protected function create(array $data)
{
$user_model_fqn = config('backpack.base.user_model_fqn');
$user = new $user_model_fqn();
return $user->create([
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
backpack_authentication_column() => $data[backpack_authentication_column()],
'password' => bcrypt($data['password']),
]);
}
}
I always get the error:
UnexpectedValueException
Invalid route action: [App\Http\Controllers\Admin\Auth\RegisterController].
at vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php:91
87| */
88| protected static function makeInvokable($action)
89| {
90| if (! method_exists($action, '__invoke')) {
> 91| throw new UnexpectedValueException("Invalid route action: [{$action}].");
92| }
93|
94| return $action.'@__invoke';
95| }
• `App\Http\Controllers\Admin\Auth\RegisterController` was not found: Controller class `App\Http\Controllers\Admin\Auth\RegisterController` for one of your routes was not found. Are you sure this controller exists and is imported correctly?
+8 vendor frames
9 routes/backpack/custom.php:8
Illuminate\Support\Facades\Facade::__callStatic("get")
+11 vendor frames
21 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(Backpack\CRUD\BackpackServiceProvider))
use App\Http\Controllers\Admin\Auth\RegisterController;
Route::get('admin/register', [RegisterController::class, 'showRegistrationForm'])->name('backpack.auth.register');
Thanks for the Say. However, it was necessary to put more things. As shown the code below. So it worked for me.
//routes
Route::group(['middleware' => [config('backpack.base.web_middleware', 'web')]], function () {
//routes here
Route::get('admin/register', 'App\Http\Controllers\Admin\Auth\RegisterController@showRegistrationForm')->name('backpack.auth.register');
Route::post('admin/register', 'App\Http\Controllers\Admin\Auth\RegisterController@register');
});
Route::group([
'prefix' => config('backpack.base.route_prefix', 'admin'),
'middleware' => array_merge(
(array) config('backpack.base.web_middleware', 'web'),
(array) config('backpack.base.middleware_key', 'admin')
),
'namespace' => 'App\Http\Controllers\Admin',
], function () { // custom admin routes
Route::crud('tag', 'TagCrudController');
//your codes CRUDs
}); // this should be the absolute last line of this file
The controller stood in the folder
App\Http\Controllers\Admin\Auth\RegisterController
<?php
namespace App\Http\Controllers\Admin\Auth;
use App\Models\Pessoa;
use Backpack\CRUD\app\Library\Auth\RegistersUsers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Validator;
class RegisterController extends Controller
{
protected $data = []; // the information we send to the view
/*
|
And Blande stayed in
resources\views\vendor\backpack\base\auth\register.blade.php
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
About the technologies asked in this question
PHP
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license. https://www.php.net/
Laravel
Laravel is a free open source PHP framework that came out in 2011. Since then, it has been able to become the framework of choice for web developers. One of the main reasons for this is that Laravel makes it easier, faster, and safer to develop complex web applications than any other framework. https://laravel.com/
Foundation
Foundation, similar to Bootstrap, has become very popular as a more complex framework with some advanced but easy-to-implement CSS components. It is built with Sass, so just like Bootstrap, it is customizable. In addition to this, it also boasts some features that help make the design mobile responsive. https://get.foundation/
Welcome to programmierfrage.com
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Help Others Solve Their Issues
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.
This site uses cookies. We use them to improve the performance of our website and your interaction with it. Confirm your consent by clicking OK