DaybydayCRM icon indicating copy to clipboard operation
DaybydayCRM copied to clipboard

Posible problems with relative routes

Open Edgarborras94 opened this issue 4 years ago • 3 comments

I found some relative routes that might cause errors in certain environments.

ie: resources/views/tasks/show.blade.php:line 269

...
$('#add-invoice-line-modal .modal-content').load('/add-invoice-lines/{{$tasks->external_id}}' + '/task');
...

Can cause errors in example on localhost routes: expected: http://localhost/daybydaycrm/public/add-invoice-lines/id/task what you actually get: http://localhost/add-invoice-lines/id/task

An easy solution might be using laravel URL helper:

...
$('#add-invoice-line-modal .modal-content').load('{{url('/add-invoice-lines/'.$tasks->external_id)}}' + '/task');
...

I'm trying to collect all of this routes to fix them

Should I make a PR after fixing them or is it too specific?

Edgarborras94 avatar Aug 10 '20 18:08 Edgarborras94

No please do, always looking for improvements, a better solution might be too use named routed `{{route('name')}} what's your thought?

Bottelet avatar Aug 11 '20 05:08 Bottelet

Sure!! I will collect all the relative url and then look for all the named routes 😉

Edgarborras94 avatar Aug 11 '20 07:08 Edgarborras94

This issue still giving some problems. Especially with the calls in the ajax code. I added {{asset()}} and managed to solve most breaking links. However still some. Also the datatable for the leads is not populating. I am not to versed in jquery and ajax so left this one alone for now. Updated, fixed the datatable after I found the vue component. I added asset() after the get statement on line 88. worked as a charm.

RikvanderVaart avatar Jul 28 '21 22:07 RikvanderVaart