Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

KarolGil

KarolGil

Member Since 1 Year Ago

Experience Points
41,180
Total
Experience

3,820 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
375
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.

Level 9
41,180 XP
Sep
07
2 months ago
Activity icon

Awarded Best Reply on Windows 10 With VirtualBox, Vagrant And Laravel Homestead SSH - Timeout Issue

After two days of trying and checking every option that came to my mind, I gave myself up.

I uninstalled Virtual Box and installed Hyper-v.

Generating ssh keys:

ssh-keygen -t rsa -b 4096 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add -k ~/.ssh/id_rsa

Other useful commands:

vagrant global-status

vagrant reload --provision

vagrant destroy - f 
vagrant box remove -f

vagrant ssh-config

Other useful programs:

  • Bitvise SSH Client /* For checking if files sync between Windows and Vagrant. */
  • Nmap - Zenmap GUI /* Scanning of open ports for a given ip. */

Log in via ssh. Show ip address for connection to vagrant.

ip addr show eth0 | grep inet | awk '{ print ; }' | sed 's/\/.*$//'

Homestead.yaml

---
ip: "192.168.10.10"
memory: 8192
cpus: 4
provider: hyperv

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/projects/new
      to: /home/vagrant/code/new

sites:
    - map: homestead.test
      to: /home/vagrant/code/new
      php: "7.4"

databases:
    - homestead

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false
    - elasticsearch:
         version: 7.9.0
    - python: true

variables:
    - key: APP_ENV
      value: local


C:\Windows\System32\drivers\etc\hosts

192.168.214.52 homestead.test

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.require_version '>= 2.2.4'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exist? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
        config.vm.provision "shell" do |s|
            s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
        end
    end

    if File.exist? homesteadYamlPath then
        settings = YAML::load(File.read(homesteadYamlPath))
    elsif File.exist? homesteadJsonPath then
        settings = JSON::parse(File.read(homesteadJsonPath))
    else
        abort "Homestead settings file not found in #{confDir}"
    end

    Homestead.configure(config, settings)

    if File.exist? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
    end

    if File.exist? customizationScriptPath then
        config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
    end

    if Vagrant.has_plugin?('vagrant-hostsupdater')
        config.hostsupdater.remove_on_suspend = false
        config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
    elsif Vagrant.has_plugin?('vagrant-hostmanager')
        config.hostmanager.enabled = true
        config.hostmanager.manage_host = true
        config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
    end

    if Vagrant.has_plugin?('vagrant-notify-forwarder')
        config.notify_forwarder.enable = true
    end
end
Activity icon

Replied to Windows 10 With VirtualBox, Vagrant And Laravel Homestead SSH - Timeout Issue

After two days of trying and checking every option that came to my mind, I gave myself up.

I uninstalled Virtual Box and installed Hyper-v.

Generating ssh keys:

ssh-keygen -t rsa -b 4096 -C "[email protected]"
eval "$(ssh-agent -s)"
ssh-add -k ~/.ssh/id_rsa

Other useful commands:

vagrant global-status

vagrant reload --provision

vagrant destroy - f 
vagrant box remove -f

vagrant ssh-config

Other useful programs:

  • Bitvise SSH Client /* For checking if files sync between Windows and Vagrant. */
  • Nmap - Zenmap GUI /* Scanning of open ports for a given ip. */

Log in via ssh. Show ip address for connection to vagrant.

ip addr show eth0 | grep inet | awk '{ print ; }' | sed 's/\/.*$//'

Homestead.yaml

---
ip: "192.168.10.10"
memory: 8192
cpus: 4
provider: hyperv

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/projects/new
      to: /home/vagrant/code/new

sites:
    - map: homestead.test
      to: /home/vagrant/code/new
      php: "7.4"

databases:
    - homestead

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false
    - elasticsearch:
         version: 7.9.0
    - python: true

variables:
    - key: APP_ENV
      value: local


C:\Windows\System32\drivers\etc\hosts

192.168.214.52 homestead.test

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.require_version '>= 2.2.4'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exist? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
        config.vm.provision "shell" do |s|
            s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
        end
    end

    if File.exist? homesteadYamlPath then
        settings = YAML::load(File.read(homesteadYamlPath))
    elsif File.exist? homesteadJsonPath then
        settings = JSON::parse(File.read(homesteadJsonPath))
    else
        abort "Homestead settings file not found in #{confDir}"
    end

    Homestead.configure(config, settings)

    if File.exist? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
    end

    if File.exist? customizationScriptPath then
        config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
    end

    if Vagrant.has_plugin?('vagrant-hostsupdater')
        config.hostsupdater.remove_on_suspend = false
        config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
    elsif Vagrant.has_plugin?('vagrant-hostmanager')
        config.hostmanager.enabled = true
        config.hostmanager.manage_host = true
        config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
    end

    if Vagrant.has_plugin?('vagrant-notify-forwarder')
        config.notify_forwarder.enable = true
    end
