How to save updated data only after admin verification in Laravel










0















I have two users: one admin and another simple user. When user wants to edit data, it goes request to admin like "pending for verification"; only after verifying, data will update. This is image for status column of table:



When data is edited from user, status is 4, and when verified, it must be 5. Can you help me how can I save old data upto when new data is not verified and how to replace it after verification?










share|improve this question
























  • any one is their for help?

    – shankar bhatt
    Nov 13 '18 at 7:24











  • I think you need to create two separate table, 1. store users verified data and another for change data which on pending status, Once admin is verified then you need to replace users data with change data and change status to verified. You should store change data in JSON in database

    – Madhusudan
    Nov 13 '18 at 7:29












  • on edit with simple user u can create another row in your database table with edited data and pending status as temp, after admin accept the edited data, replace this data on with main data and delete this temp data, and if admin refuse it, only delete temp data

    – Behzad Dadashpour
    Nov 13 '18 at 7:30











  • Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 7:41











  • #behzad-dadashpour Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 8:58















0















I have two users: one admin and another simple user. When user wants to edit data, it goes request to admin like "pending for verification"; only after verifying, data will update. This is image for status column of table:



When data is edited from user, status is 4, and when verified, it must be 5. Can you help me how can I save old data upto when new data is not verified and how to replace it after verification?










share|improve this question
























  • any one is their for help?

    – shankar bhatt
    Nov 13 '18 at 7:24











  • I think you need to create two separate table, 1. store users verified data and another for change data which on pending status, Once admin is verified then you need to replace users data with change data and change status to verified. You should store change data in JSON in database

    – Madhusudan
    Nov 13 '18 at 7:29












  • on edit with simple user u can create another row in your database table with edited data and pending status as temp, after admin accept the edited data, replace this data on with main data and delete this temp data, and if admin refuse it, only delete temp data

    – Behzad Dadashpour
    Nov 13 '18 at 7:30











  • Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 7:41











  • #behzad-dadashpour Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 8:58













0












0








0








I have two users: one admin and another simple user. When user wants to edit data, it goes request to admin like "pending for verification"; only after verifying, data will update. This is image for status column of table:



When data is edited from user, status is 4, and when verified, it must be 5. Can you help me how can I save old data upto when new data is not verified and how to replace it after verification?










share|improve this question
















I have two users: one admin and another simple user. When user wants to edit data, it goes request to admin like "pending for verification"; only after verifying, data will update. This is image for status column of table:



When data is edited from user, status is 4, and when verified, it must be 5. Can you help me how can I save old data upto when new data is not verified and how to replace it after verification?







php laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 8:54









Armali

7,020936100




7,020936100










asked Nov 13 '18 at 7:15









shankar bhattshankar bhatt

62




62












  • any one is their for help?

    – shankar bhatt
    Nov 13 '18 at 7:24











  • I think you need to create two separate table, 1. store users verified data and another for change data which on pending status, Once admin is verified then you need to replace users data with change data and change status to verified. You should store change data in JSON in database

    – Madhusudan
    Nov 13 '18 at 7:29












  • on edit with simple user u can create another row in your database table with edited data and pending status as temp, after admin accept the edited data, replace this data on with main data and delete this temp data, and if admin refuse it, only delete temp data

    – Behzad Dadashpour
    Nov 13 '18 at 7:30











  • Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 7:41











  • #behzad-dadashpour Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 8:58

















  • any one is their for help?

    – shankar bhatt
    Nov 13 '18 at 7:24











  • I think you need to create two separate table, 1. store users verified data and another for change data which on pending status, Once admin is verified then you need to replace users data with change data and change status to verified. You should store change data in JSON in database

    – Madhusudan
    Nov 13 '18 at 7:29












  • on edit with simple user u can create another row in your database table with edited data and pending status as temp, after admin accept the edited data, replace this data on with main data and delete this temp data, and if admin refuse it, only delete temp data

    – Behzad Dadashpour
    Nov 13 '18 at 7:30











  • Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 7:41











  • #behzad-dadashpour Do you help me by providing code to save temp data and replace it when verified?

    – shankar bhatt
    Nov 13 '18 at 8:58
















any one is their for help?

– shankar bhatt
Nov 13 '18 at 7:24





any one is their for help?

– shankar bhatt
Nov 13 '18 at 7:24













