Posted inTechnology / Laravel / Mysql / Mysqli / php / Programming

Laravel 6 insert query Example

Today, We want to share with you Laravel 6 insert query Example.In this post we will show you how to edit a record in laravel, hear for delete data from database in laravel we will give you demo and example for implement.In this post, we will learn about how to update data in mysql using laravel with an example.

Laravel 6 insert query Example

There are the Following The simple About how to retrieve data from database in laravel Full Information With Example and source code.

As I will cover this Post with live Working example to develop show data by id laravel, so the Insert Update and Delete record from MySQL in Laravel is used for this example is following below.

Laravel insert Query Example

Example 1: Laravel database insert query

$values = array('id' => 1,'name' => 'Mobile');

Example 2: Insert record from MySQL in Laravel

 public static function insertData($data){
    $value=DB::table('products')->where('productname', $data['productname'])->get();

    if($value->count() == 0){
      return 1;
       return 0;

$name = $request->input('name');
$productname = $request->input('productname');
$pcode = $request->input('pcode');

if($name !='' && $productname !='' && $pcode != ''){
$data = array('name'=>$name,"productname"=>$productname,"pcode"=>$pcode);

// Insert
$value = Product::insertData($data);

  Session::flash('message','Insert Product successfully.');
  Session::flash('message','ProductName already exists.');

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about insert data laravel 6.0 eloquent.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype