Ap3twe

Ap3twe

Member Since 9 Months Ago

Canada

Experience Points
13,110
Total
Experience

1,890 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
88
Lessons
Completed
Best Reply Awards
1
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 3
13,110 XP
Jan
16
5 days ago
Activity icon

Replied to How To Solve Error 500 Server Error On Laravel Live Site

Are you on cpanel or plesk?

Activity icon

Replied to How To Solve Error 500 Server Error On Laravel Live Site

Increase php memory limit in the php.ini. Your request size might be over the limit

Activity icon

Replied to Laravel Cannot Connect To Database On Shared Hosting

Test a fresh laravel project. Then post the error

Activity icon

Awarded Best Reply on Selet Option Value

Guys, I solved it with JS and PHP together. is true you cant target a unique option from a select tag. Using IDS did not work. Here is how I did it

<input class="form-check-input" value="1650" id="valuetobechanged" name="standardlaptop" >

Select box - I am using image picker(Nothing to do with the problem). It acts the same as select tag.

 <select multiple class="image-picker show-labels show-html" data-limit="3" name="extrapackage[]" id="group_psoft">                
            <option data-img-src="/images/-laptop.jpg" data-img-label="Touchscreen Laptop" name="DellXPS15Laptop" data-img-alt="Dell XPS-15 Laptop" value="2800"></option>             

              <option data-img-src="/images/i500comp.jpg" data-img-label="Dell XPS-15 Laptop" name="Dellxps" data-img-alt="dellxps" value="2500"></option>             

              <option data-img-src="/images/500-alienware.jpg" data-img-label="Alienware-17 Laptop" name="dellalienware" data-img-alt="Dell Alienware-17 Laptop" value="5000"></option>            
              
            </select>

Javascript

<script>
$('#group_psoft').on('change', function() {
    $('#valuetobechanged').val( $(this).val() );
    
});
</script>

PHP

   if (isset($_REQUEST['standardlaptop'])){
            $upgrades = $_REQUEST['standardlaptop'];
            $upgrades = str_replace(',', ' ', $upgrades);
            $upgradesToArray = explode( " " ,$upgrades);
            $upgradesSum = array_sum($upgradesToArray);
        }

        if (empty($upgradesSum)){

            $standardpackageOrg = 1650;     
        }

In the end, I get back my initial value in the input text(1650) if the user selects and unselects the option. Maybe I can use Javascript to get back the old value but now am good with this.

Activity icon

Replied to Selet Option Value

Guys, I solved it with JS and PHP together. is true you cant target a unique option from a select tag. Using IDS did not work. Here is how I did it

<input class="form-check-input" value="1650" id="valuetobechanged" name="standardlaptop" >

Select box - I am using image picker(Nothing to do with the problem). It acts the same as select tag.

 <select multiple class="image-picker show-labels show-html" data-limit="3" name="extrapackage[]" id="group_psoft">                
            <option data-img-src="/images/-laptop.jpg" data-img-label="Touchscreen Laptop" name="DellXPS15Laptop" data-img-alt="Dell XPS-15 Laptop" value="2800"></option>             

              <option data-img-src="/images/i500comp.jpg" data-img-label="Dell XPS-15 Laptop" name="Dellxps" data-img-alt="dellxps" value="2500"></option>             

              <option data-img-src="/images/500-alienware.jpg" data-img-label="Alienware-17 Laptop" name="dellalienware" data-img-alt="Dell Alienware-17 Laptop" value="5000"></option>            
              
            </select>

Javascript

<script>
$('#group_psoft').on('change', function() {
    $('#valuetobechanged').val( $(this).val() );
    
});
</script>

PHP

   if (isset($_REQUEST['standardlaptop'])){
            $upgrades = $_REQUEST['standardlaptop'];
            $upgrades = str_replace(',', ' ', $upgrades);
            $upgradesToArray = explode( " " ,$upgrades);
            $upgradesSum = array_sum($upgradesToArray);
        }

        if (empty($upgradesSum)){

            $standardpackageOrg = 1650;     
        }

