Rebelutionairy

Member Since 1 Week Ago

Amsterdam

Experience Points
290
Total
Experience

4,710 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 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.

  • Community Pillar

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

Level 1
290 XP
May
04
1 week ago
Activity icon

Replied to Returning A View From Controller Goes Wrong.

hahahhaha my excuses for the increase of your blood pressure. I dont think either that we were on the same line but i knew that you could help me out. After a videocall with a friend and explained to me that i took a wrong turn by using AJAX as you've tried to explain me. But the only thing i needed to know was "this is asynchronous - so the page does not reload; the response data is fetched in the background".

The solution to my issue was something that i had before in my code but didnt work out for me so i throwed it away and found many ajax solutions so i tried and run into the obstacle of asynchronous.

  const ac = new Autocomplete(document.getElementById('autoCompletionInput'), {
    data: [{label: "I'm a label", value: 42}],
    maximumItems: 10,
    treshold: 1,
    highlightTyped: true,
    highlightClass: 'text-primary',
    onSelectItem: ({label, value}) => {
      var routeSearch = "/search/:id";
      routeSearch = routeSearch.replace(':id', value);

      window.location.replace(routeSearch)
    }
  });

The above is what i needed instead of all that code. The learning curves are harsh and the community full of love. Thnx for trying and please dont run away next time when you see a question coming up of me

Activity icon

Replied to Returning A View From Controller Goes Wrong.

the ajax request -> Route -> controller ->this template including the retrieved data from the api.

Activity icon

Replied to Returning A View From Controller Goes Wrong.

i need the obtained arrivals data into this table in file: stationarrivals.blade.php

                                <table class="table" cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th>Tijd</th>
                                            <th>Richting</th>
                                            <th>Spoor</th>
                                            <th>Reisdetails</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    @foreach ($stationArrivalsData['arrivals'] as $stationArrival)
                                        <tr>
                                            @if(!empty($stationArrival['plannedDateTime']))
                                            <td>{{date("H:i",strtotime($stationArrival['plannedDateTime']))}}</td>
                                            @else
                                            <td></td>
                                            @endif
                                            @if(!empty($stationArrival['origin']))
                                            <td>{{$stationArrival['origin']}}</td>
                                            @else
                                            <td></td>
                                            @endif
                                            @if(!empty($stationArrival['plannedTrack']))
                                            <td>{{$stationArrival['plannedTrack']}}</td>
                                            @else
                                            <td></td>
                                            @endif
                                            @if(!empty($stationArrival['product']['shortCategoryName']))
                                            <td>{{$stationArrival['product']['shortCategoryName']}}</td>
                                            @else
                                            <td></td>
                                            @endif
                                        </tr>
                                    @endforeach
                                    </tbody>
                                </table>

i cannot answer your question as you would like im sorry. because it is not clear to me. the above is what im tryna achieve

Activity icon

Replied to Returning A View From Controller Goes Wrong.

with the chosen value an api call is made to request data in the controller which must be shown on the page.

Activity icon

Replied to Returning A View From Controller Goes Wrong.

i send {value:value, label:label} which comes from the autocomplete input as data with a get method to the route url described above and that initiates the method of the class and that method returns the view.

render a results page

thats what i tried to accomplish here and not what i have now :-D

Activity icon

Replied to Returning A View From Controller Goes Wrong.

updated above. Now ill be waiting curious.

Activity icon

Replied to Returning A View From Controller Goes Wrong.

How can i investigate that?

https://ibb.co/7vvQSTR

do you mean this. firefox says something about initiator is xhr while the first get request was a document.

From welcome page i have a ajax request on the search which routes me to searchController en then the following above should work. maybe the ajax request is still being a pain in the ...?

Activity icon

Replied to Returning A View From Controller Goes Wrong.

in firefox i get the same issue unfortunately

Activity icon

Started a new Conversation Returning A View From Controller Goes Wrong.

Issue: The controller sends the view but it doesnt show up in the browser but in the network tab of dev tools in chrome. Weird but real

Route::get('/search/{id}', [SearchController::class, 'searchArrivalsOfStation']);
const ajaxService = function(routeSearch, value, label){
    
    $.ajax({
       type:'GET',
       url:routeSearch,
       headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
       data:{value:value, label:label},
       success:function(data){
        console.log("ajaxRequest succesfull!");
       },
       error: function(response) {
        console.log(response);
       }
    });

}
  const ac = new Autocomplete(document.getElementById('autoCompletionInput'), {
    data: [{label: "I'm a label", value: 42}],
    maximumItems: 10,
    treshold: 1,
    highlightTyped: true,
    highlightClass: 'text-primary',
    onSelectItem: ({label, value}) => {
      var routeSearch = "/search/:id";
      routeSearch = routeSearch.replace(':id', value);
      console.log(routeSearch);

      ajaxService(routeSearch, value, label);
    } 
});
    function searchArrivalsOfStation(Request $request)
    {
        $data = $request->all();
        $arrivalsJSON = $this->apiService->getArrivalsOfStationAPI($data['value']);
        // Caching for the autocomplete, but i dont think that this is the right way!
        $stationsJSON = Cache::get('allStations');

        // Return stationsData and arrivalsOfStationData to view
        return view('stationarrivals', ['stationArrivalsData' => $arrivalsJSON,'stationsData' => $stationsJSON]);
    }
