Laravel 8 tutorial - Query Builder

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • In this laravel 8 and laravel 9 video tutorial, we learn what is query builder and how to make it a simple way. This video is made by anil Sidhu in the English language.
    steps of video
    Query Builder in Laravel
    what is Query Builder in Laravel
    Where Condition
    Find, Count,
    Insert,Update,Delete
    Interview Question for query in laravel
    Laravel tutorial for fresher
    Laravel 9
    Laravel 9 playlist tutorial
    • Laravel 9 tutorial

Комментарии • 23

  • @codestepbystep
    @codestepbystep  2 года назад +3

    Please support me by subscribe, like and comment :) thank you

  • @saikumarkandikonda431
    @saikumarkandikonda431 3 года назад +26

    Hi bro, Thanks for this tutorial. Here's the answer for your question. Hope you'll reply.
    $id=13;
    $data=(array)DB::table('students')->find($id); //it will find id
    if($data){
    echo "number already exists"; //if already id exists this will be printed
    }else{
    return DB::table('students')
    ->insert(['id'=>$id,
    'name'=>'dffd']);
    }

    • @sangavir1330
      @sangavir1330 Год назад

      But id is a primary key. So there is no duplicate value of id in table then why are you checking the id is already exist or not

  • @cryptoboy8447
    @cryptoboy8447 2 года назад +1

    thanks bro for your good teaching

  • @dianaeftaiha
    @dianaeftaiha 3 года назад +5

    Thanks for this tutorial Anil. Which is better to use, models or the query builder, and when do we use which?

  • @lonecoder4459
    @lonecoder4459 2 года назад +1

    SELECT `id`,`registration_number`,`fullname`,`gender`,(select count(*) FROM `registration_school_college_students` WHERE `gender`='male') as 'total_male' FROM `registration_school_college_students` WHERE 1.
    How can i write the above query in laravel? Help needed

  • @kamalCode
    @kamalCode 4 года назад +1

    Sir, e-commerce website development के लिए कौन कौन से module होते हैं। Companies किस तरह से और कौन कौन से steps को follow करती हैं। Pro web development complete process kya होता है

  • @melvinreano1221
    @melvinreano1221 Год назад

    what is the answer in the question?

  • @super-legend
    @super-legend 3 года назад +1

    Query builder or eloquent which is best approach to follow

  • @SHADAN.__.KHAN077
    @SHADAN.__.KHAN077 2 года назад

    thank you.

  • @subrsubrr334
    @subrsubrr334 Год назад

    Excellent tutorial, especially when you combine it with 3 previous videos. You got yourself a subscriber!

  • @booeew
    @booeew 2 года назад

    $data=(array) DB::table('members')->findOrFail($id);

  • @sdk_gyan
    @sdk_gyan 4 года назад

    Contact kayse hoga aapse ek project banwana hai

  • @birukindrias4308
    @birukindrias4308 3 года назад

    thanku but can u add a number for the videos please from first to end its confusing

  • @team5011
    @team5011 4 года назад

    link ku nhi deya form py qurey builder apply krny ka

  • @Sam-zi6lh
    @Sam-zi6lh 2 года назад +3

    $data= DB::table('quotes')->find(16);
    if($data) {
    return 'already exists';
    }
    else {
    DB::table('quotes')->insert(['heading'=>'inserted from query',
    'description'=>'about inserted from query']);
    }

  • @AmitDas-yb3re
    @AmitDas-yb3re 3 года назад

    $data = DB::table('members')->get();
    return \view('memberQB', ['data' => $data]);
    If you send the data this way to the view file and access it as an array in that view file, then it will not work. Like -
    @foreach($data as $item)

    {{ $item['id'] }}
    @endforeach
    Even if you cast it as an array it still not working.
    You need to access it as an object. Like -
    @foreach($data as $item)

    {{ $item->id }}

    @endforeach
    P.S - If I am wrong correct me, please.
    laravel.com/docs/8.x/queries#retrieving-results