I think you need to create two separate table, 1. store users verified data and another for change data which on pending status, Once admin is verified then you need to replace users data with change data and change status to verified. You should store change data in JSON in database

– Madhusudan
Nov 13 '18 at 7:29






I think you need to create two separate table, 1. store users verified data and another for change data which on pending status, Once admin is verified then you need to replace users data with change data and change status to verified. You should store change data in JSON in database

– Madhusudan
Nov 13 '18 at 7:29














on edit with simple user u can create another row in your database table with edited data and pending status as temp, after admin accept the edited data, replace this data on with main data and delete this temp data, and if admin refuse it, only delete temp data

– Behzad Dadashpour
Nov 13 '18 at 7:30





on edit with simple user u can create another row in your database table with edited data and pending status as temp, after admin accept the edited data, replace this data on with main data and delete this temp data, and if admin refuse it, only delete temp data

– Behzad Dadashpour
Nov 13 '18 at 7:30













Do you help me by providing code to save temp data and replace it when verified?

– shankar bhatt
Nov 13 '18 at 7:41





Do you help me by providing code to save temp data and replace it when verified?

– shankar bhatt
Nov 13 '18 at 7:41













#behzad-dadashpour Do you help me by providing code to save temp data and replace it when verified?

– shankar bhatt
Nov 13 '18 at 8:58





#behzad-dadashpour Do you help me by providing code to save temp data and replace it when verified?

– shankar bhatt
Nov 13 '18 at 8:58












2 Answers
2






active

oldest

votes


















0














You can use this way to fix this problem. (Of course, this is my point)



Save the data in a table and add a new column with the status name in this field to check if the data has been verified.



Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them






share|improve this answer

























  • Yes, i understand that but need code for save temp data and replace it when approving in laravel.

    – shankar bhatt
    Nov 13 '18 at 9:17












  • Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

    – reza baghiee
    Nov 13 '18 at 9:28











  • need on same table as temp data

    – shankar bhatt
    Nov 13 '18 at 9:36


















0














I think something like that:



  1. Create temp table with foreign key for current table

  2. Create temp model


  3. User change:



    $newItem = new TempModel($someRequestData);
    $item->some_foreign_key_name = $request->input('id');
    $item->save();



  4. Admin verify:



    $newItem = TempModel::where('some_foreign_key_name', $request->input('id'))->first();
    $oldItem = Model::find($request->input('id'));
    $oldItem->fill($newItem->toArray());
    $oldItem->save();
    $newItem->delete();



  5. add $guarded to current model, if you are not using $fillable:



    protected $guarded = ['some_foreign_key_name'];






share|improve this answer























  • thank you for code.

    – shankar bhatt
    Nov 13 '18 at 10:45










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275719%2fhow-to-save-updated-data-only-after-admin-verification-in-laravel%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You can use this way to fix this problem. (Of course, this is my point)



Save the data in a table and add a new column with the status name in this field to check if the data has been verified.



Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them






share|improve this answer

























  • Yes, i understand that but need code for save temp data and replace it when approving in laravel.

    – shankar bhatt
    Nov 13 '18 at 9:17












  • Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

    – reza baghiee
    Nov 13 '18 at 9:28











  • need on same table as temp data

    – shankar bhatt
    Nov 13 '18 at 9:36















0














You can use this way to fix this problem. (Of course, this is my point)



Save the data in a table and add a new column with the status name in this field to check if the data has been verified.



Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them






share|improve this answer

























  • Yes, i understand that but need code for save temp data and replace it when approving in laravel.

    – shankar bhatt
    Nov 13 '18 at 9:17












  • Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

    – reza baghiee
    Nov 13 '18 at 9:28











  • need on same table as temp data

    – shankar bhatt
    Nov 13 '18 at 9:36













0












0








0







You can use this way to fix this problem. (Of course, this is my point)



Save the data in a table and add a new column with the status name in this field to check if the data has been verified.



Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them






share|improve this answer















You can use this way to fix this problem. (Of course, this is my point)



Save the data in a table and add a new column with the status name in this field to check if the data has been verified.



Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 13 '18 at 9:31

























answered Nov 13 '18 at 9:12









reza baghieereza baghiee

6419