In the end, I get back my initial value in the input text(1650) if the user selects and unselects the option. Maybe I can use Javascript to get back the old value but now am good with this.

Jan
10
1 week ago
Activity icon

Replied to This Site Can’t Be Reached

Restart the server and see if it responds

Activity icon

Replied to Selet Option Value

This all works as my initial question. Maybe there is no way to restrict it to the Box option. Car, Toyota I dont want them to affect the handler.

You targeted all the select ``$('#group_psoft'). What I want is to target$('#group_psoft[Box]').

Activity icon

Replied to Selet Option Value

Thank you but what I am looking for is to only target the "value" of Box, not all the other options. The code I posted works for the later.

Activity icon

Replied to Selet Option Value

Sorry, What I want is only the BOX value. I don't want the rest to change the "value of the input "

Activity icon

Started a new Conversation Selet Option Value

I want to get the specific value of Select[option] Box and pass it to the value of an input text. I want to change only the input value with the Box value, not the rest. I don't want car and Toyota. I edited my question to make it clear.

Here is the code

<select name="group_psoft" id="group_psoft" multiple>
<option value="0" selected="selected"title="0">---select---</option>
<option value="100" title="100">Box</option>
<option value="200" title="200">Car</option>
<option value="300" title="300">Toyota</option>
</select>
<input id="name" value="200">
<script>
$('#group_psoft').change(function() {$('#name').val('')}); 
</script>

I tried this but is not working

<select name="group_psoft" id="group_psoft" multiple>
<option value="0" selected="selected"title="0">---select---</option>
<option value="100" title="100">Box</option>
<option value="200" title="200">Car</option>
<option value="300" title="300">Toyota</option>
</select>
<input id="name" value="200">
<script>
$('#group_psoft option[value=100]').change(function() {$('#name').val('100')}); 
</script>
Jan
08
1 week ago
Activity icon

Awarded Best Reply on Laravel 504 Time-out After I Updated Valet

Got it working after some diggings. I will list the steps here that may help someone.

First I uninstall PHP7.4 then install with source build

brew uninstall [email protected] --force, brew install php --build-from-source

I then uninstall Valet. I uninstall MySQl 5.8 to 5.7 stable version for laravel

# Remove MySQL completely

1. Open the Terminal
2. Use `mysqldump` to backup your databases
3. Check for MySQL processes with: `ps -ax | grep mysql`
4. Stop and kill any MySQL processes
5. Analyze MySQL on HomeBrew: 
        
    ```
    brew remove mysql
    brew cleanup
    ```

6. Remove files: 

    ```
    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/var/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    ```

7. Unload previous MySQL Auto-Login: 
        
    ```
    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    ```
        
