lukegalea16

lukegalea16

Member Since 1 Week Ago

Experience Points 360
Experience Level 1

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

22 Jul
8 hours ago

lukegalea16 started a new conversation Storing Bearer Tokens From The User's End

I have successfully managed to create registration and login APIs where a bearer token is issued when the user successfully logs in. The user may then use said bearer token to access his/her information and logout and so the user and logout routes are protected by authorization header middleware. For now I have tested these APIs using postman. For the actual implementation, when a user successfully logs in - where should the bearer token be stored (cookies perhaps?) in order for the user's session to pass the bearer token and access other pages with his/her information? Moreover how could a remember me method be implemented? and should refresh tokens be implemented? In order to eliminate cases where the user is logged out during a session if the token expires.

Tia!!

19 Jul
3 days ago

lukegalea16 left a reply on Swift_TransportException When Sending E-mail

However, just in case an exception happens how can I catch it and do something else?

lukegalea16 left a reply on Swift_TransportException When Sending E-mail

Turns out I exceeded the daily limit on Sendgrid.

lukegalea16 started a new conversation Swift_TransportException When Sending E-mail

I am successfully sending e-mails from a controller in Laravel, however randomly or once in a while I get the following error in postman: Swift_TransportException: Failed to authenticate on SMTP server with username "iotsolutions" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 250 but got an empty response. I am using Sendgrid as my e-mail client - perhaps I could catch the exception and re-send the e-mail? Any ideas?

Thanks!

16 Jul
6 days ago

lukegalea16 left a reply on Call Controller Function From Another Controller

Hi @cronix thank you for that ! I am still not sure whether traits are the way to go in my case since the methods only have like two lines in common, so there is not much repetition I think

15 Jul
1 week ago

lukegalea16 left a reply on Call Controller Function From Another Controller

@cronix so then in the api route where I'm calling the controller, I would call these two methods instead?

lukegalea16 left a reply on Call Controller Function From Another Controller

@cronix ok, but how would I then go about calling the two methods? to save to either tables

lukegalea16 left a reply on Call Controller Function From Another Controller

@martinbean would you suggest using redirection or a service class?

lukegalea16 left a reply on Call Controller Function From Another Controller

I have experience with coding but I'm still getting used to the Laravel framework, in this case should I redirect to another controller action or implement the logic (including saving to a table) in a generic service class? Why should I choose either option?

lukegalea16 left a reply on Call Controller Function From Another Controller

Thank you all for your replies, basically after saving my $Request to a particular table, i want to take a particular field of $Request and decode it and store the result in another table. Hence after successfully saving the raw $Request to the device_data_messages table, I want to point to another controller (or action) which would then decode the $Request and store the result in another table.

lukegalea16 started a new conversation Call Controller Function From Another Controller

Knowing that calling a controller function from another function is not good practice for Laravel, I tried adding a service which can be used to call another function from another controller, however it is not working as expected.

public function sigfoxstore(Request $Request)
    {                 
        if ($Request->has('data')) {
            $device_data_message = new device_data_message();
            $device_data_message->device = request('device');
            $device_data_message->seqNumber = request('seqNumber');
            $device_data_message->data = request('data'); 
            $device_data_message->bsId = '0';
            $device_data_message->nbRep = '0';
            $device_data_message->snr = '0';
            $device_data_message->rssi = '0';
            $saved = $device_data_message->save();
            $this->decodedDataMessageService->store($Request);
            if($saved){
                echo json_encode(array());
            }            
        }

In app\Services I created the following...

<?php 

namespace App\Services;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

//Import models
use App\device_data_message;
use App\device_geo_message;
use App\decoded_data_message;

public function store(Request $Request)
{
   this->DecodedDataMessageController($Request);
   return 0; 
}

?>

After saving to device_data_message, I wish to pass the $Request to DecodedDataMessageController to save in another table and I tried to do so by adding a service in between.

12 Jul
1 week ago

lukegalea16 left a reply on Laravel Min Validation Not Working

Hi everyone, had a dumb thing going on - I'm versioning APIs and I forgot to route to the new API version.

Many thanks everyone.

lukegalea16 left a reply on Laravel Min Validation Not Working

Just tried 'data' => ['required','min:22', string] but it did not work

lukegalea16 left a reply on Laravel Min Validation Not Working

Sounds probable! To force Laravel to treat the request as a string could I use string instead? Since data is expected to be a string

lukegalea16 left a reply on Laravel Min Validation Not Working

Will try that thanks!

lukegalea16 left a reply on Laravel Min Validation Not Working

Allow me to rephrase... If I set the device min for 6 and max for 8 then if I pass a string of 2 characters long, an error should be returned, no? Since the string must be of length between 6 and 8

lukegalea16 left a reply on Laravel Min Validation Not Working

I had taken them from them however neither of those rules work... the min still doesn't work

lukegalea16 left a reply on Laravel Min Validation Not Working

What do you mean? If my min is 6, I expect to have a minimum number of 6 characters else an error is returned (for device for example)

lukegalea16 left a reply on Laravel Min Validation Not Working

Thank you for your reply. I had tried that, and then changed it to $Request because of my function.

public function sigfoxstore(Request $Request)
    {        
        /*Save request to device_data_message if request has data parameter*/             
        if ($Request->has('data')) {
            $attributes = $Request->validate([
                'device' => 'required|string|digits_between:6,8', //ID is minimum of 6, maximum of 8
                'seqNumber' => ['required','numeric'],
                'data' => ['required','min:22']
            ]);
            $device_data_message = new device_data_message();
            $device_data_message = $attributes;
            $device_data_message->bsId = '0';
            $device_data_message->nbRep = '0';
            $device_data_message->snr = '0';
            $device_data_message->rssi = '0';
            $saved = $device_data_message->save();
            /*Service signal, avgSnr, station were ommitted from SIGFOX as of June 2019,
            DATA_ADVANCED duplicates (object) can be used to retrieve bsId, nbRep, snr, rssi
            These will be included in the table for now but always populated as '0'*/
            if($saved){
                echo json_encode(array());
            }            
        }
}

lukegalea16 started a new conversation Laravel Validation Min/Max Not Working

I am trying to validate a request as shown below and the max is working well, however if I enter a string of 2 characters for the device and data, it is still accepted and no error is returned.

if ($Request->has('data')) { $attributes = $Request->validate([ 'device' => 'required|string|min:6|max:8', //ID is minimum of 6, maximum of 8 'seqNumber' => ['required','numeric'], 'data' => ['required','min:22'] ]); $device_data_message = new device_data_message(); $device_data_message = $attributes; $device_data_message->bsId = '0'; $device_data_message->nbRep = '0'; $device_data_message->snr = '0'; $device_data_message->rssi = '0'; $saved = $device_data_message->save(); /Service signal, avgSnr, station were ommitted from SIGFOX as of June 2019, DATA_ADVANCED duplicates (object) can be used to retrieve bsId, nbRep, snr, rssi These will be included in the table for now but always populated as '0'/ if($saved){ echo json_encode(array()); } }