Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

johnw65

johnw65

Member Since 7 Months Ago

Experience Points
10,420
Total
Experience

4,580 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
92
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 3
10,420 XP
Nov
04
2 weeks ago
Activity icon

Replied to Verify If A File Exists And Create A Hyper Link

Automica,

Thank you very much! I can work with this one!

Activity icon

Replied to Verify If A File Exists And Create A Hyper Link

Automica, Should of clarify... they are already there so there is a folder. But depending on the type of PDF, the file_name is different since the NETWORK_LOCATION AND Date_Departure can vary.

Are you displaying a single record (eg single product) and then appending a link to pdf for that document if it exists? YES

Activity icon

Replied to Verify If A File Exists And Create A Hyper Link

Automica,

Thanks, I'm new to Laravel, so in my controller, how would I build the file_name from the controller: file_name = NETWORK_LOCATION || '' || TO_CHAR(date_departure, 'YYYY') || '' || 'OC' || LPAD(sequence_id,6,0) || '_Test.PDF'

and display it as a href=""

in a blade template so when then user clicks on the link, they can view the document.

Activity icon

Started a new Conversation Verify If A File Exists And Create A Hyper Link

I have a PDF document and need to see if the file exists. If it exits, need to create a hyperlink: < a href="">Document. If the file does not exist, then need to display a message stating that no file exits.

Additional Information:

  1. The NETWORK_LOCATION, date_departure are values stored in the database. So both the NETWORK_LOCATION and date_departure will be coming from a controller.

The file location is: NETWORK_LOCATION\TO_CHAR(date_departure, 'YYYY')\OC\000012_Test.PDF

So the file location is dynamic and based on NETWORK_LOCATION AND date_departure.

  1. Also, need to make sure that LPAD has a total of 6 characters. So if the sequence number is 12, then it should pad it with leading zeros (000012).

Here is the pseudo code;

file_name = NETWORK_LOCATION || '' || TO_CHAR(date_departure, 'YYYY') || '' || 'OC' || LPAD(sequence_id,6,0) || '_Test.PDF'

Thank you in advance.

Activity icon

Awarded Best Reply on JQuery: Contine With Code After A Response From Boostrap Modal

I found the solution and is posting it to help others. Thanks

//if there is formChanged detected
 if (formChanged){

 //display modal
   $('#responseModal').modal('show');

    //off to prevent multiple firing of gotoNextRecord
    //if modal response is stop_nav, then return
    $('#stop_nav').off('click').on('click', function(){
         return;
      });

   //if continue button is pressed, then go to next record
    $('#continue_nav').off('click').on('click', function(){
         gotoNextRecord(id);
    });
      
  }

  else {
      gotoNextRecord(id);
  }
Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal

I found the solution and is posting it to help others. Thanks

//if there is formChanged detected
 if (formChanged){

 //display modal
   $('#responseModal').modal('show');

    //off to prevent multiple firing of gotoNextRecord
    //if modal response is stop_nav, then return
    $('#stop_nav').off('click').on('click', function(){
         return;
      });

   //if continue button is pressed, then go to next record
    $('#continue_nav').off('click').on('click', function(){
         gotoNextRecord(id);
    });
      
  }

  else {
      gotoNextRecord(id);
  }
Oct
16
1 month ago
Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal

That code doesn't work: so here is the code that I have a test code that I have written so far. It doesn't wait for any response and directly runs the ajax script which goes to the next record and performs a retrieve. I know it's something simple that I'm missing.

$("#next, #prev").click(function(){
  event.preventDefault();

  //set the mode to navigation to prevent triggering validation
  sMode ='navigation';
  //check what button was clicked  
  var button_clicked = $(this).attr('id');

  //if changed, alert user


  //if there is a form change
  if (formChangedDetected){
    //show the modal
    $('#responseModal').modal('show');

    //if continue button is pressed, hide modal and continue with ajax
    $('#responseModal').on('click', '#continue_nav', function(e) {
        $('#responseModal').modal('hide');
    });

    //if stop button is pressed, stop so the user can perform an update
    $('#responseModal').on('click', '#stop_nav', function(e) {
        $('#responseModal').modal('hide');
        return false;
         
    });

  }
  else{
    alert("else")
  }

//continue with ajax operation

//ajax scripts to retrieve the next record
  

});
Oct
15
1 month ago
Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal

I know I'm missing something basic. So how can I execute my Ajax after I get a response from the modal. Thanks.

Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal


//Modal:  Continue without saving Changes allow to execute the Ajax, else, it should just return so the user can save the record.
<div class="modal fade" id="formChangeModal" tabindex="-1" role="dialog" aria-labelledby="formChangeModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h3 class="modal-title" id="formChangeModalLabel">Reminder</h3>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        Do you want to continue without saving any changes?
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary"  id="stop_nav" class="modal_close">Yes</button>
        <button type="button" class="btn btn-primary"  id="continue_nav" class="modal_close">No</button>
      </div>
    </div>
  </div>
</div>
Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal


//Modal:  Continue without saving Changes allow to execute the Ajax, else, it should just return so the user can save the record.
<div class="modal fade" id="formChangeModal" tabindex="-1" role="dialog" aria-labelledby="formChangeModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h3 class="modal-title" id="formChangeModalLabel">Reminder</h3>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        Do you want to continue without saving any changes?
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary"  id="stop_nav" class="modal_close">Yes</button>
        <button type="button" class="btn btn-primary"  id="continue_nav" class="modal_close">No</button>
      </div>
    </div>
  </div>
</div>
Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal

Sinnbeck,

I'm using Boostrap 4 Modal. Thanks!

Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal

$("#next, #prev").click(function(){

 event.preventDefault();
  
//if it's a modified record, then I want a modal asking the user if they wish to navigate to the next record without saving with Yes/No.

//if the formChanged then show modal
if (formChanged){

//show modal

}


//but the code does not wait and continue to execute the ajax below


$.ajax({
    type:'get',
    url:"test/searchrecord/"+id,   
    dataType: 'JSON',
    headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
  
    success: function (data) { 
   //retreives and populates the form with data
Activity icon

Replied to JQuery: Contine With Code After A Response From Boostrap Modal


$("#next, #prev").click(function(){

 event.preventDefault();
  
//if it's a modified record, then I want a modal asking the user if they wish to navigate to the next record without saving with Yes/No.

//if the formChanged then show modal
if (formChanged){

//show modal

}


//but the code does not wait and continue to execute the ajax below


$.ajax({
    type:'get',
    url:"test/searchrecord/"+id,   
    dataType: 'JSON',
    headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
  
    success: function (data) { 
   //retreives and populates the form with data
Activity icon

Started a new Conversation JQuery: Contine With Code After A Response From Boostrap Modal

Using JQuery, the application open up a bootstrap modal which asks whether the user want to continue or stop with saving the data via ajax.

Unfortunately, it doesn't wait for continue or stop button to be clicked and processes the rest of the code which is running an ajax update. What is the best way to continue with the code after a response from Bootstrap Modal. Thanks in advance.

Oct
09
1 month ago
Activity icon

Replied to Reading A File From A Network Drive

Thanks... let me try it!

Activity icon

Replied to Reading A File From A Network Drive

Laracoft, Thanks!

New to Laravel, so if I want to display a mapped drive called main1 and main2 under storage/app, how do I configure the filesystems.php.

I need to dynamically retrieve and link the files that are in sub-directory so the users can view them where the path are stored in a table. For the example below, I have a record table that stores the path which is main1 and main2. So how I can I access the files in main1 and main2 sub-directory in a controller such as shown below so the users can click on a link an access each files.

main1\test\file.txt main1\test\file2.txt main1\other\file4.txt

main2\folder1\file.txt main2\folder2\new.txt main2\folder3\test.txt

Oct
08
1 month ago
Activity icon

Started a new Conversation Reading A File From A Network Drive

I'm relatively new to Laravel and I have a mapped drive on a separate server that contains lets say PDF documents. I need to create a link so when a user click on the link, that it can open up that particular pdf file. So it's just purely reading the documents.

What is the best approach of accomplishing this. How can I access the mapped drive using Laravel. Thank you in advance.

Sep
29
1 month ago
Activity icon

Started a new Conversation Pagination With Two Methods Of Navigation

I'm relatively new to Laravel and would like to implement pagination. For example, when a user performs a ajax search, it retrieves the record and populates a side menu with a list of full_name and date_travel:

$.each(data.result.data, function(index) {

            counter = index + 1;
              $("#search_result").append('<li><a href="test/fetch/"+data.result.data[index].id+>'+counter+'     '+data.result.data[index].full_name+':     '+data.result.data[index].date_travel+'</a></li>');
          });
        }



Also, ajax search will display the first record on the form.  The form will also have a paginate method, but just be able to go to the previous record and next record only.


So the user will have the ability to look at side menu and click on the record or press the previous/next button to navigate record by record.

What is the best method of syncing the list with the previous and next record using ajax so a user can perform a update on a form using pagination.  

Thank you in advance.
Activity icon

Awarded Best Reply on Displaying Oracle Blob Image Using Ajax

I was able to finally resolve my issue using Ajax to retrieve Oracle Blob column. Hope this helps others.

$pic_employees = DB::table('image_db')      
         ->where ('employee_id','=', $id)
       ->get();



//Need to base encode row separately:  which is what I missed before
//without it one will encounter an error message of :  Malformed UTF-8 characters, possibly incorrectly encoded."
//so just add the additional code below

foreach($pic_employees as $row) {
              $row->pic = 'data:image/png;base64,' . base64_encode( $row->pic);
  }



 return response()->json(array('result' => $pic_employees));
Activity icon

Replied to Displaying Oracle Blob Image Using Ajax

I was able to finally resolve my issue using Ajax to retrieve Oracle Blob column. Hope this helps others.

$pic_employees = DB::table('image_db')      
         ->where ('employee_id','=', $id)
       ->get();



//Need to base encode row separately:  which is what I missed before
//without it one will encounter an error message of :  Malformed UTF-8 characters, possibly incorrectly encoded."
//so just add the additional code below

foreach($pic_employees as $row) {
              $row->pic = 'data:image/png;base64,' . base64_encode( $row->pic);
  }



 return response()->json(array('result' => $pic_employees));
Activity icon

Replied to Displaying Oracle Blob Image Using Ajax

Snapey,

I should of clarify. In my main.blade.php, I have a button with id = "get_employee_info" so this run ajax to retrieve employee's information and set the form for update. At this time, they need to see the employee's picture in the image_db table which is an Oracle blob column.

I tried to retrieve the blob column and try to set the image, but is unable to do so using ajax. I get the following error message : "Malformed UTF-8 characters, possibly incorrectly encoded."

So I'm trying to see whether I can display the image using image_load.php which displays the record correctly. So on the clicked event of get_employee_info, I want to run image_load.php by passing the employee_id so one can view the image.

Even better, if I can pass the blob via ajax that will be great. I'm getting: "Malformed UTF-8 characters, possibly incorrectly encoded. Here is the code that I'm using to pass the image via ajax:

$pic_employees = DB::table('image_db')      
         ->where ('employee_id','=', $id)
       ->get();
 return response()->json(array('result' => $employee));```
Activity icon

Replied to Displaying Oracle Blob Image Using Ajax

Sinnbeck,

How can I render the below statement to html from the controller and out put them in ajax? <img class="resize_image" src="data:image/png;base64,{{ chunk_split(base64_encode($pic_employees->pic)) }}">

Activity icon

Replied to Displaying Oracle Blob Image Using Ajax

Yes, I know how to check it, but how can I rerun the query each time in Ajax passing different ID and display different image. Thanks Sinnbeck!

Activity icon

Replied to Displaying Oracle Blob Image Using Ajax

Thanks for the info...

Activity icon

Started a new Conversation Displaying Oracle Blob Image Using Ajax

I'm relatively new to Laravel, but what I want to do is that I have a image_load.php

  @foreach ($pic_employees as $row)
             
                <div class="image_box responsive"><img class="resize_image" src="data:image/png;base64,{{ chunk_split(base64_encode($pic_employees->pic)) }}"></div>
                 
    @endforeach
@endif

//Here is my controller:
$pic_employees = DB::table('image_db')      
         ->where ('employee_id','=', $id)
       ->get();

so i'm my main.blade.php I have section called image_display where I want to display one image only

<div id="image_display>

</div>

1.  so in a clicked event of a button on my main.blade.php, how can I run the query so it will run the query and  load the one image by passing the id.  

2.   another question that is there a way to rerun one the query using ajax or similar to refreshing.


Updated:  The reason I'm doing this is that I have an Oracle Blob image column that my customer wants me to view.  However, I was unable to achieve this using Ajax to return the Blob.  But the above code displays the image, but I just need to run the query when a user clicks on a button and that will display the image.  

Thank you in advance.
Aug
19
3 months ago
Activity icon

Awarded Best Reply on Display Oracle Blob (Image)

I found the solution. To view an Oracle Blob field , just include the following code in the view where pic is the blob field.

@foreach ($data as $row) <img src="data:image/jpg;base64,{{ chunk_split(base64_encode($row->pic)) }}" @endforeach

Activity icon

Replied to Display Oracle Blob (Image)

I found the solution. To view an Oracle Blob field , just include the following code in the view where pic is the blob field.

@foreach ($data as $row) <img src="data:image/jpg;base64,{{ chunk_split(base64_encode($row->pic)) }}" @endforeach

Activity icon

Replied to Display Oracle Blob (Image)

Sinnbeck, Had to go back and edit my question since all of the codes were hidden. Thanks in advance.

Aug
18
3 months ago
Activity icon

Started a new Conversation Display Oracle Blob (Image)

I'm new to Laravel, but I have the following code on my controller below.

namespace App\Http\Controllers; use Validator;

use Illuminate\Http\Request; use DB;

use App\Images; use Image;

class DisplayImageController extends Controller {

 public function index()

{
    {

$data = DB::table('image_pic_table')->get();
           
    return view('displayimage', compact('data'));
}
        
   
}

}

Now on my displayimage.blade.php, I just want to display the jpg images from the Blob column using foreach loop. The name of image_pic_table have two columns: contact_id (integer), and picture which is a blob column so I want to be able to display both the contact_id along with the picture in a table format.

Thanks in advance.

Aug
12
3 months ago
Activity icon

Replied to Need To Track And Monitor Oracle DB Connection

We are migrating from a legacy system to a web application and it's a requirement. So I need to be able to actually see the database connection for each Oracle database user in a v$session.

Aug
11
3 months ago
Activity icon

Started a new Conversation Need To Track And Monitor Oracle DB Connection

I'm new to Laravel, and want to perform the following:

  1. Currently, my development website connect as an 'Admin' user, but want to know if there is a way to log into the web application using their database username and password. So when they enter their username and password, that it will connect to the database using both the user name and password

  2. The reason is that that we need to monitor user activity at the database level, and would like to know who is currently connected to the database. Thank you in advance.

Jul
16
4 months ago
Activity icon

Awarded Best Reply on Multiple Queries

I think I found the answer by Googling:

Route::get('member', '[email protected]');

class MemberController extends BaseController {

public function showForm(){
    $problemsCat1 = $this->problems->getProblemsByCategory(1);
    $problemsCat2 = $this->problems->getProblemsByCategory(2);
    $cities = $this->city->getAllCitites();
    return View::make('memberForm', compact('problemsCat1', 'problemsCat2', 'cities'));
}

}

Activity icon

Replied to Multiple Queries

I think I found the answer by Googling:

Route::get('member', '[email protected]');

class MemberController extends BaseController {

public function showForm(){
    $problemsCat1 = $this->problems->getProblemsByCategory(1);
    $problemsCat2 = $this->problems->getProblemsByCategory(2);
    $cities = $this->city->getAllCitites();
    return View::make('memberForm', compact('problemsCat1', 'problemsCat2', 'cities'));
}

}

Activity icon

Started a new Conversation Multiple Queries

I'm new to Laravel.

I have a data entry form that requires multiple queries to populate the data entry form but also the drop down from different tables. What is the best way of populating the form including the drop downs without using AJAX. Lets say that I have one controller to display information for the main form, and have 5 different drop downs that requires 5 different queries using Controller/Query Builder. How can this be accomplished? How would I set up the routes? Thank you advance.

Jul
15
4 months ago
Activity icon

Replied to Basic Drop Down

Michael,

I got the following error: Call to a member function isNotEmpty() on string.

I know this can't be this hard, but I'm new to Laravel....

How can I test whether it's retrieving data from $products from main view. Do I need to include this in my web.php route? Thanks in advance.

Activity icon

Replied to Basic Drop Down

James, thanks for you assistance. When I ran the code, I received the following error:

Invalid argument supplied for foreach()

So do I need to add this route to my web.php. Apologize for asking basic question... I have years of programming experience, but new to Laravel.

Activity icon

Started a new Conversation Basic Drop Down

I'm new to Laravel and is currently using Laravel 7. I just need to create a dropdown (product_id, description) , not using ajax, so users can select and eventually update then entire form.

So if I'm using this example controller:

public function test (Request $request)

{

$products = Product::pluck('name', 'id');

$selectedID = 2;

return view('main.index', compact('id', 'products'));

}

My main.blade.php I have the drop down

Select Product @foreach ($products as $key => $value)
<option value="{{ $key }}" {{ ( $key == $selectedID) ? 'selected' : '' }}> 

    {{ $value }} 

</option>

@endforeach

when I try to run this, it cannot find $products on my main.blade.php and end up with an error. How does it know that $products is coming from this controller? Doesn't seem like it's calling the controller.

Also, how can I dynamically pass the selectedID, so I can set it to the initial value on a form retrieve.

So do I need to add additional routes for this? I'm at a lost. Thanks!

Jun
26
4 months ago
Activity icon

Replied to Encryption Of ID

I think I'm going to use a combination of methods: Authorization and UUID. Really appreciate your assistance!

Activity icon

Replied to Encryption Of ID

I understand but since this is considered a "unique value", I believe I then will need to encrypt this value.

Activity icon

Replied to Encryption Of ID

In an environment that I'm working on, sensitive data needs to be encrypted including the primary key (ID) and other sensitive data such as SSN. That is just a requirement. If possible, I really don't want to pass the primary key value, but I would need to delete and update data without the primary key. So when using a database, I currently have a hidden ID field for each row and when an user updates the form, it passes the primary key (ID) to update and delete. So if I can just update records without passing any data which identifies that particular row (ID) that is preferable. If the ID needs to be passed, then it needs to be encrypted.

Activity icon

Replied to Encryption Of ID

Thank you for the feedback, but lets say I'm trying to update a User table I want to update an user with id = 3 via form, then how would I implement this? In my controller, I have an update statement:

update users set first_name='Test' where ID = ID.

Thanks in advance.

Activity icon

Started a new Conversation Encryption Of ID

I'm new to Laravel, and is currently using Laravel's Datatable. It's a requirement that I encrypt the value of a primary key (ie. ID) which could be either passed as a hidden field or in an URL. What is the best way to implement this. Currently, in the Datatable, I have it hidden, but one can still view the passed value of an ID via browser's Developer's Tool.

Even when I'm not using Laravel's DataTable, I like to encrypt certain fields including the primary key for the entire web site. Thank you in advance.

Activity icon

Replied to Track User Links

Thank you !

Jun
23
5 months ago
Activity icon

Started a new Conversation Track User Links

I'm relatively new to Laravel so this is likely a simple questions. I have a database driven menu and each of the menu have an id associate with it. There are many links. I want to keep track of all of the links that a user visited using an insert statement. What is the best way to implement this? Do I create a listener and pass the ID so I can perform an insert statement? Thanks in advance.

May
26
5 months ago
Activity icon

Started a new Conversation Oracle Sequence Number

I'm new to Laravel, and I need to insert an oracle sequence number as the product_id then insert them in Test_Table.

$test_key= DB::select('SELECT new_sequence.NEXTVAL as seq_gen FROM DUAL');

DB::table('Test_Table')->insert(['product_id'=>$test_key, 'second'=>$second, 'another_field'=>$third);

I'm getting error when trying to pass $test_key... it's an array and not an integer. How can I just convert it to an integer. Thanks