6419












  • Yes, i understand that but need code for save temp data and replace it when approving in laravel.

    – shankar bhatt
    Nov 13 '18 at 9:17












  • Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

    – reza baghiee
    Nov 13 '18 at 9:28











  • need on same table as temp data

    – shankar bhatt
    Nov 13 '18 at 9:36

















  • Yes, i understand that but need code for save temp data and replace it when approving in laravel.

    – shankar bhatt
    Nov 13 '18 at 9:17












  • Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

    – reza baghiee
    Nov 13 '18 at 9:28











  • need on same table as temp data

    – shankar bhatt
    Nov 13 '18 at 9:36
















Yes, i understand that but need code for save temp data and replace it when approving in laravel.

– shankar bhatt
Nov 13 '18 at 9:17






Yes, i understand that but need code for save temp data and replace it when approving in laravel.

– shankar bhatt
Nov 13 '18 at 9:17














Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

– reza baghiee
Nov 13 '18 at 9:28





Save the information in a different table. An interface table !!! Then, when the administrator verified that using the Identity Interface, paste these new values, then erase the new values from the interface table after inserting them.

– reza baghiee
Nov 13 '18 at 9:28













need on same table as temp data

– shankar bhatt
Nov 13 '18 at 9:36





need on same table as temp data

– shankar bhatt
Nov 13 '18 at 9:36













0














I think something like that:



  1. Create temp table with foreign key for current table

  2. Create temp model


  3. User change:



    $newItem = new TempModel($someRequestData);
    $item->some_foreign_key_name = $request->input('id');
    $item->save();



  4. Admin verify:



    $newItem = TempModel::where('some_foreign_key_name', $request->input('id'))->first();
    $oldItem = Model::find($request->input('id'));
    $oldItem->fill($newItem->toArray());
    $oldItem->save();
    $newItem->delete();



  5. add $guarded to current model, if you are not using $fillable:



    protected $guarded = ['some_foreign_key_name'];






share|improve this answer























  • thank you for code.

    – shankar bhatt
    Nov 13 '18 at 10:45















0














I think something like that:



  1. Create temp table with foreign key for current table

  2. Create temp model


  3. User change:



    $newItem = new TempModel($someRequestData);
    $item->some_foreign_key_name = $request->input('id');
    $item->save();



  4. Admin verify:



    $newItem = TempModel::where('some_foreign_key_name', $request->input('id'))->first();
    $oldItem = Model::find($request->input('id'));
    $oldItem->fill($newItem->toArray());
    $oldItem->save();
    $newItem->delete();



  5. add $guarded to current model, if you are not using $fillable:



    protected $guarded = ['some_foreign_key_name'];






share|improve this answer























  • thank you for code.

    – shankar bhatt
    Nov 13 '18 at 10:45













0












0








0







I think something like that:



  1. Create temp table with foreign key for current table

  2. Create temp model


  3. User change:



    $newItem = new TempModel($someRequestData);
    $item->some_foreign_key_name = $request->input('id');
    $item->save();



  4. Admin verify:



    $newItem = TempModel::where('some_foreign_key_name', $request->input('id'))->first();
    $oldItem = Model::find($request->input('id'));
    $oldItem->fill($newItem->toArray());
    $oldItem->save();
    $newItem->delete();



  5. add $guarded to current model, if you are not using $fillable:



    protected $guarded = ['some_foreign_key_name'];






share|improve this answer













I think something like that:



  1. Create temp table with foreign key for current table

  2. Create temp model


  3. User change:



    $newItem = new TempModel($someRequestData);
    $item->some_foreign_key_name = $request->input('id');
    $item->save();



  4. Admin verify:



    $newItem = TempModel::where('some_foreign_key_name', $request->input('id'))->first();
    $oldItem = Model::find($request->input('id'));
    $oldItem->fill($newItem->toArray());
    $oldItem->save();
    $newItem->delete();



  5. add $guarded to current model, if you are not using $fillable:



    protected $guarded = ['some_foreign_key_name'];







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 9:41









IndianCodingIndianCoding

1,044119




1,044119












  • thank you for code.

    – shankar bhatt
    Nov 13 '18 at 10:45

















  • thank you for code.

    – shankar bhatt
    Nov 13 '18 at 10:45
















thank you for code.

– shankar bhatt
Nov 13 '18 at 10:45





thank you for code.

– shankar bhatt
Nov 13 '18 at 10:45

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275719%2fhow-to-save-updated-data-only-after-admin-verification-in-laravel%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto