vinubangs

vinubangs

Member Since 7 Months Ago

Experience Points 970
Experience Level 1

4,030 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

18 Jun
1 month ago

vinubangs left a reply on Create Zip For Multiple Files By Chumper/zipper Package

@SHADEN - My code is working now.

But I did it on localhost. I have uploaded previous code already. I only need to install this functionality. How to install this (zipper package) on cpanel (LINUX SHARED HOSTING).

17 Jun
1 month ago

vinubangs left a reply on Create Zip For Multiple Files By Chumper/zipper Package

@SHADEN - I removed \Zipper ->close(); And it is working.

vinubangs left a reply on Create Zip For Multiple Files By Chumper/zipper Package

@SHADEN - syntax error, unexpected '->' (T_OBJECT_OPERATOR)

15 Jun
1 month ago

vinubangs left a reply on Create Zip For Multiple Files By Chumper/zipper Package

public function createzip($volume_id)
{
      $articles = article::where('volume_id',$volume_id)->get();


    foreach($articles as $article) {
                $files = public_path('storage/upload_pic/'.$article->image);
        } 
        \Zipper::make(public_path('test.zip'))->add($files)->close(); 
        return response()->download(public_path('test.zip'));

    }

I TRIED WITH THIS ALSO. BUT IT IS GIVING ONLY ONE RECORD. HOW CAN I GET MULTIPLE RECORD IN ZIP?

vinubangs started a new conversation Create Zip For Multiple Files By Chumper/zipper Package

I have a table, that have some records with file name and that file save in a folder. Now I want to create zip file of selected file. I used chumper/zipper Package.

My controller is:

