laravel 5.2 user login redirect with condition - redirect

I am making Dating website using laravel 5.2
I have Tables in database
--user
--profile
--education
--Occupation
--Marital Status
--Parents Details
Each of the table has user_id as forigen key of User table.
All models have been created and hasMany and belongsTo relation has been added respectively.
My question is when user login, I would like user to land to specific create controller if table is unfilled or form is not filled. For EX- profile.create, education.create , occupation.create.
Or is there any efficient way I can handle this situation.
Thanks in advance, I hope you got it. Let me know if you still need any more info.

The most simple idea below:
Create a column full_profile (tinyint, length 1) in your table which indicates the profile is full. Default it's 0.
After a validations are true, set the value of the full_profile to 1.
Ok, now it's simple:
User logs in
Check the value of full_profile. If 0, redirect to form, if 1, redirect to dashboard?

Related

PostgREST - Add authenticated user id on insert

I need to automatically add an author of an inserted row in one of its columns. I am using postgREST (using Supabase cloud service) and I don't want users to add whoever they want as the author. Is there a way to automatically add user id of the user posting the data? Thanks!
The column's DEFAULT value should be:
uid() for Supabase.
current_user for Postgres.
You can add it via Table Editor or use auth.uid() in your SQL functions.

oracle form ''you cannot update this record''

I have a procedure in which I get values from different tables and calculate a certain decimal number. After that i try to post it on a form text-field which is a database item (update and insert allowed on the settings of block and item). everything works fine but the result wont show on the item and won't save in the database field. I get the error
"you cannot update this record".
Can someone help? i have been working on it for two days now and can't find anything.
Did you check if your user has update access on the table?
Check also if there are database triggers on the table that prevents you from updating the record.

Laravel 5.1 Reset Password Function; user's email is in a different table

I have a question regarding Laravel's Reset Password function. I have thoroughly searched for a possible solution and could not find one. Moreover, I tried to scrutinize the code and manually implement it, but failed miserably because of the nesting. (I'm new to Laravel).
According to Laravel's documentation, the user's email must be in the table user in order to work and the error code confirms it.
*Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from user where email = usermail#provider.com limit 1*
However, we do have the scenario that an user might have multiple email addresses, hence stored in a different table called user_email.
Does anybody have experience with this scenario and could take the time to enlighten me on this?
You have two Options:
Write your own password recovery system.
Let the user choose a primary e-mail and make a column on the users table which represents the primary e-mail adresse.

Read only logic on the basis of user logged in to openbravo

I have a requirement in Openbravo 3.0 framework . I have two user one is HR and the other is employee . Their is a checkbox in user window called HR USER .. In my window I need to write a read only logic so that when HR logins the record has to be editable , and when the employee logins the record has to be non editable,, I know how to do that for normal fields ,, But i am not getting anything about user validation..
In the employee screen i am assigning the user id to that employee.
Please Help
Read Only Logic based on Logged in User:
finding out the ID (primary key) of the User (HR or Employee) using PGAdmin Query tool.
Add read only as shown below.
Read Only Logic based on Logged in Role :
This can be achieved in three steps
creating Auxiliary Input.
finding out the ID (primary key) of the role (HR or Employee)
associating Read Only Logic to the Column.
First of all, we need to add an Auxiliary Input that will make
AD_ROLE_ID of the currently logged in user available to the user
window. Using the System Administrator role navigate to the
Application Dictionary || Setup || Auxiliary Input and create a new
record as shown below:
This will make the #AD_ROLE_ID session variable available to the [user] tab of the HR User window through the #ROLE_ID# variable.
Secondly, you need to find out what the AD_ROLE_ID of the HR role
is. Use the PgAdmin to query the AD_ROLE table and find that out. A
simple query reveals the following:
select ad_role_id, name from ad_role;
ad_role_id | name
----------------------------------+---------------------------
....
1000001 | Admin
SDJFALSDFJKLASJDFKLASDFASLDFJAKLSJ| velmurugan
SDFLAKSDJFLKASJDLFALSDFALDSKFJLAS | Employee
DSKLFJAKLDSJFKLASJFKLADSJFLKAJSDFK| F&B US, Inc. - Admin
....
(38 rows)
The primary key (AD_ROLE_ID) of the HR role is 054A32701D6D4CE6BF4F695DAB23EDB3. This will clearly be different in your case.
With this information, we can now find the HR User field definition
and set its Read Only Logic to
#ROLE_ID#!'054A32701D6D4CE6BF4F695DAB23EDB3' as shown below:

Yii, form using 2 models -> skip the validation on one

I have one form using to different models. I want to be able to create a new Person and eventually a new User, to give this person an account. A person doens't need to have a User related (could be just a person used for statistics or something like that). I have a checkbox in my form "Click if you want create a user" and I show the user part of the form if it's checked.
Then in the controller I can, with the checkbox value, know if I need call performAjax() for both Person and User or only Person.
But my problem is about the client validation. If I try to submit the form without the User required field, for example, the submition will abort and i'll get some errors like "This field is requiered".
So, my question is how could I skip the validation of my user model if its fields are empty (checkebox unchecked, we don't want to create a user).
Any help are welcom :)
Sorry for my bad English.
Have a good day :)
Michaƫl S.
When saving the model, set the first parameter on false to skip validation:
$model->save(false)