Comments (4)
OK so I put in a temporary fix... not sure if it's what we would want but it works....I've put in an error_redirect variable in the user update form then added code to check for this in postIndex() and redirect if present otherwise default to 'user/create'.
public function postIndex()
{
$user = new User;
$user->username = Input::get( 'username' );
$user->email = Input::get( 'email' );
$user->password = Input::get( 'password' );
// The password confirmation will be removed from model
// before saving. This field will be used in Ardent's
// auto validation.
$user->password_confirmation = Input::get( 'password_confirmation' );
// Save if valid. Password field will be hashed before save
$user->save();
if ( $user->id )
{
// Redirect with success message, You may replace "Lang::get(..." for your custom message.
return Redirect::to('user/login')
->with( 'notice', Lang::get('confide::confide.alerts.account_created') );
}
else
{
// Get validation errors (see Ardent package)
$error = $user->errors()->all();
// Default to redirect to user/create or redirect elsewhere if defined in the form
$redirectTo = Input::get('error_redirect') ? Input::get('error_redirect') : 'user/create';
return Redirect::to($redirectTo)
->withInput(Input::except('password'))
->with( 'error', $error );
}
}
from laravel-4-bootstrap-starter-site.
Actually looking at this, I think it's more involved.... postIndex() is trying to handle the create user form submission and the update user form submission. The redirects and messages on success and failure relate to creating a new user, the functionality doesn't stand for the user update.
Not sure if there should be a separate function to handle the update ... although I understand this is supposed to be a restful controller.
I think perhaps this function should be renamed postCreate() and the creation form should submit to that then the functionality in postIndex() should be rewritten to handle the user update form.
(By the way, I'm happy to get involved in code changes but I'm not sure how to do this in terms of sending pull request etc). I've made a few changes here and there locally which I should probably feed back.
from laravel-4-bootstrap-starter-site.
Think this is also related to #63
from laravel-4-bootstrap-starter-site.
I was going to add in a postIndex() along the lines of:
/**
* Updates user
*
*/
public function postIndex()
{
$user = Auth::user();
$user->username = Input::get( 'username' );
$user->email = Input::get( 'email' );
$user->password = Input::get( 'password' );
$user->password_confirmation = Input::get( 'password_confirmation' );*/
if ( $user->save() )
{
...
}
else
{
...
}
}
but user->save() fails/returns false. Just reading a little about Ardent (I need to read more) and it appears you should just be able to use the form fields but not sure if this allows you to update email/username fields.
from laravel-4-bootstrap-starter-site.
Related Issues (20)
- Tons of composer suggestions after installing... HOT 1
- Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException HOT 10
- Windows installation issues. HOT 1
- Ardent integration not complete? HOT 5
- i want to learn how to do this plataform, how should i start? HOT 3
- class User extends ConfideUser instead of Eloquent ?? HOT 3
- Help me with my database modeling. HOT 1
- Use Chumper/Datatable instead of blim
- ng-admin : An Angular.JS Admin Panel HOT 5
- Laravel 5 support? HOT 9
- Can't find the route for account confirmation
- PHP Notice: Constant LARAVEL_START already defined in /opt/bitnami/frameworks/laravel/bootstrap/autoload.php on line 3 HOT 5
- Has anyone changed the edit/delete buttons to use bootstrap modals with confirm ?
- how can i create new static page?
- Non English URL Problem
- Bootstrap theme rederaning HOT 1
- Screenshots HOT 1
- composer install no work on windows HOT 2
- Zizaco/entrust: Problem in the creation of the role and permission with tinker
- Update for laravel 8.x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-4-bootstrap-starter-site.