logo
down
shadow

Laravel : when insert record in table. How can i add that Record in the list without querying the db


Laravel : when insert record in table. How can i add that Record in the list without querying the db

By : melton
Date : November 22 2020, 03:01 PM
this will help A few things.
You should not return a view from a store action or anything that is persisting data.
code :
public function  store(Request $request){

     $Customer = new Customer;
     $Customer->fill(Request::all());
     if($Customer->save()){
       // Here when it successfully inserted
      }
     return redirect('url/for/index/method'); //route to view all customer
}
public function index() {

    $customers = Customer::latest()->take(10)->get(); 
    return View::make('customer.customer-view')->with('customers',$customers);
}
public function index() {

    $customers = Customer::all(); 
    return View::make('customer.customer-view')->with('customers',$customers);
}

public function store(Request $request){

     $Customer = new Customer;
     $Customer->fill(Request::all());
     if($Customer->save()){
       // Here when it successfully inserted
      }
     return redirect('url/for/index/method'); //route to view all customer
}


Share : facebook icon twitter icon
Create after insert trigger that updates record in parent table after inserting record into child table

Create after insert trigger that updates record in parent table after inserting record into child table


By : beaglegirl
Date : March 29 2020, 07:55 AM
will help you Since you are using Access 2010 you can create an After Insert Data Macro on the [User] table, something like this:
Insert record into new MySQL Database table only when a Column on another Table is Updated or a New record is added to t

Insert record into new MySQL Database table only when a Column on another Table is Updated or a New record is added to t


By : Cyn
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I started experimenting with Triggers and they seem to be my ticket, they are working and doing my end goal!
For Task INSERTS I have this trigger...
code :
DROP TRIGGER IF EXISTS project_task_new_stream;
CREATE TRIGGER `project_task_new_stream` AFTER INSERT ON `apoll_web_projects_tasks`
FOR EACH ROW
    INSERT INTO apoll_web_projects_updates_stream (event_type, record_id, modified_user_id, record_name, description, date_entered) VALUES ('0', NEW.task_id, NEW.modified_user_id, NEW.name, NEW.description, NEW.date_modified);
DROP TRIGGER IF EXISTS project_task_updates_stream;
DELIMITER $$
CREATE TRIGGER `project_task_updates_stream` AFTER UPDATE ON `apoll_web_projects_tasks` FOR EACH ROW
BEGIN
IF NOT (NEW.date_modified <=> OLD.date_modified)
    THEN
        INSERT INTO apoll_web_projects_updates_stream (event_type, record_id, modified_user_id, record_name, description, date_entered) VALUES ('0', NEW.task_id, NEW.modified_user_id, NEW.name, NEW.description, NEW.date_modified);
    END IF;
END $$
DELIMITER ;
How do I Automatically insert a new record into a child table when a new record is added to a parent table in Lightswitc

How do I Automatically insert a new record into a child table when a new record is added to a parent table in Lightswitc


By : Longguang Qin
Date : March 29 2020, 07:55 AM
With these it helps Using C#, this should work for your scenario:
Open up your Data Source, click in "Write Code" and select the Participants_Inserted option. (see image below) enter code similar to this: the naming conventions might be slightly out but I have guessed at what yours may be:
code :
    partial void Participants_Inserted(Participants entity)
    {
        HouseIncome houseIncome = DataWorkspace.YOURDATASOURCE.HouseIncomes.AddNew();
        houseIncome.Participants = entity; //THIS ASSIGNS THE FOREIGN KEY RELATIONSHIP TO ITS PARENT
        houseIncome.CurrentLevel = "Yes"; //FOR STRING
        houseIncome.CurrentLevel = true; //FOR BOOLEAN
    }
Laravel eloquent: updating a parent record and creating a new record in another table with one form

Laravel eloquent: updating a parent record and creating a new record in another table with one form