end
Sep
04
2 months ago
Activity icon

Replied to Best Way To Authorize Applications In Laravel Gateway ( Not Users )

As he writes @topvillas. Generate a token, save it to the database. And check the token in the database with each request. If it is correct then execute the request, if it is then return an error.

You will also probably need some sort of token refreshing mechanism for your application.

Activity icon

Started a new Conversation Windows 10 With VirtualBox, Vagrant And Laravel Homestead SSH - Timeout Issue

HI,

I want to install homestead. I do it according to the instructions from here: https://laravel.com/docs/7.x/homestead

I have already reinstalled on my computer: Vagrant, Virtual Box, Git.

Homestead.yaml

ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/code
      to: /home/vagrant/code

sites:
    - map: homestead.test
      to: /home/vagrant/code/public

databases:
    - homestead

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Vagrantfile

# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'json'
require 'yaml'

VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path(File.dirname(__FILE__))

homesteadYamlPath = confDir + "/Homestead.yaml"
homesteadJsonPath = confDir + "/Homestead.json"
afterScriptPath = confDir + "/after.sh"
customizationScriptPath = confDir + "/user-customizations.sh"
aliasesPath = confDir + "/aliases"

require File.expand_path(File.dirname(__FILE__) + '/scripts/homestead.rb')

Vagrant.require_version '>= 2.2.4'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    if File.exist? aliasesPath then
        config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
        config.vm.provision "shell" do |s|
            s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases && chown vagrant:vagrant /home/vagrant/.bash_aliases"
        end
    end

    if File.exist? homesteadYamlPath then
        settings = YAML::load(File.read(homesteadYamlPath))
    elsif File.exist? homesteadJsonPath then
        settings = JSON::parse(File.read(homesteadJsonPath))
    else
        abort "Homestead settings file not found in #{confDir}"
    end

    Homestead.configure(config, settings)

    if File.exist? afterScriptPath then
        config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
    end

    if File.exist? customizationScriptPath then
        config.vm.provision "shell", path: customizationScriptPath, privileged: false, keep_color: true
    end

    if Vagrant.has_plugin?('vagrant-hostsupdater')
        config.hostsupdater.remove_on_suspend = false
        config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
    elsif Vagrant.has_plugin?('vagrant-hostmanager')
        config.hostmanager.enabled = true
        config.hostmanager.manage_host = true
        config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
    end

    if Vagrant.has_plugin?('vagrant-notify-forwarder')
        config.notify_forwarder.enable = true
    end

    config.ssh.private_key_path = "~/.ssh/id_rsa"
end
cd ~/homestead/

vagrant up
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: Checking if box 'laravel/homestead' version '9.5.1' is up to d
ate...
==> homestead: Clearing any previously set forwarded ports...
==> homestead: Clearing any previously set network interfaces...
==> homestead: Preparing network interfaces based on configuration...
    homestead: Adapter 1: nat
    homestead: Adapter 2: hostonly
==> homestead: Forwarding ports...
    homestead: 80 (guest) => 8000 (host) (adapter 1)
    homestead: 443 (guest) => 44300 (host) (adapter 1)
    homestead: 3306 (guest) => 33060 (host) (adapter 1)
    homestead: 4040 (guest) => 4040 (host) (adapter 1)
    homestead: 5432 (guest) => 54320 (host) (adapter 1)
    homestead: 8025 (guest) => 8025 (host) (adapter 1)
    homestead: 9600 (guest) => 9600 (host) (adapter 1)
    homestead: 27017 (guest) => 27017 (host) (adapter 1)
    homestead: 22 (guest) => 2222 (host) (adapter 1)
==> homestead: Running 'pre-boot' VM customizations...
==> homestead: Booting VM...
==> homestead: Waiting for machine to boot. This may take a few minutes...
    homestead: SSH address: 127.0.0.1:2222
    homestead: SSH username: vagrant
    homestead: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
vagrant ssh-config
Host homestead
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile C:/Users/Karol/.ssh/id_rsa
  IdentitiesOnly yes
  LogLevel FATAL
  ForwardAgent yes

