vincej

vincej

Member Since 5 Years Ago

Calgary, Canada

Experience Points
43,250
Total
Experience

1,750 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
186
Lessons
Completed
Best Reply Awards
2
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.

Level 9
43,250 XP
Nov
08
2 weeks ago
Activity icon

Replied to Route List Not The Same As Web.php

Hallelujah!!! It is fixed!! I followed @jaytee suggestion. Deleted the vendor file and did a composer install of 5.8. And now it is behaving again !!

Thank you all for your recommendations and help - I would never have got there on my own.

Now I am going to upgrade to v 6.0 fingers crossed ! :o)

Cheers From Canada !

Activity icon

Replied to Route List Not The Same As Web.php

@jaytee v 5.8

@connecteev I'm going for a fresh install on v 6.0 .... that's also proving to be a pain in the ass. Composer keeps saying that it wants : carbon v 1.2 ... WTF I can't win. I'm going to post a new question on this.

Nov
07
2 weeks ago
Activity icon

Replied to Route List Not The Same As Web.php

Thanks for that. Nope... no hope. Back to a fresh install.

Activity icon

Replied to Route List Not The Same As Web.php

@talinon Nope .. I am running the full command off a Linux terminal

Activity icon

Replied to Route List Not The Same As Web.php

@nakov I run everything straight off of Linux Mint which is a derivative of Ubuntu 16.

@snapey I just did again, as per your suggestion and as per the previous attempt it had no effect. The rogue route is still there, and there is no Bootstrap cache folder

Activity icon

Replied to Route List Not The Same As Web.php

Ok - I did as you suggested. I deleted ALL the routes leaving one only, and did a route list. Guess what ... they were still all there.

Creating a new project in PHPStorm is a real ball ache.

MANY THANKS ! Cheers from cold and snowy Canada.

Activity icon

Replied to Route List Not The Same As Web.php

that folder does not exist

Activity icon

Replied to Route List Not The Same As Web.php

Yes, of course.

However, I have deleted the route salesWorkOrder as well as the salesAndWorkOrder route and replaced it with a new route as per an earlier suggestion.

The new route does not show up on route:list and most concerning the very original route salesAndWorkOrder still does.

   | GET|HEAD  | salesAndWorkOrder/{id}                 | salesAndWorkOrder        | App\Http\Controllers\[email protected]                           | web,auth:admin          

Additionally I did a project wide search for salesAndWorkOrder and search comes up blank.

Furthermore, I have just copied across the contents of a web.php file from a few days ago where there was no salesAndWorkOrder and I am still getting this rogue route in my route:list

it's a mystery.

Activity icon

Replied to Route List Not The Same As Web.php

@nakov here it is - very big !


My Routes file has now been deleted. 

Activity icon

Replied to Route List Not The Same As Web.php

api/user is showing up in the route:list.

Activity icon

Replied to Route List Not The Same As Web.php

Thanks for your replies..

@nakov I have no routes in the api.php file other than the Laravel default.

Very concerning is that if I add a wholly new route, it does not show up in the route:list.

@talinon no I have done nothing to App/Providers/RouteServiceProvider.php

Activity icon

Replied to Route List Not The Same As Web.php

Additionally, when I look into Barry's debug bar it tells me there is no route being called. Furthermore, there is no Auth status reported in the debug bar. However, the controller uses auth:admin middleware.

The debug bar reports Auth thus:

web
array:2 [ "name" => "Guest" "user" => array:1 [ "guest" => true ] ]
admin
array:2 [ "name" => "Guest" "user" => array:1 [ "guest" => true ] ]

Activity icon

Replied to Route List Not The Same As Web.php

Thanks for the reply. Followed your instructions, but it didn't work. I still have the rogue route, and the URL still does not find correct route in web.php

However, something did occur which was weird: when running php artisan route:cache I got this back:

Route cache cleared!

In Route.php line 917:
                                                                       
Unable to prepare route [api/user] for serialization. Uses Closure.

Any more ideas?

Nov
05
2 weeks ago
Activity icon

Started a new Conversation Route List Not The Same As Web.php