By : user2583831
Date : March 29 2020, 07:55 AM
around this issue Before the return statement you can get your "Machine" Object by id and update the columns you want using update() method :
code :
$machine = Machine::find($call->machine_id);
$machine->update(['machine_custodian'=>$call->machine_custodian, 'assigned_FE'=>$call->assigned_FE]);
$machine = Machine::find($call->machine_id);
$machine->machine_custodian = $call->machine_custodian;
$machine->assigned_FE = $call->assigned_FE;
$machine->save();
Insert records into a table if it doesnt exists or else add the new record with existing record?

Insert records into a table if it doesnt exists or else add the new record with existing record?


By : student1234
Date : March 29 2020, 07:55 AM
Any of those help Try using the MERGE statement.
On another note, why are you inserting ID numbers? Those are typically automatically generated by the DB itself.
Related Posts Related Posts :
  • Increment value with get
  • Laravel 5.5: Convert query builder to eloquent
  • Reverse proxy onto a WordPress page?
  • Jumble Solver url rewrite
  • Using .htaccess to Execute php if directory of the same name not found
  • mysql - Unknown Column In Where Clause
  • Receive Emails into my Admin panel with php or other
  • PHP - adding only distinct value to an array in foreach loop not working
  • How to pass date picker from one page to another
  • Try catch always return error when I insert 2 data
  • Php redirect not working on submission
  • How to get array value from wordpress database get_results
  • how Automatically go from first.php to second.php
  • uploading file not working in codeigniter 3 error: you did not select any file
  • Yii2, gridview can not show some html tags inside cells
  • What are the thing we need to configure to implement live notification module (using redis and socket.io) in https serve
  • How to handle multi criterias search in PHP
  • PHP - Get maximum key and its value in array
  • PHP: how to retrieve all the metrics and dimensions from the Google Metadata API?
  • Deliver php mails to special-character-email adresses, such as äüö
  • Delete a single row from an MSSQL table from PHP
  • Property [name] does not exist on this collection instance
  • Pass input value through PHP parameter
  • Running two PHP versions on the same server (STRETCH)
  • Checking if a file has been selected for upload
  • Model not updating laravel
  • How to add a description of words from text to an array, to an array key by passing words?
  • Nginx rewrite rule not not passing variables if "/" is at the end of the url
  • Modify decimal point and thousands separator without changing the number of decimals
  • Remove PHP errors from CLI and PHPMyAdmin
  • Yii2 rest api - Url manager add parameters
  • 1-query batch update array of users using PDO
  • Keep getting error: implode(): Invalid arguments passed when updating data
  • Laravel 5.4 - Correct Validation rule for a required parameter that can be zero
  • What does this code mean: $objPHPExcel->getActiveSheet()->toArray(null, true,true,true)
  • Data not being added to mysql table but echo's the data?
  • While fetch row in PHP
  • IP long string filter
  • How to view first image in list per user as its highlight Profile
  • Insert multiple rows from array
  • PHP : How to remove a duplicate array item ONCE
  • Print the input box text as simple text instead of html tag
  • How to read a string variable in php as $_GET or $_POST?
  • MySQL query fetch array not working
  • LogicException with message '... must return a relationship instance.'
  • PHP - create new array with only selected keys from an existing array
  • How to allow backgrounding a process to survive a session termination?
  • How to redirect to Home page (Default page) in zend framework 2?
  • I want to call a jquery variable in php syntax
  • Disabling the default /?add-to-cart= animation on buttons in Woocommerce
  • How to use query data for another sql query in yii2
  • Replace string enclosed in specified characters based on data type
  • Symfony FormType: how to get prototype in form type file
  • Handle reply messages properly after some operations in php
  • PHP Changed Domain, how to remove old Session Cookies
  • mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in php
  • Error: Call to a member function update() on array laravel
  • How to change the format of a float number?
  • run ajax requests by order
  • Wordpress Install 404 Error (Cannot view login in browser)
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org