8. Remove previous MySQL Configuration: 

    ```
    subl /etc/hostconfig` 
    # Remove the line MYSQLCOM=-YES-
    ```
        
9. Remove previous MySQL Preferences: 
    
    ```
    rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /private/var/db/receipts/*mysql*
    ```
    
10. Restart your computer just to ensure any MySQL processes are killed
11. Try to run mysql, **it shouldn't work**

Then I did a fresh Valet installation Note* Install MySQl 5.7 and brew link [email protected], brew services start [email protected]

start valet and boohah! there you go. remember Mysql resets to root and empty password

Activity icon

Replied to Laravel 504 Time-out After I Updated Valet

Got it working after some diggings. I will list the steps here that may help someone.

First I uninstall PHP7.4 then install with source build

brew uninstall [email protected] --force, brew install php --build-from-source

I then uninstall Valet. I uninstall MySQl 5.8 to 5.7 stable version for laravel

# Remove MySQL completely

1. Open the Terminal
2. Use `mysqldump` to backup your databases
3. Check for MySQL processes with: `ps -ax | grep mysql`
4. Stop and kill any MySQL processes
5. Analyze MySQL on HomeBrew: 
        
    ```
    brew remove mysql
    brew cleanup
    ```

6. Remove files: 

    ```
    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/var/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    ```

7. Unload previous MySQL Auto-Login: 
        
    ```
    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    ```
        
8. Remove previous MySQL Configuration: 

    ```
    subl /etc/hostconfig` 
    # Remove the line MYSQLCOM=-YES-
    ```
        
9. Remove previous MySQL Preferences: 
    
    ```
    rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /private/var/db/receipts/*mysql*
    ```
    
10. Restart your computer just to ensure any MySQL processes are killed
11. Try to run mysql, **it shouldn't work**

Then I did a fresh Valet installation Note* Install MySQl 5.7 and brew link [email protected], brew services start [email protected]

start valet and boohah! there you go. remember Mysql resets to root and empty password

Activity icon

Replied to Laravel 504 Time-out After I Updated Valet

I did everything but it is still slow. I think is the valet version. I need to change the computer I guess so. my spec is Mac Pro (Late 2013)

      Processor 3.7 GHz Quad-Core Intel Xeon E5
      Memory 32 GB 1866 MHz DDR3 
      Graphics AMD FirePro D500 3072 MB
Jan
07
2 weeks ago
Jan
06
2 weeks ago
Activity icon

Started a new Conversation Laravel 504 Time-out After I Updated Valet

I updated valet to 2.7.1 and now my laravel sites are slow as hell. When I make a request it times out 504 error. little digging I found out the fpm was outputting "[pool valet] server reached pm.max_children setting (5), consider raising it" I raised the pm.max_children to 10 yet nothing changes.

On the flip side, the server works flawlessly with static sites ( HTML) and even little PHP scripts.

Dec
24
4 weeks ago
Activity icon

Replied to Assigning Variables From Array

It was looping and I was only catching the last value. I had to just assign the variable to the request not the loop.

Dec
18
1 month ago
Activity icon

Replied to Assigning Variables From Array

Thank you I appreciate it

Activity icon

Replied to Assigning Variables From Array

Thank you it is working. Please can you explain why foreach works like that thanks.

Dec
17
1 month ago
Activity icon

Started a new Conversation Assigning Variables From Array

I tried to assign variables from a $_Request coimg from select tag. Then I looped through and wannna asign it to variables. I am not getting the second value from the request after assign it. Although if I print it directly I get the values.

 if (isset($_REQUEST["submit"])){
    if(isset($_REQUEST["packages"])){
         foreach( $_REQUEST['packages'] as $packages)
        //  I see all values here when I print it
         print_r ("Hello $packages </br>");

     $bonn = [$sum, $terms] = $packages ;
    //  I get only the first value
     print_r($bonn);
     
     }else  echo "nothing working";
 }

Html

<select multiple class="image-picker" name="packages[]">
<option data-img-src="/images/1.jpg" name="packs" data-img-alt="KeepSame" value="50" data-img-class="first">  Page 1  </option>
 <option data-img-src="/images/2.jpg" name="amount" data-img-alt="Aggresive" value="100">  Page 2  
 </option>\
 <option data-img-src="/images/3.jpg" name="smile_design" data-img-alt="Youthful" value="Youthful" data-img-class="last"> Page 3 </option>
  </select>
Dec
07
1 month ago
Activity icon

Replied to Horizon Gate Not Working

Thank you

Dec
06
1 month ago
Activity icon

Replied to SQLSTATE[HY000]: General Error: 1364 Field 'username' Doesn't Have A Default Value (SQL: Insert Into `users` (`name`, `email`, `password`, `admin`, `active`, `membership_id`, `membership_started`, `membership_expired`, `token`, `updated_at`, `created_at`)

there is no username in the view. Add

<div class="input-group {{ $errors->has('username') ? ' has-error' : '' }}">
<span class="input-group-addon">
    <i class="material-icons">face</i>
</span>
<div class="form-group label-floating">
<label class="control-label" for="username">User name</label><input id="username" type="text" class="form-control" username="username" value="{{ old('username') }}" required autofocus>

@if ($errors->has('username'))
<span class="help-block">
<strong>{{ $errors->first('username') }}</strong>
</span>
@endif
</div>
</div>
Activity icon

Started a new Conversation Horizon Gate Not Working

limiting access to my horizon and Telescope gate is not working. Anyone can access it although I have defined the user. It is on local server. Does local environment give permission to all users?

 protected function gate()
    {
        Gate::define('viewHorizon', function ($user) {
            return in_array($user->email, [
                '[email protected]'
            ]);
        });
    }
Activity icon

Replied to Carbon Fails In Job Queue

Good to know. "which is due to not having requests when you run queue jobs from terminal." Is there a way to run jobs without using terminal? And there is no workaround to get the value of a request in queue?

Dec
05
1 month ago
Activity icon

Replied to Carbon Fails In Job Queue

I get the same message data Missing

Dec
04
1 month ago
Activity icon

Replied to Carbon Fails In Job Queue

The problem is Carbon is expecting data. The date I am passing in is Y-m-d not including H:i:s.

Activity icon

Replied to Carbon Fails In Job Queue

Yes. I import the Request class use Symfony\Component\HttpFoundation\Request and pass it in the handle method

Activity icon

Replied to Env Variable Does Not Pass In Job Queue

Okay, So that is the standard. I will incorporate into my workflow. I am learning so I always want to clarify the reasons Thanks

Activity icon

Replied to Carbon Fails In Job Queue

I am getting exception failed message Data Missing Here is the Data output

{
job: null,
connection: null,
queue: null,
chainConnection: null,
chainQueue: null,
delay: {
class: "Illuminate\Support\Carbon",
properties: "2019-12-04T18:15:17.947645Z"
},
chained: [
]
}

Exception Location

 if (static::isStrictModeEnabled()) {

537             throw new InvalidArgumentException(implode(PHP_EOL, $lastErrors['errors']));

538         }

Stack Trace

Users/Blog/blog/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:559
Activity icon

Replied to Env Variable Does Not Pass In Job Queue

I know that route, but can you clarify why it is best to create a config file rather than calling the global ENV Variable. Thanks

Activity icon

Started a new Conversation Carbon Fails In Job Queue

Carbon instance fails my job but works in the controller directly. I have imported the class use Illuminate\Support\Carbon; That will not be the problem I guess

$dateWanted = $request->date_wanted; //"12/17/2019"
$dateObject = Carbon::createFromFormat("m/d/Y", $dateWanted)->format('Y-m-d')
Activity icon

Started a new Conversation Env Variable Does Not Pass In Job Queue

Jobs fail when I put ENV variable in a job. When I had code in, it works

                    'AppName' => '*****',
                    'UserName' => $_ENV['USERNAME'],
                    'Password' => $_ENV['PASSWORD']

                    )
Dec
03
1 month ago
Activity icon

Replied to Carbon Changing Date Format

I don't know maybe they following XSD Format.

This is the schema <s:element minOccurs="1" maxOccurs="1" name="DueDate" type="s:dateTime"/>

Activity icon

Replied to Carbon Changing Date Format

Guys When I took the working code from controller to the job class, It fails. I am getting error

Laravel Horizon

InvalidArgumentException: Data missing in /Users/DesignPro/laravel/blog/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:537
{
job: null,
connection: null,
queue: null,
chainConnection: null,
chainQueue: null,
delay: {
date: "2019-12-03 16:55:45.006342",
timezone_type: 3,
timezone: "America/Vancouver"
},
chained: [
]
}

Laravel telescope Exception Message

Data missing

Activity icon

Replied to Carbon Changing Date Format

There I am!. I need glasses. The little detail. Thanks

Activity icon

Replied to Carbon Changing Date Format

"12/17/2019"

Activity icon

Started a new Conversation Carbon Changing Date Format

I am sending data through Soap. The XML format accepts date("Y-m-d). My request format is date("m-d-Y). I like the format in my app, so I don't want to change it, I only wanna change it for the API. I tried to use CarbonFromdate to format it but I am getting errors

 Unexpected data found. Unexpected data found.

tried this 1st

$dateWanted = $request->date_wanted;
 $timeZone = \date_default_timezone_get();
 $dateObject = Carbon::createFromFormat("m-d-Y", $dateWanted, $timeZone);

2nd Try

$dateWanted = $request->date_wanted;
$dateObject = Carbon::createFromFormat("m-d-Y", $dateWanted)->format('Y-m-d')
Nov
14
2 months ago
Activity icon

Replied to Controller Won't Return Response After Job Successfully Runs

If is working accept an answer so we know

Activity icon

Awarded Best Reply on Authetication Redirect And Error Catch

Fixed. The problem was inheritance. I created another function

protected function RegisterLogin(Request $request){

    //   Register New Users the fields...
    if($user === null && $clientId === null){
        $password = Hash::make($request->password);
         $user = new user;
         $user->drname = $GLOBALS['docinfoFirstName'];
         $user->username= $request->username;
         $user->email = $GLOBALS['docinfoEmail'];
         $user->password = $password; //hashed password.
         $user->save();
        // Auth::login($user,true);
       return redirect ('home');
       }
       elseif (Auth::attempt($credentials)){
       return redirect ('home');

       }else{
           return redirect ('login');

       }

}

Then I referenced it in the getCUstomeVerification function.

return $this->RegisterLogin($request);

Thanks @jlrdw @snapey

Activity icon

Replied to Authetication Redirect And Error Catch

Fixed. The problem was inheritance. I created another function

protected function RegisterLogin(Request $request){

    //   Register New Users the fields...
    if($user === null && $clientId === null){
        $password = Hash::make($request->password);
         $user = new user;
         $user->drname = $GLOBALS['docinfoFirstName'];
         $user->username= $request->username;
         $user->email = $GLOBALS['docinfoEmail'];
         $user->password = $password; //hashed password.
         $user->save();
        // Auth::login($user,true);
       return redirect ('home');
       }
       elseif (Auth::attempt($credentials)){
       return redirect ('home');

       }else{
           return redirect ('login');

       }

}

Then I referenced it in the getCUstomeVerification function.

return $this->RegisterLogin($request);

Thanks @jlrdw @snapey

Nov
13
2 months ago
Activity icon

Replied to Authetication Redirect And Error Catch

Check it. Did everything right yet still. I commented out all the redirects yet it redirects when I refresh the page. That means another redirect is overriding the custom redirects. I even commented the protected $redirectTo = '/home';

Nov
08
2 months ago
Activity icon

Replied to Authetication Redirect And Error Catch

The custom flash messages are working. I am talking about the redirect when the user registers or when they login

Activity icon

Replied to Authetication Redirect And Error Catch

@jlrdw @snapey Am I doing something wrong? Error flash messages are working fine. I redirect succesfully with return redirect('logintest')->with('username', 'Invalid User, Please Register with Protec');

But redirects when user authenticates or register still needs to be refreshed.

 $password = $request->password;
    $email = $GLOBALS['docinfoEmail'];
    $username = $GLOBALS['docinfoCustomerID'];
    $user = User::where('email', '=', $email)->first();
    $password = Hash::make($request->password);
    $clientId = User::where('username', '=', $username)->first();
    $credentials = array('username' => $user, 'password' => $password);

    //   validate the fields...

    if($user === null && $clientId === null){
      $user = new user;
      $user->drname = $GLOBALS['docinfoFirstName'];
      $user->username= $request->username;
      $user->email = $GLOBALS['docinfoEmail'];
      $user->password = $password; //hashed password.
      $user->save();
     // Auth::login($user,true);
      //return view('home');
        return redirect('home');
    }
    elseif ([$credentials, true]){
        // dd($password);
       // return redirect()->route('home');
       Auth::login($user,true);
        //return redirect()->action('[email protected]');
       return redirect('home');
        // return view('home');

    }
Nov
07
2 months ago
Activity icon

Replied to Authetication Redirect And Error Catch

Validation works perfectly Now the behaviour is I hit Route::post('/getCustomerVerification', '[email protected]')->name('getCustomerVerification'); It stores users in the database correctly but the URL in the browser is auth.test/getCustomerVerification instead of redirectingauth.test/home

When I refresh the page then it redirects to the proper redirect auth.test/home. I deleted all redirects from the controller am only using the protected $redirected = '/home;

Activity icon

Replied to Authetication Redirect And Error Catch

Out of box authentication works fine, only custom authentication acts that. Do you think having both is confusing the system?

Activity icon

Replied to Authetication Redirect And Error Catch

Working on the error but first, My redirects work on and off. Sometimes it works other times it does not. It returns an empty page with the URL showing the POST endpoint. I tried return redirect()->route('home'); or return view('home');

Nov
06
2 months ago
Activity icon

Started a new Conversation Authetication Redirect And Error Catch

  1. I want to catch the exception shown below into the login view that is: If the request does not pass return an error message to the user in the form etc. I am returning it to another page on line return view ('authuserspage'); with a custom error message. How do display the error above the form in login view

Routes

Route::get('/', function () {
    return view('welcome');
});
Auth::routes();
Route::get('/home', '[email protected]')->name('home');
Route::get('/logintest', '[email protected]')->name('logintest');
Route::get('/authuserspage', '[email protected]')->name('authuserspage');
 Route::post('/getCustomerVerification', '[email protected]')->name('getCustomerVerification');
Route::post('/xml2multiarray', '[email protected]')->name('xml2multiarray');

Controller

class CustomAuthController extends Controller
{
    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

protected function getCustomerVerification(Request $request){

    /* Initialize webservice with your WSDL */
    $client = new SoapClient("***/Token.asmx?WSDL");
    $params = array(
        'APIUserID' => '****',//ENV
        'APIPassword' => '*****',//ENV
        'webUsername' =>  $request->username,
        'webPassword' => $request->password,
    );


    /* Invoke webservice method with your parameters, in this case: Function1 */

    try {
        $responsetest = $client->getCustomerInfo($params);
     
    }

    catch (\Throwable $e){
  return view ('authuserspage');

    }

    $array = $this->xml2multiarray($responsetest->getCustomerInfoResult->any, $request);
    return view('/home');
}