I have done a php artisan cache:clear, route:clear, clear-compiled. And still when I do a route:list it refuses to reflect the one specific route as written within web.php. Instead it will list a route that I had described much earlier.

earlier route: salesAndWorkOrder

current route: salesWorkOrder

even if I change the route back to the earlier version it still does not find it, and I get a

NotFoundHTTPException

Ok - so thinking it was PHPStorm, I did an invalidate caches restart, and Nope.

The spelling is the same, the capitalisation is the same.

the route is being called out of a view using a forloop like this:

<a  style="font-weight: bold; text-decoration-line: underline;color: darkblue" href="/salesWorkOrder/{{$orders[$i]->reference}}" target="_blank"> {{ $orders[$i]->reference}}</a>

What am I doing wrong ??

Many thanks !

Activity icon

Replied to Error: Unexpected '@endforeach' In Blade

Heah Snapey ! Thanks very much for that ! I knew that I was being stupid. Sometimes I can get "word blind" ... or "code blind" especially at the end of the day !

Cheer!

Nov
01
3 weeks ago
Activity icon

Started a new Conversation Error: Unexpected '@endforeach' In Blade

I am clearly doing something stupid here, but can not see it. All I am trying to do is change the background colour of a <td> based on a simple condition, but I get this error:

syntax error, unexpected 'endforeach' (T_ENDFOREACH) (View: blah.blade.php)

@if($orders)
   @foreach( $orders as $order)
    <tr>
        <td class="col-sm-1 col-md-1"> {{ $order->product_name}}</td>
         <td class="col-sm-1  col-md-1"> {{ $order->product_id}} &nbsp;</td>
        <td class="col-sm-2  col-md-1 order_quanity"> <a  style="font-weight: bold; text-decoration-line: underline;color: darkblue" href="allocated_detail/{{$order->product_id}}" target="_blank"> {{ $order->order_quantity}}</a></td>
   
      @if($order->order_quantity < $order->stock_quantity )
         <td style="background-color: #e38d13" class="col-sm-1 "> {{ $order->stock_quantity}}</td>
      @else <td class="col-sm-1 "> {{ $order->stock_quantity}}</td>
      </tr>
   @endforeach
   @endif

Any ideas where I am going wrong? Many thanks !

Oct
14
1 month ago
Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

This has been a nightmare, but now it is all fixed and working. Don't know why things went so awry. First my DB was corrupted so it would not save. Fixed that. Then the POST in the Ajax would not return the correct response. Fixed that. Then the validation was not working. Then all my sessions for the view where messed up.

Anyway, thank you all for your input. I'm glad I'm past this. Learned some stuff along the way, which is always the benefit of experience.

Cheers !

Oct
11
1 month ago
Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

That is just me using a very bad way with bad language to describe a result. My controller does not return a view. It returns data to my Ajax call which then, if successful returns a view.

Snippet from the Controller

public function save_quote(Request $request)
    {

// Whole bunch of rules and messages.

 $validator = Validator::make($request->all(), $rules, $messages);
        if ($validator->passes()) {

//   Then save the form  here 

}

    if( $email == 'email') {
                Mail::to($customer['email1'])->send(new SendCustomerQuote($ref));
            }
            return response()->json(['success'=>'Added new records.']);
        }

        return response()->json(['error'=>$validator->errors()->all()]);
    }

Modified Ajax Call

    $("#saveQuotation").click(function () {
        event.preventDefault();
        var formData = $("#projectForm").serialize();
        $.ajax({
            headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
            type: "POST",
            url: '/save_quote',
            data: formData,

            success: function () {
                if($.isEmptyObject(data.error)){
                    localStorage['alert'] = 'true';
                    location.href = "/project_quote"  // Calls a fresh view here
                }else{
                    printErrorMsg(data.error);
                }
            },
            error: function () {
                alert('there has been a system level error - please contact support')
            }
        });
    });



Oct
10
1 month ago
Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

You are up late - you obviously don't need much sleep ! :o)

Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

Understood.