{
      $articles = article::where('volume_id',$volume_id)->get();


    $headers = ["Content-Type"=>"application/zip"];
        $fileName = "docs.zip"; // name of zip
        foreach($articles as $article) {
        \Zipper::make(public_path('/storage/upload_pic/'.$article->image.'.zip')) //file path for zip file

                ->add(public_path()."storage/upload_pic/".$article->image)->close(); //files to be zipped
              }
        return response()
        ->download(public_path($fileName),$fileName, $headers);

14 Apr
3 months ago

vinubangs left a reply on Download Files In Zip Using ZipArchive

@BOBBYBOUWMANN - Now I tried

$file= public_path('storage' . DIRECTORY_SEPARATOR .'app' . DIRECTORY_SEPARATOR .'public' . DIRECTORY_SEPARATOR .'upload_pic');

Now no error. But blank is showing.

vinubangs left a reply on Download Files In Zip Using ZipArchive

@BOBBYBOUWMANN - I ran this command

php artisan storage:link

to link the image path and store the files

vinubangs left a reply on Download Files In Zip Using ZipArchive

@BOBBYBOUWMANN - $article have records of given table

vinubangs left a reply on Download Files In Zip Using ZipArchive

@BOBBYBOUWMANN - The file "E:\xampp\htdocs\jiwaji_university\public\storage\upload_pic" does not exist

vinubangs left a reply on Download Files In Zip Using ZipArchive

@BOBBYBOUWMANN - same error

The file "E:\xampp\htdocs\jiwaji_university\public\storage/upload_pic" does not exist

vinubangs left a reply on Download Files In Zip Using ZipArchive

@BOBBYBOUWMANN - Now error is:

E:\xampp\htdocs\jiwaji_university\public/storage/upload_pic/

vinubangs started a new conversation Download Files In Zip Using ZipArchive

I have a table articles:

id  |  volume_id  |  image

5    |            9        |   file1.pdf
6    |            9        |   file1.pdf

viewarticles.blade.php is:

<a href="{{ route('create-zip',['volume_id'=>$article->volume_id]) }}">Download ZIP</a>

web.php is:

Route::get('create-zip/{volume_id}', '[email protected]')->name('create-zip');

controller is:


use App\article;
use ZipArchive;

public function createzip($volume_id)
    {
      $articles = article::where('volume_id',$volume_id)->get();
       $file= public_path(). "/storage/upload_pic/"; 
             
               $zipFileName = 'AllDocuments.zip';
               $zip = new ZipArchive;
            
            if ($zip->open($file . '/' . $zipFileName, ZipArchive::CREATE) === TRUE) {
                foreach($articles as $article) {
                  $images = $article->image;
        $zip->addFile($file, $images);
    }        
    $zip->close();

            }
            // Set Header
            $headers = array(
                'Content-Type' => 'application/octet-stream',
            );
            $filetopath=$file.'/'.$zipFileName;
            // Create Download Response
            if(file_exists($filetopath)){
                return response()->download($file,$zipFileName,$headers);
            }
    }

After click on download button. Zip file of both images related with volume_id should be download.

But error occurs:

ErrorException (E_WARNING)
ZipArchive::close(): Read error: No such file or directory
13 Mar
4 months ago

vinubangs left a reply on How To Find Only Last Row From Second Table, Along With Its First Table Row

@JLRDW - I tried with normal SQL. And it is working.

But If I use normal SQL query in laravel then what will be the use of laravel query method!!

vinubangs left a reply on How To Find Only Last Row From Second Table, Along With Its First Table Row

@SNAPEY - last row means max(id) of related journal_id.

vinubangs left a reply on How To Find Only Last Row From Second Table, Along With Its First Table Row

@SNAPEY - volume5 is the last row of volume_id 2.

volume3 is the last row of volume_id1

And I want only both row. Not all rows.

vinubangs left a reply on How To Find Only Last Row From Second Table, Along With Its First Table Row

@JLRDW - I tried, but not working.

$resortData = DB::table('journals')
        ->select('journals.id','journals.journal_name', 'volumes.journal_id', 'volumes.volume_name', DB::raw("SELECT MAX(id)
        FROM volumes
        GROUP BY journal_id)"))
        ->Join('volumes', 'journals.id', '=', 'volumes.journal_id')
       ->get();

vinubangs started a new conversation How To Find Only Last Row From Second Table, Along With Its First Table Row

I have two tables. journals and volumes. Journal Table has unique rows, and volumes table have rows based on journal table id, name is journal_id(may be multiple).

journals table is:

id | journal_name

1  | journal1
2  | journal2

volumes table is:

id | journal_id | volume_name

1  |    1       |  volume1
2  |    1       |  volume2
3  |    1       |  volume3
4  |    2       |  volume4
5  |    2       |  volume5

Now I need join with row from journal table and only last rows of volumes based on journal_id.

Result should be:

id | journal_name | journal_id | volume_name

1  | journal1     |   1        |   volume3
2  | journal2     |   2        |   volume5

Not all the rows from volumes table. (Need only last rows from each group of journal_id).

required result from mysql query is:

SELECT J.journal_name,V.id,V.journal_id FROM journals AS J 
INNER JOIN (SELECT *
FROM volumes
WHERE id IN (
SELECT MAX(id)
FROM volumes
GROUP BY journal_id
)) AS V ON J.id = V.journal_id

Now my try in laravel is:

controller is:

public function index()
{
$volumes = volume::with('volumes')->orderBy('id','desc')->limit(1)->get();
    return view('welcome',compact('volumes'));
}

volume model is:

function volumes()
 {
      return $this->belongsTo(journal::class, 'journal_id');
 }

But it is giving only one row from entire volume table. I need last one row from each group of journal_id in volume table.

vinubangs left a reply on How To Find Last Row From Second Table, Along With Its First Table Row

My result should be like this:

SELECT TSM.training_subject_name,TMD.id,TMD.training_subject_id FROM training_subject_master AS TSM INNER JOIN (SELECT * FROM triaining_master_date WHERE id IN ( SELECT MAX(id) FROM triaining_master_date GROUP BY training_subject_id )) AS TMD ON TSM.id = TMD.training_subject_id

vinubangs left a reply on How To Find Last Row From Second Table, Along With Its First Table Row

@NEXXAI - Thank you for reply.

Your answer is giving one row from table.

But If there are different-different journal_id, then it is giving only first row. I think group by should also be include.

12 Mar
4 months ago

vinubangs started a new conversation How To Find Last Row From Second Table, Along With Its First Table Row

I have two tables. Journals and volumes.

Journals have fields id, journalname

volumes have fields id, journal_id, volumename

volumes have many rows with same journal_id.

controller method is:

public function index()
    {
       $volumes = journal::with('volume')->get();
        return view('welcome',compact('volumes '));
    }

model journal is:

use App\volume;

class journal extends Model
{
   function volume()
     {
          return $this->hasmany(volume::class, 'journal_id');
     }
}

Above is giving, all rows from volumes table along with its related journal_id.

But I need only last row from volumes table with its journals table.

vinubangs left a reply on Redirect View After Download Pdf

I have two tables. Journals and volumes.

Journals have fields id, journalname

volumes have fields id, journal_id, volumename

volumes have many rows with same journal_id.

controller method is:

public function index()
    {
       $volumes = journal::with('volume')->get();
        return view('welcome',compact('volumes '));
    }

model journal is:

use App\volume;

class journal extends Model
{
   function volume()
     {
          return $this->hasmany(volume::class, 'journal_id');
     }
}

Above is giving, all rows from volumes table along with its related journal_id.

But I need only last row from volumes table with its journals table.

10 Feb
5 months ago

vinubangs left a reply on Redirect View After Download Pdf

@DOUGLASAKULA - thank you for reply.

Can U please give me any example or any link?

vinubangs started a new conversation Redirect View After Download Pdf

Below is method in controller. I want to download pdf file and then redirect on view. How can it be possible?

public function insertdownloadpdf(Request $request)
    {
        $userdetails = new userdetail;

       $userdetails->name = $request->name;
       $userdetails->email = $request->email;
       $userdetails->designation = $request->designation;
       $userdetails->organisation = $request->organisation;
       $userdetails->number = $request->number;
       $userdetails->save();
       $pdffile = $request->pdfname;
       session()->put('username','Successfully Inserted');

     $file= public_path(). "/storage/upload_pic/";  //path of your directory
                $headers = array(
                    'Content-Type: application/pdf',
                );
        return $download = Response::download($file.$pdffile, 'articles.pdf', $headers);

         $journals = journal::all();
        $articles = article::where('volume_id',$request->volume_id)->with('journal','volume')->get();
   
       return view('viewarticles',compact('journals','articles','download'));
    }
09 Feb
5 months ago

vinubangs started a new conversation Laravel Join 3 Tables , One Data From First Two Table And Multiple Row From Third Table

I have 3 tables.

1st table- journals

id | journal_name 6 | xyz journal 7 | abc journal

2nd table- volumes

id | journal_id | volume_name 1 | 6 | volume1 2 | 6 | volume2 3 | 7 | volume3

3rd table- articles

id | journal_id | volume_id | articles 1 | 6 | 1 | volume1 2 | 6 | 1 | volume2 3 | 7 | 3 | volume3 4 | 7 | 3 | volume4

Now, If clicks on journalname, then volumename shows and clicks on volumename then related articles open.

But I need one time journal_name and volume_name. AND multiple times articles.

CONTROLLER METHOD IS:

public function viewarticles($id)
    {
        $articles = article::where('volume_id',$id)->with('journal','volume')->get();
        return view('viewarticles',compact('articles'));
    }

ARTICLE MODEL IS:

function journal()
     {
          return $this->belongsTo(journal::class, 'journal_id');
     }
     function volume()
     {
          return $this->belongsTo(volume::class, 'volume_id');
     }

It is giving all tables multiple times. What to do.

29 Nov
7 months ago

vinubangs left a reply on How To Convert Html To Pdf By DOM-PDF With Proper HTML Design

@PETRIT - Thanks for suggestion. setPaper() is not working with my query.

But I think, that link given by you should help me.

I have a another question. When I click on anchor to convert into PDF. Then it is taking too much time. Why?

vinubangs started a new conversation How To Convert Html To Pdf By DOM-PDF With Proper HTML Design

I am using DOM-PDF for converting HTML to PDF in LARAVEL 5.4 PDF conversion is good. But HTML page design is disturbing.

showalumni.blade.php:

<div class="panel-body panel-body-com-m">
<a href="{{ URL('pdf/'.$showalumni->id) }}">Download to pdf</a>
<hr>
  <label>Name : </label>
  <input type="text" class="form-control1 control3" value="{{ $showalumni->name }}"  required readonly readonly>
  <label>Father's Name :  </label>
  <input type="text" class="form-control1 control3" value="{{ $showalumni->f_name }}"  required readonly>
  <label>Gender :  </label>
  <input type="text" class="form-control1 control3" value="{{ $showalumni->gender }}"  required readonly>
  <label>College :  </label>
  <input type="text" class="form-control1 control3" name="colleges_name" value="{{ $showalumni->showcollege->colleges_name }}"  required readonly />
  <label>Course :  </label>
  <input type="text" class="form-control1 control3" placeholder="Course name...." name="courses_name" value="{{ $showalumni->showcourse->coursename }}"  required readonly />
</div>

route:

Route::resource('registeredalumnies','Admin\RegisteredAlumniesController');
Route::get('pdf/{id}','Admin\[email protected]');

Controller:

public function show($id)
{

    $showalumni = User::where('id',$id)->with('showcollege','showcourse')->first();
    return view('Admin.showalumni',compact('showalumni'));
}

public function download($id)
{

    $showalumni = User::where('id',$id)->with('showcollege','showcourse')->first();
    $pdf = PDF::loadView('Admin.showalumni', compact('showalumni'));
    return $pdf->stream('invoice.pdf');
}
27 Nov
7 months ago

vinubangs left a reply on How To Validate A Laravel Form Using JQuery Ajax

@SIGNAR - Thankyou Now it is working.

vinubangs left a reply on How To Validate A Laravel Form Using JQuery Ajax

@SIGNAR - I updated my controller by:

public function varifyemail(Request $request)
{
    $email = User::where('email', $request->email)->get();

    if (count($email) > 0) {
        return response()->json(['false' => false]);
    } 

    return response()->json(['success' => true]);
}

public function varifycontact(Request $request)
{
    $contact = User::where('contact', $request->contact)->get();

    if (count($contact) > 0) {
        return response()->json(['false' => false]);
    }

    return response()->json(['success' => true]);
}

And view ajax is:

<script type="text/javascript">
$(document).ready(function() {
// - validation
    if($('#Frm_sign').length > 0){
        
        $('#Frm_sign').validate( {
        rules:{
        
         email:{
                       
                       remote: {
                                url: "{{url("varifyemail")}}",
                                type: "GET",
                                data: {                                          
                                         email: function() {
            return $( "#email" ).val();
          }
                                      }                         
                          
                               }
              },
              
         contact:{
                       
                       maxlength:10,
                       minlength:10,
                       remote: {
                                url: "{{url("varifycontact")}}",
                                type: "GET",
                                data: {                                          
                                         contact: function() {
                                                     return $( "#contact" ).val();
                                                   }
                                      }                         
                          
                               }
              },
              
              
        
         password : {
                      equalTo: "#repass"
            }
           
          },
        messages: {
           
          email:      {
            
                        remote:"Email id already registred"
                        },
         contact:          {
                        remote:"Mobile number already registred",                       
                        maxlength : "Please enter valid mobile number",
                        minlength : "Please enter valid mobile number"
                        },
         password:          {
                        equalTo:"Password is not equal"
                        }
        
                   },
        
        submitHandler: function (form) {
                  
            form.submit();
        },
         errorPlacement: function (error, element) {
                error.appendTo(element.parent());
        }
        
        
        });
        
    }
    
});
</script> 

Now no error. And in my console everything is good. And it is showing {"success":true}.

But message for email or contact is not showing, if email or contact exist.

vinubangs left a reply on How To Validate A Laravel Form Using JQuery Ajax

@CAC - I want to validate form without reload. And I want to do this thing with AJAX way.

And I have already added LARAVEL validation in my form.

vinubangs left a reply on How To Validate A Laravel Form Using JQuery Ajax

@SIGNAR - (1/1) UnexpectedValueException The Response content must be a string or object implementing __toString(), "boolean" given.

vinubangs left a reply on How To Validate A Laravel Form Using JQuery Ajax

@SIGNAR - (1/1) FatalErrorException syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ']'

in RegisterController.php line 62

vinubangs left a reply on How To Validate A Laravel Form Using JQuery Ajax

@SIGNAR - I tried, but error is

(1/1) UnexpectedValueException The Response content must be a string or object implementing __toString(), "boolean" given.

vinubangs started a new conversation How To Validate A Laravel Form Using JQuery Ajax

I'm trying to validate a Laravel form via jQuery/Ajax. I have two form fields: 'email' and 'contact.' If anyone types in email and it's already registered then it will show "Email id already registered". And same like in contact. I have done it in PHP. However, it's not working in the view.

register.blade.php


<form method="POST" action="{{ route('register') }}" id="Frm_sign" name="Frm_sign">
    {{csrf_field()}}
    <div class="form-group col-md-6 col-sm-6">
        <label for="arrival">Contact No*</label>
        <input type="text" class="form-control input-sm required digits" id="contact" name="contact"
               value="{{ old('contact') }}" placeholder="">
    </div>

    <div class="form-group col-md-6 col-sm-6">
        <label for="arrival">Email id*</label>
        <input type="text" class="form-control input-sm email required" id="email" name="email"
               value="{{ old('email') }}" placeholder="">
    </div>

    <div class="col-md-12 col-sm-12">
        <div class="form-group col-md-3 col-sm-3 pull-right">
            <input type="submit" class="btn btn-primary" value="Submit" name="submit"/>
        </div>
    </div>
</form>

<!-- form validation -->
<script type="text/javascript">
    $(document).ready(function () {
// - validation
        if ($('#Frm_sign').length > 0) {
            $('#Frm_sign').validate({
                rules: {
                    email: {
                        remote: {
                            url: "{{url("varifyemail")}}",
                            type: "GET",
                            data: {
                                action: function () {
                                    return "1";
                                },
                            }
                        }
                    },
                    contact: {
                        maxlength: 10,
                        minlength: 10,
                        remote: {
                            url: "{{url("varifycontact")}}",
                            type: "GET",
                            data: {
                                action: function () {
                                    return "2";
                                },
                            }
                        }
                    },
                    password: {
                        equalTo: "#repass"
                    }
                },
                messages: {
                    email: {
                        remote: "Email id already registred"
                    },
                    contact: {
                        remote: "Mobile number already registred",
                        maxlength: "Please enter valid mobile number",
                        minlength: "Please enter valid mobile number"
                    },
                    password: {
                        equalTo: "Password is not equal"
                    }
                },

                submitHandler: function (form) {

                    form.submit();
                },
                errorPlacement: function (error, element) {
                    error.appendTo(element.parent());
                }
            });
        }
    });
</script>

In Ajax, there is password also but it's working, so I didn't write the password field here.

Route

Route::get('varifyemail','Auth\[email protected]');
Route::get('varifycontact','Auth\[email protected]');

RegisterController

public function varifyemail(Request $request)
{
    $email1 = User::where('email', $request->email)->get();
    if($email1->email > 0)
    {
        echo json_encode(false);
    } else {
        echo json_encode(true);
    }
}

public function varifycontact(Request $request)
{
    $contact1 = User::where('contact', $request->contact)->get();
    if($contact1->contact > 0)
    {
        echo json_encode(false);
    } else { 
        echo json_encode(true);
    }
}
25 Nov
7 months ago

vinubangs left a reply on How To Select, Selected Option Based On First Select Option After Reload Page

@realrandyallen Thankyou for reply.

I added $("#courses_name").trigger("change"); And works fine. But selected option in not showing.

vinubangs started a new conversation How To Select, Selected Option Based On First Select Option After Reload Page

I have two select otion in register.blade.php:

If any one clicks on option B.E./B.TECH. OR DIPLOMA of Name of Course. Then based on selected Name of Course select option, result will be show in Name of Branch. All are working nice.

But Here text field Name is required and validation is set in controller. Now if I did't fill name and select DIPLOMA from option first then result shows in second option field. And I select any option from results and submit the form. Then form will be redirect on register.blade.php, because of Name required. And selected option hide.

I want after submit the form, if redirect on same page then Name of Branch field should be show with selected option, If it has been selected.

<form action="route('register')" method="post">
<div class="form-group col-md-6 col-sm-6">
<label for="name">Name* </label>
<input type="text" class="form-control input-sm required" id="alumni_name" name="alumni_name" placeholder="" value="{{ old('alumni_name') }}">
<span style="color: red;">{{ $errors->first('alumni_name',':message') }}</span>
</div>

<div class = "form-group col-md-6 col-sm-6"> 
<label for="years">Name of Course*</label> 
<select class="form-control input-sm required" id="courses_name" name="alumni_course"> 
<option value="">-- Select Any one --</option> 
@foreach($coursename as $coursenames) 
<option value="{{ $coursenames->id.','.$coursenames->coursename }}" {{ old('alumni_course') == $coursenames->id.','.$coursenames->coursename ? 'selected' : '' }} >{{ $coursenames->coursename }}</option> 
@endforeach 
</select>
<span style="color: red;">{{ $errors->first('alumni_course',':message') }}</span> 
</div>

<div class = "form-group col-md-6 col-sm-6" id="dvPassport" style="display:none"> 
<label for="years">Name of Branch*</label> 
<select class="form-control input-sm required" id="branch_name" name="alumni_branch">
@include('auth.branchfind') 
</select> 
</div>
<input type="submit" value="SAVE">
</form>

AJAX on same page:

<script type="text/javascript">
  $(document).ready(function(){
     $("#courses_name").change(function(){
         var courses_name1 = $("#courses_name").val();
         var courses_name2 = courses_name1.split(",");
         var id = courses_name2[0];
         var courses_name2 = courses_name2[1];
         if(courses_name2 == 'B.E./B.TECH.' || courses_name2 == 'DIPLOMA')
         {
         $("#dvPassport").show();
         $.ajax({
            type: "GET",
            url: "{{url("findbranch")}}",
            data: {'id': id},
         }).done(function(data){
            $("#branch_name").html(data);
              //console.log(data);
         });
         }
         else {
            $("#dvPassport").hide();
        }
      });
   });
</script>

branchfind.blade.php is:

<option value=''>Select Any One</option>
@if(isset($branchname)) 
@foreach($branchname as $branchnames) 
<option value="{{ $branchnames->id }}" {{ old('alumni_branch') == $branchnames->id ? 'selected' : '' }} >{{ $branchnames->branchname }}</option> 
@endforeach 
@endif

function in controller for AJAX request is:

public function findbranch(Request $request)
{
     $branchname = branchname::where('course_id', $request->id)->get();
    return view('auth.branchfind')->with(compact('branchname'))->render();
}
23 Nov
7 months ago

vinubangs left a reply on How To Return Data From Ajax To Select Tag

@SHABEEBM369 - its (2/2) ErrorException Undefined variable: collegename (View: F:\xampp\htdocs\millennium_alumni_laravel\resources\views\auth\register.blade.php)

vinubangs started a new conversation How To Return Data From Ajax To Select Tag

I have two select tag.

<div class = "form-group col-md-6 col-sm-6">
          <label for="years">Name of Course*</label>     
     
          <select class="form-control input-sm required" id="courses_name" name="alumni_course">
        <option value="">-- Select Any one --</option>
        @foreach($coursename as $coursenames)
        <option value="{{ $coursenames->id.','.$coursenames->coursename }}" >{{ $coursenames->coursename }}</option>
        @endforeach
          </select>
    </div>
    <div class = "form-group col-md-6 col-sm-6" id="dvPassport" style="display:none">
          <label for="years">Name of Branch*</label>     
     
          <select class="form-control input-sm required" id="branch_name" name="alumni_branch">
            @if(isset($branchname))
            @foreach($branchname as $branchnames)
        <option value="{{ $branchnames->id }}" >{{ $branchnames->branchname }}</option>
        @endforeach
        @endif
          </select>
    </div>

If from Name of Course option, any one select B.E./B.TECH. or DIPLOMA, then Name of Branch will be show and data will be related B.E./B.TECH. or DIPLOMA.

MY ajax in same page:

<script type="text/javascript">
      $(document).ready(function(){
         $("#courses_name").change(function(){
             
             var courses_name1 = $("#courses_name").val();
             var courses_name2 = courses_name1.split(",");
             var id = courses_name2[0];
             var courses_name2 = courses_name2[1];
             if(courses_name2 == 'B.E./B.TECH.' || courses_name2 == 'DIPLOMA')
             {
             $("#dvPassport").show();
             $.ajax({
                type: "GET",
                url: "findbranch",
                data: {'id': id},
             }).done(function(data){
                $("#branch_name").html(data.html);
                  //console.log(data);
             });
             }
             else {
                $("#dvPassport").hide();
            }
          });
       });
</script> 

Route is:

Route::get('findbranch','Auth\[email protected]');

Controller is:

public function findbranch(Request $request)
    {
        $branchname = branchname::where('course_id', $request->id)->get();
        $html = view('auth.register')->with(compact('branchname'))->render();
        return response()->json(['success' => true, 'html' => $html]);
   }

But data is not showing in Name of Branch

vinubangs left a reply on When I Add Asset() In Js Then It Gives Error

@munazzil Thank you for support.

But I got my problem. It was y mistake.

I forgot to close one src bracket.

Sorry for disturb.

vinubangs left a reply on When I Add Asset() In Js Then It Gives Error

@munazzil thanks for reply

But, there is no problem with all.js

When I remove

then it working fine. ANd if I set again this js. Then it is giving error.

And also I removed public. BUt error is same.

vinubangs started a new conversation When I Add Asset() In Js Then It Gives Error

In layouts->frontsection.blade.php

'''

@yield('content')

'''

In welcome.blade.php:

''' @extends('layouts.frontsection')

@section('content')

hgjh

@endsection '''

But it is giving error: (1/1) FatalErrorException syntax error, unexpected 'content' (T_STRING)

in e9ee1795cf3bd4e8573cbfa0d0ae3ba613ea37f8.php line 106

But when I remove js file it is OK and running sccessfully.

19 Nov
7 months ago

vinubangs left a reply on How To Join The Two Table With Eloquent In Laravel 5.4

realrandyallen: I got error

(2/2) QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'coursenames.branchname_id' in 'where clause' (SQL: select * from coursenames where coursenames.branchname_id in (2, 4, 5, 6))

vinubangs left a reply on How To Join The Two Table With Eloquent In Laravel 5.4

Thank you for reply.

->get(); is not eloquent.

Generally, ->get() used in querybuilder.

vinubangs started a new conversation How To Join The Two Table With Eloquent In Laravel 5.4

I am learning Laravel 5.4. But I have stuck in one place.

I have two tables coursenames and branchnames.

branchnames table contains: id, branchname, course_id

coursenames table contains: id, coursename

coursename has a unique name, and course_id of branchnames has an id of coursename, which can be repeated.