>>> view('stationarrivals')
=> Illuminate\View\View {#3401}

In browser it does the following:

https://ibb.co/LNL0v9T

i dont even know how to exactly describe this issue.. still a rookie

May
02
1 week ago
Activity icon

Replied to Configuration Issue: Cannot Retrieve Env Value Through Config!

Hero! thnx. Wish you the very best

Activity icon

Started a new Conversation Configuration Issue: Cannot Retrieve Env Value Through Config!

Hi Laravel soldiers,

im struggling with setting up my environment variable (still after reading docs) so i can take distance from my hardcoded api subkey. What is the right way to set this up, because as you can see my way ain't working.

.env file

NS_SUBSCRIPTION_KEY=1234567890

config/services.php

    'nsapi' => [
        'key' => env('NS_SUBSCRIPTION_KEY'),
    ],

console test

[email protected] MINGW64 /c/xampp/htdocs/Opdracht/Uitwerking (master)
$ php artisan config:clear
Configuration cache cleared!

[email protected] MINGW64 /c/xampp/htdocs/Opdracht/Uitwerking (master)
$ php artisan tinker
Psy Shell v0.10.8 (PHP 7.4.16 — cli) by Justin Hileman
>>> env('NS_SUBSCRIPTION_KEY')
=> "1234567890"
>>> config('app.nsapi')
=> null
>>> config('nsapi')
=> null
>>> config('nsapi.key')
=> null
>>>
[email protected] MINGW64 /c/xampp/htdocs/Opdracht/Uitwerking (master)
$ php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!

[email protected] MINGW64 /c/xampp/htdocs/Opdracht/Uitwerking (master)
$ php artisan tinker
Psy Shell v0.10.8 (PHP 7.4.16 — cli) by Justin Hileman
>>> env('NS_SUBSCRIPTION_KEY')
=> null
>>> config('nsapi.key')
=> null
>>>
Activity icon

Replied to 404 Not Found. Ajax Route Get Request Not Working As I Wanted To :-(

The issue was the route cache. i only had to register them. hadn't noticed that i had to route:cache in artisan... im closing this question.

solut: php artisan route:cache. everytime when you change something to your route.

May
01
1 week ago
Activity icon

Replied to 404 Not Found. Ajax Route Get Request Not Working As I Wanted To :-(

Even with postman im receiving the response 404 NOT FOUND. without any further details.. Could it be a server permission thingy?? im clueless.

Route::get('/search', [SearchController::class, 'send_http_request']);
const ajaxService = function(routeSearch, value, label){
    
    $.ajax({
      type:'GET',
      url:routeSearch,
      headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
      data:{value:value, label:label},
      success:function(data){
         alert(data.success);
      },
      error: function(response) {
          console.log(response);
      }
   });
}

  const ac = new Autocomplete(document.getElementById('autoCompletionInput'), {
    data: [{label: "I'm a label", value: 42}],
    maximumItems: 10,
    treshold: 1,
    highlightTyped: true,
    highlightClass: 'text-primary',
    onSelectItem: ({label, value}) => {
      var routeSearch = "/search"

      ajaxService(routeSearch, value, label);
    } 
});

@jlrdw , @automica: Finally, i could add the code. i would love to have your expertise vision on this.

Apr
30
1 week ago
Activity icon

Replied to 404 Not Found. Ajax Route Get Request Not Working As I Wanted To :-(

I really wanted to pass all the code in here but first day and THEGAME sees my code blocks as links somehow. The encode thing was just a desperate action :-D.

Activity icon

Replied to 404 Not Found. Ajax Route Get Request Not Working As I Wanted To :-(

I also tried playing with that before. didnt work out for me. Even now they both set to GET.

Any other ideas for me :-D? This error will make me quit my career so soon.

Activity icon

Replied to 404 Not Found. Ajax Route Get Request Not Working As I Wanted To :-(

ill give it a try. that has been the only thing i didnt try i think.

Post: i tried the following:

Route::post('/search', [SearchController::class, 'send_http_request']);
var routeSearch = "/search"

That didnt solved it!

Could it be something live server access permissions (htaccess or so..)

Activity icon

Started a new Conversation 404 Not Found. Ajax Route Get Request Not Working As I Wanted To :-(

Been busy with this since yesterday and believe me when i say i tried whatever i could think of and find on the net. but nothing helped. so im giving up on this one till a hero appears.

Route::post ('/search', [SearchController::class, 'send_http_request'])->name('searchReq');

      var routeSearch = "{{ route('searchReq') }}"

      ajaxService(routeSearch, value, label);

 $.ajax
       type:'GET',
       url:routeSearch,
       dataType: 'json', 
       encode  : true,
       data:{value:value, label:label},