I found that snippet of code on the web, here: (https://www.itsolutionstuff.com/post/laravel-5-ajax-request-validation-exampleexample.html)

It appears that when ever you post FROM Ajax to your controller you must return an json call back to the Ajax.

Does it work? Not yet - I am trying to integrate the various statements into this code, such that it returns the correct view in the response to Ajax.

Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

Yes, I have highly abbreviated the code to demonstrate this contents of the controller. The $ref and material_quantity is very misleading, and only represents an example fo the rules and messages array. My Bad. Sorry.

In fact I have load of rules and messages, which are indeed too many to show here. Refactoring controllers is on my list of things to do, however, I am very unsure how to refactor the multitude of validations I have. After all they are specific to each controller. I do not understand how sticking them into a separate file helps.

I am not redirecting to an Ajax call. I am redirecting to a route, then a view. What I am doing is calling the controller FROM and Ajax call. Can you clarify what you mean by this:

You need to just return status.

Like I suggested, perhaps I am not returning the correct thing.

Does it means something like this:

        $validator = Validator::make($request->all(), $rules, $messages);

        return response()->json(['error'=>$validator->errors()->all()]);

Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

HI Snapey, back again - Well ... this has been a major pain. I have established two things and fixed one. First of all the DB table had gotten corrupted and hence nothing was saving. In fact the table would not even open. Ok my app is saving now. However, issue No. 2 has me quite at a loss. My validation is not working to save my life. I swear it worked when I wrote the module a year ago. But then I was on a very different version of Laravel. I am now in V5.8.

Ok, fundamental to my validation problem is the fact that the controller is being called from an Ajax POST call featured above. BTW .. the controller only saves when the validation is commented out. I have checked that the syntax on the validation is perfect. Any ideas - I expect that I am not doing things correctly as the consequence of the controller call from Ajax. The Posts on SO and Laracasts are not very illuminating.

Many Thanks !

**Abbreviated**

public function save_quote(Request $request)
    {
         $rules = [ 'lead_product'=>'required']
    $messages = $messages = [  'lead_product.required'=>'Specify the Principal Product in the Quote']


$validator = Validator::make($request->all(), $rules, $messages);
        if ($validator->fails()) {
            return redirect('project_quote')  // this redirects back to the view. 
                ->withErrors($validator)
                ->withInput();
        }

$newQuotation = new Quotation();
                $newQuotation->squares = $request->get('material_qty');
                $newQuotation->reference = $ref;
        $newQuotation->save();

//Blah Blah

}
Oct
05
1 month ago
Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

Ok, what I get in the response is the source code to the web page. In preview I see the web page recreated

Oct
04
1 month ago
Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

Hi Snapey,

As you know I am not too good at this stuff.

So, in order for me to see the response, I need to stop the JS at the last bracket. The response is empty. However here is the header info, which is much more promising, as all the vairables are there:

Request URL: http://auburntree.test/save_quote Referrer Policy: no-referrer-when-downgrade Provisional headers are shown Accept: / Content-Type: application/x-www-form-urlencoded; charset=UTF-8 Origin: http://auburntree.test Referer: http://auburntree.test/project_quote User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36 X-CSRF-TOKEN: DXOtAXf4BB5C7bMY58j2BbduGyUf1vFCbk15K8th X-Requested-With: XMLHttpRequest quote_name: lead_product: squares: start_date: TBD attribute: company_name: Private Sale co_telephone: firstname1: lastname1: customer_id: telephone1: email1: firstname2: lastname2: email2: telephone2: prop_number: address: city: province: postcode: country: Canada job_firstname: job_lastname: job_email: job_telephone: job_prop_number: job_address: job_city: job_province: job_postcode: job_country: Canada template_name: 44 product_name[]: product_id[]: price[]: quantity[]: cost[]: line_cost_hidden[]: comment: subtotal: subtotal_hidden: discount: 0 discount_hidden: discount_value: discountvalue_hidden: netofdiscount: netofdiscount_hidden: gst: gst_hidden: total: final_total_hidden:

Activity icon

Replied to Why Will My Controller Not Accept The Data From My Ajax Call?

Thanks for the feedback.

yes, I have a <button id="saveQuotation"> and also <form id="projectForm">

To reiterate, inside Chrome Dev Tools I can see the form data being presented.

No it is not an error 500. I have a 200.

New Developments:

I removed the serialized data from the Ajax call, just as an experiment. I replaced it with "hello World" like this:

$("#saveQuotation").click(function () {
        event.preventDefault();
        var formData = 'Hello World';/* $("#projectForm").serialize();*/

        $.ajax({
            headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
            type: "POST",
            url: 'save_quote',
            data: formData,
            success: function () {
                localStorage['alert'] = 'true';

                //console.log(data);
                //location.href = "/open_orders_summary"
            },
            error: function () {
                alert('there has been a system level error - please contact support')
            }
        });

Then in my controller, I did this:

 echo('Hello world');

        dd();

I am now getting a result. PHPStorm with Xdebug is reporting the $Request and the $_POST both containing "Hello World". However, if I do a dd($request) inside the controller instead of the Hello World, I still get nothing ... but I do not understand why.

I hope this helps, as I do not understand what is going on :o)

Thanks !

Activity icon

Started a new Conversation Why Will My Controller Not Accept The Data From My Ajax Call?

It is a mystery. I have checked everything 50 times and I can not see the problem. My AJAX call delivers the form data to my controller via a Route. I have used the same code elsewhere in my system and it works fine.

The Ajax call finds the route fine. The route finds the controller fine. But in this controller, that is where it stops. I can not even get a dd($request).

Ajax call

 $("#saveQuotation").click(function () {
        event.preventDefault();
        var formData = $("#projectForm").serialize();
        
    //console.log(formData);  It's all there

        $.ajax({
            headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
            type: "POST",
            url: 'save_quote',  // tried '/save_quote'  without success. 
            data: formData,

            success: function () {
                localStorage['alert'] = 'true';
              
            },
            error: function () {
                alert('there has been a system level error - please contact support')
            }
        });
    });

Route

Route::post('save_quote','[email protected]_quote');

Controller

 public function save_quote(Request $request)   // The actual controller is very long. Abbreviated for brevity.
  {
        dd($request) // I get nothing. 
  }

Many Thanks!

Sep
18
2 months ago
Activity icon

Replied to Spatie / Cookie-consent Can Not Find The Language File

HI Snapey, No - the demo nor the instructions do not call for setting the language to en. It sets it by default.

Anyway, I have removed spatie and have gone over to the other package, which looks 10x better.

But thanks for your input as always anyways - hope you are well :o)

Activity icon

Replied to Spatie / Cookie-consent Can Not Find The Language File

I'm giving up on spatie. I will either build my own, or more likely use Cookie Consent

https://cookieconsent.osano.com

Activity icon

Started a new Conversation Spatie / Cookie-consent Can Not Find The Language File

Hi, I have followed the github [instructions] (https://github.com/spatie/laravel-cookie-consent)

I have installed cookie consent into 5.8 through composer.

I add @include('cookieConsent::index') within my view as described

My view presents on the screen:

cookieConsent::texts.message cookieConsent::texts.agree

I have published my language files using the instructions given, and the messages are in the directory:

resources>lang>vendor>cookieConsent>en>texts.php

Any suggestions?

Jul
03
4 months ago
Activity icon

Replied to Homestead: Command Not Found

I have spent 3 days trying to solve this problem. I have seen pretty well every post on Laracasts and SO. I have done the whole "export path" thing 5 times. If you are on Windows 10, nothing works. This whole thing including Jeffrey's tutorial is built entirely on the assumption you are a MAC user.

So much for "Laravel strives to make the entire PHP development experience delightful"

Does ANYONE have a real solution when you are deploying on a Windows machine .... beyond "Give Up".

Jun
14
5 months ago
Activity icon

Replied to How The Heck Do You Install Php Extensions Onto Windows.

Thanks guys! I'm flying all day tomorrow and Sat, so won't get a chance to look at it, but will give you an update maybe Sunday. One advantage of being Canadian is we get to go and enjoy the beaches in Cuba ! :o) Cheers.

Activity icon

Replied to How The Heck Do You Install Php Extensions Onto Windows.

Bizaar ... I'll look again, but all the ones mentioned in the 5.8 install page, I can not find.

BCMath PHP Extension
Ctype PHP Extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

By the way, do you use Homestead for Windows, or just a downloaded LAMP server, like Xampp. Homestead looked complicated so I just used Xampp.

Jun
13
5 months ago
Activity icon

Replied to How The Heck Do You Install Php Extensions Onto Windows.

I had a look at the page you offered. It has all kinds of downloads for PHP, but no where do I see where to find the extensions. Bummer.

Activity icon

Replied to How The Heck Do You Install Php Extensions Onto Windows.

That's brilliant - thank you. Does the .dll file have everything L5.8 specifies in the installation page?

Activity icon

Started a new Conversation How The Heck Do You Install Php Extensions Onto Windows.

I'm taking a windows laptop on holiday and I want to take my work with me. Yes, I am stupid.

There are a whole bunch of extensions you have to add to php.ini as given in the install instructions eg Mbstring, Jso, ctype etc etc.

I have Googled all the responses. No, the extension is not commented out in the php.ini file. No, just putting extension=MBstring just gives a "can not find" error when updating composer. Same deal, if you put, extension=php_Mbstring.dll

I have Googled "Windows install php extension" and you get no more info than what I just presented here.

So, what is the secret to getting these little buggers installed on windows? Many thanks !

May
22
6 months ago
Activity icon

Replied to Posting Ajax Data To Laravel 5.7 Gives JS Error 500

Yes, sometimes the obvious defeats us. My application has grown so large that I forget what I have written myself. Lesson learned: search my own code for the answer. I probably have asked it 3 times before ! :o)