What could be wrong? Because I was downloading another box for vagrant and normally I could connect to it via ssh. And here the same error keeps popping out.

Aug
13
3 months ago
Activity icon

Awarded Best Reply on Ubuntu Nginx Guzzle Connection Timed Out

The reason for the errors were too small limits in the file /etc/php/7.3/cli/php.ini

Activity icon

Replied to Ubuntu Nginx Guzzle Connection Timed Out

The reason for the errors were too small limits in the file /etc/php/7.3/cli/php.ini

Aug
12
3 months ago
Activity icon

Started a new Conversation Ubuntu Nginx Guzzle Connection Timed Out

I have such a code for fetching data using api.

The script works locally (docker + apache), it works on test vps (ubuntu + apache) and it doesn't work on production (ubuntu + nginx).

Does anyone have an idea what else I can check?

Code:

<?php

namespace App\Helpers\Selly;

use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Facades\Log;

class ProductAttributes
{
    const TABLE_NAME = 'table_name';

    protected $client;

    public function __construct(Client $client)
    {
        $this->client = $client;
    }

    public function getProductAttributes($tmpCount = 0)
    {
        $tmpCount = $tmpCount + 1;
        Log::debug('getProductAttributes - attempts: '.$tmpCount);
        $tmpToken = $this->client->getToken() ?? null;
        sleep(5);

        if ( empty($tmpToken) ) {
            Log::debug('getProductAttributes - new token: '.$tmpCount);
            return $this->getProductAttributes($tmpCount);
        }

        /* Cancellation after 20 attempts */
        if ( $tmpCount > 100 ) {
            Log::debug('getProductAttributes - max attempts - error ');
            return false;
        }

        try {
            $client = new \GuzzleHttp\Client();
            $uri = $this->client->baseUri . 'apig/?token=' . $tmpToken . '&table=' . self::TABLE_NAME;
            $response = $client->request('GET', $uri,
                [
                    'connect_timeout' => 3600,
					'read_timeout' => 3600,
					'timeout' => 3600,
                ]);
        } catch (\Exception $e) {
            Log::debug('getProductAttributes - exception: '.$tmpCount);
			Log::debug('getProductAttributes - Exception: '.$e);
            return $this->getProductAttributes($tmpCount);
        }

        if ( isset($response) && $response->getStatusCode() == 200 )
        {
            $responseBody = $response->getBody();
            return json_decode($this->client->decodeData($responseBody), true);
        }

        Log::debug('getProductAttributes - end: '.$tmpCount);
        return $this->getProductAttributes($tmpCount);
    }
}

Error:

[2020-08-12 16:39:02] local.ERROR: cURL error 7: Failed to connect to api.selly.pl port 80: Connection timed out (see http:/ /curl.haxx.se/libcurl/c/libcurl-errors.html) {"userId":58,"exception":"[object] (GuzzleHttp\Exception\ConnectException(code: 0): cURL error 7: Failed to connect to api.selly.pl port 80: Connection timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at /path/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:185)
[stacktrace]
0 /path/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
1 /path/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
2 /path/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
3 /path/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
4 /path/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
5 /path/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(37): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
6 /path/vendor/guzzlehttp/guzzle/src/Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
7 /path/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(70): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
8 /path/vendor/guzzlehttp/guzzle/src/Middleware.php(60): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
9 /path/vendor/guzzlehttp/guzzle/src/HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
10 /path/vendor/guzzlehttp/guzzle/src/Client.php(277): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
11 /path/vendor/guzzlehttp/guzzle/src/Client.php(125): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
12 /path/vendor/guzzlehttp/guzzle/src/Client.php(131): GuzzleHttp\Client->requestAsync('GET', Object(GuzzleHttp\Psr7\Uri), Array)
13 /path/app/Helpers/Selly/Client.php(54): GuzzleHttp\Client->request('GET', 'http://api.sell...')
14 /path/app/Helpers/Selly/Client.php(80): App\Helpers\Selly\Client->retrieveCoin(93)
15 /path/app/Helpers/Selly/Client.php(17): App\Helpers\Selly\Client->retrieveToken(93, '2YKDiXz5nFK_Hok...')
16 /path/app/Jobs/FetchCategories.php(31): App\Helpers\Selly\Client->__construct()
17 /path/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php(16): App\Jobs\FetchCategories->__construct()
18 /path/app/Http/Controllers/ImportController.php(83): App\Jobs\FetchCategories::dispatch()
19 [internal function]: App\Http\Controllers\ImportController->dispatchImportJob('categories')
20 /path/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
21 /path/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('dispatchImportJ...', Array)
22 /path/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\ImportController), 'dispatchImportJ...')
23 /path/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()
24 /path/vendor/laravel/framework/src/Illuminate/Routing/Router.php(680): Illuminate\Routing\Route->run()
25 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
26 /path/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
27 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
28 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
29 /path/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
30 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
31 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
32 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(75): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
33 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
34 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
35 /path/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
36 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
37 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
38 /path/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(56): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
39 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
40 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
41 /path/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
42 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
43 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
44 /path/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
45 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
46 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
47 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
48 /path/vendor/laravel/framework/src/Illuminate/Routing/Router.php(682): Illuminate\Pipeline\Pipeline->then(Object(Closure))
49 /path/vendor/laravel/framework/src/Illuminate/Routing/Router.php(657): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
50 /path/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
51 /path/vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
52 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
53 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
54 /path/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
55 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
56 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
57 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
58 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
59 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
60 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
61 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
62 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
63 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
64 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
65 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
66 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
67 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
68 /path/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
69 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
70 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
71 /path/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
72 /path/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
73 {main}
"} 
Jun
15
5 months ago
Activity icon

Replied to Laravel 7 MariaDB Laravel/ui

@deepu07

You were right. Only it should look like this: DB_HOST=mariadb

Activity icon

Started a new Conversation Laravel 7 MariaDB Laravel/ui

Hi,

I have installed the Laravel composer global require laravel / installer test_laravel7

I have installed dependencies:

composer require laravel/ui
php artisan ui vue --auth
npm install
npm audit fix 
npm run watch

I changed the settings in laradock https://laradock.io/ to:

PHP_VERSION=7.4
APACHE_DOCUMENT_ROOT=/var/www/public
COMPOSE_PROJECT_NAME=test_laravel7
PMA_DB_ENGINE=mariadb
WORKSPACE_VUE_CLI_SERVE_HOST_PORT=8002

Docker:

docker-compose build --no-cache apache2 mariadb phpmyadmin redis php-fpm
docker-compose up -d apache2 mariadb phpmyadmin redis php-fpm

env:

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=test_laravel7
DB_USERNAME=root
DB_PASSWORD=root

app/database.php

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

Database migrations have uploaded. However, I can neither log in nor register. How can I fix it? Error:

/var/www/
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] No such file or directory (SQL: select count(*) as aggregate from `users` where `email` = [email protected])
http://localhost/register

More: https://flareapp.io/share/17xbnbmb#F61

Jun
09
5 months ago
Activity icon

Awarded Best Reply on Recursive Method

Only after adding the method to return values the script started to work as expected.

When the script returns false, I throw an exception in another file.

public function getProducers($tmpCount = 0)
    {
        $tmpCount = $tmpCount + 1;
        Log::debug('getProducers - attempts: '.$tmpCount);
        $tmpToken = $this->client->getToken() ?? null;
        sleep(15);

        if ( empty($tmpToken) ) {
            Log::debug('getProducers - new token: '.$tmpCount);
            return $this->getProducers($tmpCount);
        }

        /* Cancellation after 20 attempts */
        if ( $tmpCount > 20 ) {
            Log::debug('getProducers - max attempts - error ');
            return false;
        }

        try {
            $client = new \GuzzleHttp\Client;
            $uri = $this->client->baseUri . 'apig/?token=' . $tmpToken . '&table=' . self::TABLE_NAME;
            $response = $client->request('GET', $uri,
                [
                    'read_timeout' => 3600,
                ]);
        } catch (\Exception $e) {
            Log::debug('getProducers - exception: '.$tmpCount);
            return $this->getProducers($tmpCount);
        }

        if ( isset($response) && $response->getStatusCode() == 200 )
        {
            $responseBody = $response->getBody();
            return json_decode($this->client->decodeData($responseBody), true);
        }

        Log::debug('getProducers - end: '.$tmpCount);
        return $this->getProducers($tmpCount);
    }
Activity icon

Replied to Recursive Method

Only after adding the method to return values the script started to work as expected.

When the script returns false, I throw an exception in another file.

