vincej

vincej

Member Since 5 Years Ago

Calgary, Canada

Experience Points
43,570
Total
Experience

1,430 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,570 XP
Feb
14
5 days ago
Activity icon

Replied to Need Advice On A Collection

I should have mentioned that the various queries pull data using QueryBuilder and it gives me arrays, and or collections. I guess I could convert to objects, but I have no experience in doing that and frankly it was a pain to look it up, digest it, and use it. I see no Laravel helper for this, so I just took the easy road. Cheers !

Activity icon

Replied to Need Advice On A Collection

@snapey @jlrdw I'm not going to pretend that I have a good answer to your questions, Here is the function sitting in my model, it serves two separate controllers.

 public function workorder_contents($id){

        $contractors = $this->contractors();//this finds all contractor names with their id's and puts them into a select box*/
        $workorder = WorkOrder::where('order_number','=',$id)->get(); //this finds costs and margins from the created work order.
        $selected_contractor = $this->selected_contractor($id); // this finds the established and selected contractor for this job
        $sales_order= app('App\Models\Order')->salesorder_partialsearch($workorder[0]['order_number']); // this finds all the products which were orginally ordered as a sales order.
        $product_margin = app('App\Models\Order')->product_margin($id);

        $margin = 0;
        $gross_margin = 0;
        $total_cost = 0;

        // this calculates the total gross margin from the sales order.
        foreach ($sales_order as $so){
            $discounted_cost = $so->line_cost * ((100-$so->discount) / 100);
            $cost_quantity =  ($so->cost_price * $so->quantity );
            $margin =  $discounted_cost - $cost_quantity;

            $total_cost += $cost_quantity;
            $gross_margin += $margin;
            number_format($gross_margin,2);
        }

        $total_cost = $total_cost + $workorder[0]['extras_total'];

        return array('contractors'=>$contractors, 'workorder'=>$workorder,'selected_contractor'=>$selected_contractor,'sales_order'=>$sales_order,'gross_margin'=>$gross_margin,'total_cost'=>$total_cost);

    }

Activity icon

Replied to Need Advice On A Collection

Thank you all ! I knew it would be easy, but not that easy! I have a little supplementary question for my academic curiosity.

I only gave you the one array, but in fact I am passing about 7, which in turn have loads of values.

so I have this:

 $data = $this->workorder_contents($id);

return View('workorders',  compact('data') )

all good. But when it gets to my view I have to do this:

$data['workorder'][0]['wo_address'])

$data['sales_order'][0]['product_name']

etc, etc  for every single array and value in my view of which there are many. It works though. 

Question : is there a cleaner way of achieving the same outcome or is this the best there is??

Many thanks !!

Feb
13
6 days ago
Activity icon

Started a new Conversation Need Advice On A Collection

Problem: I am trying to get values from a collection returned to a view. Sort of like this:

return View('workorders', compact( 'values['workorder'] ));

Sounds easy? I'm not getting there. Any suggestions ?? It should be easy.

Background Details I have a function in a controller which generates several values. I return them to another controller as an array. In turn, the other controller will dispatch them to a view. This is what I have got so far:

My Array

 return array('contractors'=>$contractors,'workorder'=>$workorder,'selected_contractor'=>$selected_contractor,'sales_order'=>$sales_order,'gross_margin'=>$gross_margin,'total_cost'=>$total_cost);

Received in the second function

$values = $this->workorder_contents($id);

Alls well so far. If I do a dd($values['workorder']); I get a nice collection out which looks like this:

Illuminate\Database\Eloquent\Collection {#819 ▼
  #items: array:1 [▼
    0 => App\Models\WorkOrder {#820 ▼
      #table: "workorders"
      #primaryKey: "id"
      #guarded: array:1 [▶]
      +timestamps: true
      #hidden: array:2 [▶]
      #dates: array:2 [▶]
      #connection: "mysql"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:28 [▼
        "id" => 8
        "contractor_id" => 67
        "order_number" => "Tru161219-53"
        "accepted" => null
        "start_date" => "Thu Feb 20, 2020"
        "wo_address" => "151 Alandale Place Calgary T3Z3L9"
        "contact" => "Donald Trump"
        "crew" => null
        "rate" => "56"
        "product" => null
        "colour" => null
        "uplift" => "12"
        "attribute" => null
        "material_qty" => 10
        "work" => "install"
        "extras" => null
        "gross_margin" => "2"
        "margin_percent" => "28"
        "project_costs" => "5390.00"
        "extras_total" => "1230.00"
        "contract" => "0.00"
        "total_contractor" => "1790.00"
        "status" => "open"
        "closed_at" => null
        "wo_comment" => null
        "created_at" => "2020-02-12 15:48:02"
        "updated_at" => "2020-02-12 15:48:02"
        "deleted_at" => null
      ]
      #original: array:28 [▶]
      #changes: []


Jan
13
1 month ago
Activity icon

Started a new Conversation Managing Multiple Ajax Calls On Single Page View

I am building a Dashboard using Google Charts. All straight forward, except that each chart represents a different data set out of my DB. So, is there a clever way of avoiding a separate Ajax call for each Google chart? Also, any thoughts on how best to fire multiple Ajax calls when the page opens to avoid all kinds of conflicts?

Many Thanks !

Dec
18
2 months ago
Activity icon

Replied to Need Help On Translating A Complex Query Into Laravel

@jlrdw Thanks a bunch !! Our messages crossed paths!!

Anyway, now that I have found out how to use raw queries in Laravel I am as happy as pig in poo. I will still carry on using query builder for easy stuff, and especially so when sanitized inputs are used.

Cheers ! as always !

Activity icon

Replied to Need Help On Translating A Complex Query Into Laravel

Ok - in the end it was easy, all I had to do was this:

public function inventory_by_product() {
        $result = DB::select('select orders.product_id, products.product_name, sum(orders.quantity) as orders, stock
        from orders
        left join
        (select inventory.inv_product_id,
        sum(inventory.stock_quantity) as stock
        from inventory
        group by inventory.inv_product_id ) i
        on inv_product_id = orders.product_id
        left join products on orders.product_id = products.product_id
        group by orders.product_id');
        return $result;
              }


Activity icon

Started a new Conversation Need Help On Translating A Complex Query Into Laravel

Because I am old school, I have a habit of first building my queries in SQL, and then translating them into Query Builder. But this one beats me. The SQL works fine. But can someone offer some guidance on getting into Laravel? What is messing me up is that there is a subquery and two joins plus a sum().

I noticed that Laravel 6 now offers subqueries, but they are super simple and have not helped me. However, I have now at least upgraded to v6.8 !

I would be super happy if I could just call the raw SQL somehow, but that is not obvious either as when I try I am not getting a connection to the DB. So, if I could figure that out, that would be my first choice. Anyway, here is the SQL. Many Thanks ! :

select orders.product_id, products.product_name, sum(orders.quantity) as orders, stock
from orders
    left join
    (select inventory.inv_product_id,
    sum(inventory.stock_quantity) as stock
    from inventory
    group by inventory.inv_product_id ) i
    on inv_product_id = orders.product_id
    left join products on orders.product_id = products.product_id
    group by orders.product_id


Nov
30
2 months ago
Activity icon

Replied to How To Sum Multiple Values In An Array Without Recursion ... Or Get MySQL To Do Itit

Absolutely correct. I don't care, I am only finding the sum of the products. I mentioned warehouse id pnly because that is the only field which distinguishes the row, besides of course the table id. Thanks for the input.

Activity icon

Replied to How To Sum Multiple Values In An Array Without Recursion ... Or Get MySQL To Do Itit

You are a rock star! Thank you . The very very weird thing is that I swear I tried this query but I was getting the values double counted. Like it ran through the sum once and then did it again because there was a second value their. If there was a 3rd value it would sum 3 times!

I knew it would be a simple solution - just not that simple.

Many thanks again!

Activity icon

Started a new Conversation How To Sum Multiple Values In An Array Without Recursion ... Or Get MySQL To Do Itit

On the face of it, I have something which should be super dooper easy, but so far I have not found a clean solution without loads of nasty recursion which everyone says is slow anyways.

Ok - take a look at this sample MySQL result: (https://imgur.com/a/SOl739b )

You will notice that in rows 1-2 and then 3-4 the products are the same, BUT they have different quantities and live in different warehouses. The challenge (for me!) is how can I easily find the total stock across all the warehouses for each product in the table. Ideally, this would be done in MySQL. Alternatively, I bring this table into Laravel / PHP as an array / collection and do the work there, hopefully without some appalling recursion algorithm. Now, bear in mind that in real production mode a user could have many warehouses and of course there will be many many products.

The query which created the table is here. Pretty simple I know.

select inventory.inv_product_id, inventory.stock_quantity,warehouses.wh_id,warehouses.name
from inventory
join warehouses on inventory.wh_id = warehouses.wh_id

Fingers crossed someone has got something! :o)

Many thanks !

Nov
08
3 months 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
3 months 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
3 months 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 months 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
4 months 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
4 months 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
4 months 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
4 months 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
4 months 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
5 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?