Activity icon

Replied to Posting Ajax Data To Laravel 5.7 Gives JS Error 500

@jlrdw ROCKSTAR !!! YOU NAILED IT. Many thanks !

Why did I use JSON.stringify()?? Because loads of responses on SO said that was the way to go. So, in conclusion if anyone else has this problem I did:

$.ajax(
                    {
                        headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
                        type: "POST",
                        url: '/newUpdate',
                        data: {value:categories},
                        success:function(response) {
                            console.log(response);
                        }
                    })

Activity icon

Replied to Posting Ajax Data To Laravel 5.7 Gives JS Error 500

Thanks for your replies. When I set up the controller with the $request, the Ajax call is getting to the controller. However, when I check the $request with Debug the request object is empty with 0 parameters. Ok, so I try again adding categories to the Route like yesterday. This again gives me a 404.

Controller

  public function newUpdate(Request $request){
     
       var_dump($request);
    }

When I look into the DevTools -> Headers for newUpdate I have a 200 status and I can see the Form Data.

Preview is filled with a whole bunch of stuff from object(Illuminate\Http\Request) and Response are filled with a whole bunch of HTML and CSS stuff

May
21
6 months ago
Activity icon

Replied to Posting Ajax Data To Laravel 5.7 Gives JS Error 500

I don't follow. I am sending data into L5. Where would the 'get' method fit? thanks

Activity icon

Started a new Conversation Posting Ajax Data To Laravel 5.7 Gives JS Error 500

I need to pass an array back to L5.7 for processing. My Ajax function finds the route and in turn the controller. However, I am having trouble including the data. When I do I get a 500 error back. What in the world am I doing wrong ??

$.ajax(
                    {
                        type: "POST",
                        url: '/newUpdate',
                        data: JSON.stringify(categories),
                        success:function(response) {
                            console.log(response);       // I get a "Hello World response on the console" 
                        }
                    })

Route


Route::post('newUpdate', '[email protected]');  

// THIS DOES NOT HELP, GIVES A 404
Route::post('newUpdate/{categories}', '[email protected]');    

Controller

 public function newUpdate(){

      echo('Hello World');          //THIS WORKS
    
}

 public function newUpdate($catgeories){

      var dump($categories)              //THIS FAILS WITH A 500 ERROR
    
}