public function getProducers($tmpCount = 0)
    {
        $tmpCount = $tmpCount + 1;
        Log::debug('getProducers - attempts: '.$tmpCount);
        $tmpToken = $this->client->getToken() ?? null;
        sleep(15);

        if ( empty($tmpToken) ) {
            Log::debug('getProducers - new token: '.$tmpCount);
            return $this->getProducers($tmpCount);
        }

        /* Cancellation after 20 attempts */
        if ( $tmpCount > 20 ) {
            Log::debug('getProducers - max attempts - error ');
            return false;
        }

        try {
            $client = new \GuzzleHttp\Client;
            $uri = $this->client->baseUri . 'apig/?token=' . $tmpToken . '&table=' . self::TABLE_NAME;
            $response = $client->request('GET', $uri,
                [
                    'read_timeout' => 3600,
                ]);
        } catch (\Exception $e) {
            Log::debug('getProducers - exception: '.$tmpCount);
            return $this->getProducers($tmpCount);
        }

        if ( isset($response) && $response->getStatusCode() == 200 )
        {
            $responseBody = $response->getBody();
            return json_decode($this->client->decodeData($responseBody), true);
        }

        Log::debug('getProducers - end: '.$tmpCount);
        return $this->getProducers($tmpCount);
    }
May
29
5 months ago
Activity icon

Replied to Recursive Method

The problem is here:

I changed:

        /* Cancellation after 20 attempts */
        if ( $tmpCount > 20 ) {
            Log::debug('getProducts - max attempts - error ');
            return null;
        }

on:

	        /* Cancellation after 20 attempts */
        if ( $tmpCount > 20 ) {
            Log::debug('getProducts - max attempts - error ');
            exit();
        }
Activity icon

Replied to Recursive Method

@lancashireman The point is that failed_jobs is clean and the job has not finished yet.

May
28
5 months ago
Activity icon

Started a new Conversation Recursive Method

Hi,

I have this code:

    public function getProducts($tmpCount = 0)
    {
        $tmpCount = (int) $tmpCount + 1;
        Log::debug('getProducts - attempts: '.$tmpCount);
        $tmpToken = $this->client->getToken() ?? null;
        sleep(5);

        if ( empty($tmpToken) ) {
            Log::debug('empty token '.$tmpCount);
            $this->getProducts($tmpCount);
        }

        /* Cancellation after 20 attempts */
        if ( $tmpCount > 20 ) {
            Log::debug('getProducts - max attempts - error ');
            return null;
        }

        try {
            $client = new \GuzzleHttp\Client;
            $uri = $this->client->baseUri . 'apig/?token=' . $tmpToken . '&table=' . self::TABLE_NAME;
            $response = $client->request('GET', $uri,
                [
                    'read_timeout' => 3600,
                ]);
        } catch (\Exception $e) {
            Log::debug('exception '.$tmpCount);
            $this->getProducts($tmpCount);
        }

        if ( isset($response) && $response->getStatusCode() == 200 )
        {
            $responseBody = $response->getBody();
            return json_decode($this->client->decodeData($responseBody), true);
        }

        $this->getProducts($tmpCount);
    }

In the logs I have, for example, such a message:

[date 00:01:12] local.DEBUG: getProducts - attempts: 1  
[date 00:01:18] local.DEBUG: exception 1  
[date 00:01:18] local.DEBUG: getProducts - attempts: 2  
[date 00:01:26] local.DEBUG: getProducts - attempts: 2  

And the job in the queue is interrupted. What could be the reason?

Activity icon

Awarded Best Reply on How To Run Math Api On Localhost?

  1. Install the npm install dependencies
  2. Install the yarn install dependencies
  3. Enter the command npm i -G npx ts-node
  4. In index.ts add before app default export lines app.listen (3000) (3000 is the port, it can be any)
  5. Enter the command: npx ts-node index.ts
  6. Check e.g. http://localhost:3000?From=\sum^{N}_{and}x_
Activity icon

Replied to How To Run Math Api On Localhost?

  1. Install the npm install dependencies
  2. Install the yarn install dependencies
  3. Enter the command npm i -G npx ts-node
  4. In index.ts add before app default export lines app.listen (3000) (3000 is the port, it can be any)
  5. Enter the command: npx ts-node index.ts
  6. Check e.g. http://localhost:3000?From=\sum^{N}_{and}x_
May
23
6 months ago
Activity icon

Started a new Conversation How To Run Math Api On Localhost?

Hi,

How to run math api on localhost?

https://github.com/uetchy/math-api

I installed dependencies with the npm install command, but it does not show me mathematical expressions of the type

<img src="/?from=%5Cfrac%7B1%7D%7B%5CGamma(s)%7D%5Cint_%7B0%7D%5E%7B%5Cinfty%7D%5Cfrac%7Bu%5E%7Bs-1%7D%7D%7Be%5E%7Bu%7D-1%7D%5Cmathrm%7Bd%7Du">

I am asking for help because I do not know what I am doing wrong.