Deprecated: Function create_function() is deprecated in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/plugins/wp-automatic/wp-automatic.php on line 70
Laravel 5 tutorial, How To Insert Data in Database | D4mations.com
  • Tuesday , 29 September 2020

Laravel 5 tutorial, How To Insert Data in Database

Code Canyon



Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling.

Original source

3d Ocean

Related Posts

38 Comments

  1. amit mandaviya
    January 5, 2019 at 09:15

    Hello Friend need to complete 1K Subscribers please help me and support to reach there.
    Please Subscribe channel and support us.

  2. Mudassar Hussain
    January 5, 2019 at 09:15

    moh sy tora buk beh leya kro

  3. Arwin Senoja
    January 5, 2019 at 09:15

    hey man, Wheres the error handling for that?

  4. Fian Halfian
    January 5, 2019 at 09:15

    on laravel 5.7 this not support, right?

  5. Hasan Al-kadhumi
    January 5, 2019 at 09:15

    Thank you bro

  6. afroza hassan
    January 5, 2019 at 09:15

    The requested URL was not found on this server. Sir yeh error arhaa haii 🙁 Kindly help me in solving this

  7. Elio Dellan
    January 5, 2019 at 09:15

    Hello Sr see this the error that I got "Class 'AppHttpControllersdb' not found" could help me?

  8. shakti shekhawat
    January 5, 2019 at 09:15

    The requested URL /insert was not found on this server.

  9. KIRAN CHABUKSWAR
    January 5, 2019 at 09:15

    Very Nice Thanks Friend,
    kbc all media work in web design http://www.cromosoft.in

  10. 叔w望天
    January 5, 2019 at 09:15

    this helping me a lot , today i try to inset the data to the mssql database : i use $product = new product;
    $product->pro_name = $request->pro_name;
    $product->pro_code = $request->pro_code;
    $product->pro_price = $request->pro_price;
    $product->pro_info = $request->pro_info;
    $product->pro_img = $filename;
    $product->spl_price = $request->spl_price;
    $product->save(); then Error message keep saying in MSsql server invalid object name [products] , so i try u formal ,and it works , thank for you video tutorial.

  11. Ashraful Alam
    January 5, 2019 at 09:15

    this tutorial controller page do not import for database library.
    you can add import your code in controller page for input database :

    namespace AppHttpControllers;
    use IlluminateHttpRequest;
    use AppHttpRequests;
    use IlluminateSupportFacadesDB;

    I give example of contolller page

    <?php

    namespace AppHttpControllers;

    use IlluminateHttpRequest;

    use AppHttpRequests;

    use IlluminateSupportFacadesDB;

    class RegController extends Controller
    {
    //

    public function reg(){
    return view('Registration');
    }

    public function insert(Request $req){

    $student_id = $req->input('student_id');
    $course_code = $req->input('course_code');
    $course_title = $req->input('course_title');
    $course_credit = $req->input('course_credit');

    $data = array('student_id'=> $student_id ,'course_code'=>$course_code,'course_title'=>$course_title,'course_credit'=>$course_credit );

    DB::table('course')->insert($data);

    return back();

    }
    }

  12. michael leonzio
    January 5, 2019 at 09:15

    if I didn't put any input then the laravel will get error. how to change it to show echo that all data must be filled. thanks

  13. ahmad farhan
    January 5, 2019 at 09:15

    how about table schema, something like migrate. Did i miss anything or we dont required it

  14. Sai Avinash
    January 5, 2019 at 09:15

    Everyone, use
    form action="{{ action('Controller@insert')}}"
    INSTEAD OF
    form action="/insert"

    It will work fine.

  15. Gerald Bustos
    January 5, 2019 at 09:15

    Justo lo que buscaba, gracias

  16. Kistlak Rajapaksha
    January 5, 2019 at 09:15

    100% Perfectly Worked !!

    Thank U Very Much Bro !! 😀

    And Plz create a Video How to Edit Data in Database..

  17. Hemant Maurya
    January 5, 2019 at 09:15

    Bhai Where the f*** is model, damn kuch bhi code karke save karo?
    Better if work on core php if planing to work in this way…

  18. ARUN MG
    January 5, 2019 at 09:15

    broo, there is noo edit??

  19. Carlos Varas
    January 5, 2019 at 09:15

    if you follow all the instructions step by step it works like a charm! you a re getting a new subscriber

  20. prabha acg
    January 5, 2019 at 09:15

    Hi Amit… ur video is awsome but its not working ..its running and error is ..url line is http://localhost:8000/insert
    show is in url insert,,,,Sorry, the page you are looking for could not be found.

  21. ÁÐÁRŚH PV
    January 5, 2019 at 09:15

    sir, i got an error… please hlp me..

    ReflectionException in Route.php line 286:
    Class AppHttpControllersRequest does not exist

  22. Chil
    January 5, 2019 at 09:15

    Please, don't waste you time – doesn't work
    Hope u saved 10 min of your life

  23. Pragya Sharma
    January 5, 2019 at 09:15

    Sir I get this error and please solve this – (1/1) ErrorException Undefined variable: req in controller

  24. Adarsh Nt
    January 5, 2019 at 09:15

    sir how to give session in a login page..
    may it easy.But i dnt know how to set it.

  25. Adarsh Nt
    January 5, 2019 at 09:15

    tank u very much sir…..

  26. elvis oghenegueke
    January 5, 2019 at 09:15

    i liked this tutorial, i tried it and its working, but i have a problem with the last part, where the data is to be added to the database, but mine is showing error….

  27. Karthik Raikar
    January 5, 2019 at 09:15

    awesome bru..you got one subscriber..

  28. Knowledge Base
    January 5, 2019 at 09:15

    Hello Amit, do u know how to save a multiple rows of records from one database table to another table at the same database? Thanks.

  29. Sonam Chauhan
    January 5, 2019 at 09:15

    The requested URL /insert was not found on this server. what should i do sir

  30. Ajay Kumar Yadav
    January 5, 2019 at 09:15

    how to fixed it.
    QueryException in Connection.php line 647:
    SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'country_code' cannot be null (SQL: insert into `location` (`country_code`, `country`, `city_region`, `zip`) values (, , , ))

  31. The One
    January 5, 2019 at 09:15

    Can you do a tutorial on a 'favourite' system, so maybe there's some data (for example a charity), and the current user wants to add that charity to their favourites list. Their favourites list could be displayed on their profile page?

  32. Fox Mulder
    January 5, 2019 at 09:15

    thank you so much really !

  33. Chandrakant Bobade
    January 5, 2019 at 09:15

    I was searching for such kind of tutorials. Now i have one question, after the insert statement you are directly writing echo statement. How to validate if there is an error in your query.

  34. amit mandaviya
    January 5, 2019 at 09:15

    for use DB::table('mesajlar')->insert($data); you need to write
    "use DB;" after namespace

  35. amit mandaviya
    January 5, 2019 at 09:15

    Route::any('/insert','Controller@method');

    Try this one @Tolunay Toprakkaya

  36. Tolunay Toprakkaya
    January 5, 2019 at 09:15

    Web.php

    Route::get('/', function () {
    return view('insertForm');
    });

    Route::post('/insert', 'Controller@insert');

    ——————————————————-
    Controller.php

    <?php

    namespace AppHttpControllers;

    use IlluminateFoundationBusDispatchesJobs;
    use IlluminateRoutingController as BaseController;
    use IlluminateFoundationValidationValidatesRequests;
    use IlluminateFoundationAuthAccessAuthorizesRequests;

    class Controller extends BaseController
    {
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    function insert(Request $req)
    {
    $email = $req -> input('email');
    $mesaj = $req -> input('mesaj');

    $data = array('email'=>$email, "mesaj"=>$mesaj);

    DB::table('mesajlar')->insert($data);

    echo "Mesaj Gönderildi";
    }
    }
    ————————————–
    insertForm.blade.php

    <!DOCTYPE html>
    <html>
    <head>
    <title>Insert Form</title>
    </head>
    <body>
    <center>

    <form action="/insert" method="post">
    <table>
    <tr>
    {{ csrf_field() }}
    <td>E-Mail : </td>
    <td><input type="text" name="email"></td>
    </tr>
    <tr>
    <td>Mesaj : </td>
    <td><textarea rows="4" cols="20" name="mesaj"></textarea></td>
    </tr>
    <tr>
    <td><input type="submit" name="submit" value="Gönder"></td>
    </tr>
    </table>
    </form>

    </center>
    </body>
    </html>

    Everything looking good but i have a problem The requested URL /insert was not found on this server. It is not see /insert HELP ME PLS

  37. imran afzal
    January 5, 2019 at 09:15

    Sir Love you <3 , your tutorial is love

  38. Blackwood Junior
    January 5, 2019 at 09:15

    Nice tutorial video! I leave my 'like' for this. And already sub to your channel 🙂 Would be nice if you could check me out too 🙂

Leave A Comment

You must be logged in to post a comment.