rydurham / Sentinel

A Sentry bridge package for Laravel
http://www.ryandurham.com/projects/sentinel/
317 stars 68 forks source link

How I can extent your RegistrationController? #233

Closed AlexMcowkin closed 6 years ago

AlexMcowkin commented 6 years ago

I need set view for forgot form. So I need modify forgotPasswordForm()

public function forgotPasswordForm() { return $this->viewFinder(config('sentinel.view.user_forgot', 'Sentinel::users.forgot')); } How I can extent your RegistrationController? thank you

rydurham commented 6 years ago

Unfortunately, customizing the controller actions is not as straight forward as I would like it to be. Your best bet is to disable the routes provided by the package (via the config) and then copy and paste the route details from the package into your main routes file. Make sure that you set up those new route listings with the proper namespace settings so that Laravel can still use the package controllers for the routes that you don't want to customize.

From there you can set up your own controller actions for the routes you do want to customize, which should then allow you to achieve what you are looking for.

AlexMcowkin commented 6 years ago

can you update your extension and add custom view in every action? // for forgot $this->viewFinder(config('sentinel.view.user_forgot', 'Sentinel::users.forgot'));

// for reset $this->viewFinder(config('sentinel.view.user_reset', 'Sentinel::users.reset'));

rydurham commented 6 years ago

Did my first suggestion work? I would be open to a pull request.

AlexMcowkin commented 6 years ago

Hello. thnx. so If you cant... How can I disable forgot routes in package? and set it in my routes ?

rydurham commented 6 years ago

You If you haven't done so already, you should publish the package config files (there are instructions in the readme.)

You can then disable the package routes by editing the sentinel config file.

AlexMcowkin commented 6 years ago

Hi. In sentinel.php I disabled 'routes_enabled' => false,

in my web.php I added

Route::group(['namespace' => 'Sentinel\Controllers', 'middleware' => ['web']], function () {
    Route::get('forgot', ['as' => 'sentinel.forgot.form', 'uses' => 'wwwRegistrationController@forgotPasswsssordForm']);
});

I know. I put wrong classs. But I want it for test.

so...

It does not work. I still use package routes

AlexMcowkin commented 6 years ago

If I disable all rules so I need rewrite all of these form routes.php?

AlexMcowkin commented 6 years ago

I did it. thankx. It is very difficult for me after Yii2

rydurham commented 6 years ago

Excellent! I am glad that was able to work for you. Let me know if you have any other questions.