//convert xml to array
protected function xml2multiarray($xml, Request $request)
{
    
    $xmldata1 = explode("</Table>",$xml);
    $xmldata2 = explode("<Table diffgr:id",$xmldata1[0]);
    $xmldata  = "<Table diffgr:id".$xmldata2[1]."</table>";
    $p = xml_parser_create();
    xml_parse_into_struct($p, $xmldata, $vals, $index);
    xml_parser_free($p);
    $array = array();
    foreach($vals as $val)
    {
        if($val['type'] == 'complete')
        {
            $key = strtolower($val['tag']);
            $value = $val['value'] ?? '';
            $array[$key] = $value;
        }
    }
    // return $array;
    $GLOBALS['docinfoAccountNumber'] = ($array['accountnumber']);
    $GLOBALS['docinfoCustomerID'] = ($array['customerid']);
    $GLOBALS['docinfoEmail'] = ($array['email']);

    $email = $GLOBALS['docinfoEmail'];
    $username = $GLOBALS['docinfoCustomerID'];
    $user = User::where('email', '=', $email)->first();
    $clientId = User::where('username', '=', $username)->first();
    //   validate the fields...
     if ($user === null && $clientId === null){

      $password = Hash::make($request->password);

      $user = new user;
      $user->drname = $GLOBALS['docinfoFirstName'];
      $user->username= $request->username;
      $user->email = $GLOBALS['docinfoEmail'];
      $user->password = $password; //hashed password.
      $user->save();
      Auth::login($user,true);

    }
}

Routes methods

public function logintest()
{
    return view ('/logintest');
}

public function  authuserspage(){

    return view ('/authuserspage');
}
Nov
05
2 months ago
Activity icon

Replied to The Message Variable

Thank you. I give up lol

Activity icon

Replied to The Message Variable

So how the error compiler assumes what is wrong and inserts the correct message. I look at the auth.php and I see associative array.

    'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',