PetroGromovo

PetroGromovo

Member Since 5 Months Ago

Experience Points 2,010
Experience Level 1

2,990 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
21 hours ago

PetroGromovo started a new conversation If Paypal Plan Has “inactive” Status?

Hello, Testing pagination in laravel 5 app with request

Working with Update Plan API http://paypal.github.io/PayPal-PHP-SDK/sample/doc/billing/UpdatePlan.html I did not find if plan has inactive state and which key have I to use for it? I made :

   $value = new PayPalModel('{
       "state":"INACTIVE"
     }');

But got error : Requested state change is invalid.

  1. How valid?

  2. If in my developer's account there is a page where I can see all my plans and work with them in my developer's account ?

Thanks!

16 Jul
6 days ago

PetroGromovo started a new conversation How To Multiply Number Of Rows In Result Set Testing Pagination

Hello, Testing pagination in laravel 5 app with request

$modelsList = Model
    ::getByStatus('A')
    ->get();

I have difficulties as there are too few data in Model table. If there is a way with eloquent/collection to multiply number of rows in result set with less code as possible and easy to return ?

Ex : In my case I got 5 rows, as the app is at dev stage with some default data from migration. but I would easily have, 50, 200, 500 rows.

Thanks!

10 Jul
1 week ago

PetroGromovo left a reply on How From Intervention Image Get Resource For Imagepng?

That is clear for me db issue, but not clear this simple How to show images to the page. Must it be like <img src="[email protected]?image=6" returning response from psrResponse ?

PetroGromovo left a reply on How From Intervention Image Get Resource For Imagepng?

Thank you !

  1. I managed to save file on disk as :
$img->save( public_path('result_foo.png'), /* best quality */100, 'png' );
  1. returning in a control :
        $response = $img->psrResponse('png', 1000);
        return $response;

I show my image in browser

  1. But how can I use this script in my blade template, as I need on some page to show several programmatically generated images ?

PetroGromovo started a new conversation How From Intervention Image Get Resource For Imagepng?

Hello, In laravel 5.8 app I want to banner generation programmatically, like base image, image at left, text at center, watermark at right. I do it as :

        // create new Intervention Image
        $img = \Image::make( public_path('foo.jpg') );

// paste another image
        $img->insert( public_path('bar.png') );

// create a new Image instance for inserting
        $watermark = \Image::make( public_path('watermark.png') );
        $img->insert($watermark, 'center');

        // insert watermark at bottom-right corner with 10px offset
        $img->insert( public_path('watermark.png'), 'bottom-right', 10, 10);



        // create Image from file
        $img = \Image::make( public_path('foo.jpg') );

// write text
        $img->text('The quick brown fox jumps over the lazy dog.');

// write text at position
        $img->text('The quick brown fox jumps over the lazy dog.', 120, 100);

// use callback to define details
        $img->text('foo', 0, 0, function($font) {
            $font->file( public_path('fonts/themify/themify.ttf') );
            $font->size(24);
            $font->color('#fdf6e3');
            $font->align('center');
            $font->valign('top');
            $font->angle(45);
        });

//        var_dump($img);

        // draw transparent text
        $img->text('foo', 0, 0, function($font) {
            $font->color(array(255, 255, 255, 0.5));
        });

        header('Content-Type: image/png');
        imagepng($img, null, 100);
//        imagedestroy($img); //Free up memory

And I got error :

imagepng() expects parameter 1 to be resource, object given

dumping $img I got :

object(Intervention\Image\Image)#910 (9) { ["driver":protected]=> object(Intervention\Image\Gd\Driver)#907 (2) { ["decoder"]=> object(Intervention\Image\Gd\Decoder)#908 (1) { ["data":"Intervention\Image\AbstractDecoder":private]=> NULL } ["encoder"]=> object(Intervention\Image\Gd\Encoder)#905 (4) { ["result"]=> NULL ["image"]=> NULL ["format"]=> NULL ["quality"]=> NULL } } ["core":protected]=> resource(45) of type (gd) ["backups":protected]=> array(0) { } ["encoded"]=> string(0) "" ["mime"]=> string(10) "image/jpeg" ["dirname"]=> string(40) "/mnt/_work_sdb8/wwwroot/lar/votes/public" ["basename"]=> string(7) "foo.jpg" ["extension"]=> string(3) "jpg" ["filename"]=> string(3) "foo" }

I see that $img has protected resource property. How can I resource from $img for imagepng? Do I move in valid way ?

Thanks!

09 Jul
1 week ago

PetroGromovo left a reply on Structure Of Laravel 5/vuejs 2 With Flexbox

But in which way it can be fixed ? 1) Can I replace mainapp with some other tag that would not raise error? Whivh tag can it be? Is it normal idea of checking my vuejs app under validator.w3, as I do with non vuejs apps?

08 Jul
2 weeks ago

PetroGromovo started a new conversation Are Routes With "_" Chars Valid ?

Hello, If there is a difference in route description of my laravel 5 app as :

ASK Route::post('run-user-list-export-to-csv', '[email protected]_user_list_export_to_csv');

and

ASK Route::post('run_user_list_export_to_csv', '[email protected]_user_list_export_to_csv');

I mean if second variant will work without problems on any modern browsers and does it fit any strict SOLID,DRY, SEO FREANDLY, Any route rules?

I mean that second variant is more convinient to searching in my PHPStorm editor , as writing in seasrch like run_user_list_export_to_csv will find all js script all, web routes and control definitions ...

Thanks!

06 Jul
2 weeks ago

PetroGromovo started a new conversation Structure Of Laravel 5/vuejs 2 With Flexbox

Hello!

I am making layout of my app with flexbox and I got a page:

http://hostels-tours.nilov-sergey-demo-apps.tk/

I decided to check it under https://validator.w3.org service

And got errors:

Error: Element mainapp not allowed as child of element main in this context. (Suppressing further errors from this subtree.)

From line 47, column 13; to line 47, column 21

          <mainapp></main

Content model for element main:
Flow content.

And as I see message :

Suppressing further errors from this subtree

it could have a lot errors more...

That is Laravel 5/vuejs 2 / bootstrap 4 app and I need to keep structure of my app and for this in my container file :

</head>

<body>

    <div id="app">

        <header>
            <AppHeader />
        </header>
        <main>
            <mainapp></mainapp>
            <nav>Nav</nav>
            <aside>Aside</aside>
        </main>
        <footer>Footer</footer>

    </div>

</body>

@include('footer')
<script src="{{ asset('js/app.js') }}{{  "?dt=".time()  }}"></script>

</html>

Main vuejs container resources/js/components/BS4/MainApp.vue :

<template>
    <div id="page_content">
        
        <notifications group="hostels2_notification" />
        <router-view></router-view>
    ...

In resources/js/app.js :

import mainapp from './components/BS4/MainApp.vue';

I do not like defining inside app div elements main/header/footer , but I had to make it as I need all parts of the app be inside vuejs block.

How do you think which my app structure must be to keep good style and exclude errors in https://validator.w3.org or some other bad styling ?

Thanks!

04 Jul
2 weeks ago

PetroGromovo started a new conversation Implementing Google Calendar In Laravel App

Hello, in a tasks description I meet a demand to work with Google Calendar Api with Laravel framework. Priorly I worked with fullcalendar, when data were saved in db and in this calendar I could work with data and save my changes to db.

Can you say me if Google Calendar has some advantages in comparison with fullcalendar? Where data are kept etc...

I have worked with other google products so I have

"google/apiclient": "^2.2"

installed in my app. Is it enough or are there some bettr tools for Google Calendar implementation ?

Thanks!

03 Jul
2 weeks ago

PetroGromovo started a new conversation How Html Developer Can Work With Live Site?

I have a situation when to a laravel/vuejs/bootstrap project we need to add html developer, who knows html/css, but no .vue/.scss with npm watch utility and that seems very complicated for him to install this app on his side.

As far as I know there are possibilities in such cases for html developer to edit site view live.

I even know such plugin https://forum.vivaldi.net/topic/10124/user-css-extensions I worked with it a but. Are there some tools for html developer to work with live pages in browsers?

Thanks!

26 Jun
3 weeks ago

PetroGromovo left a reply on Why Installing Laravel 5.7 On Ubuntu I Have Fork Failed - Cannot Allocate Memory In Error

I tried

composer clear-cache

did not help me

I run with additive parameter :

$ sudo composer install  --profile
[6.2MB/0.20s] Loading composer repositories with package information
[6.4MB/0.35s] Updating dependencies (including require-dev)
[1449.1MB/271.30s]   - Installing psr/log (1.1.0)
[448.4MB/317.90s] The following exception is caused by a lack of memory and not having swap configured
[448.4MB/317.91s] Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

PHP Fatal error:  Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /usr/share/php/Symfony/Component/Console/Application.php:943
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', '/usr/share/php/...', 943, Array)
#1 /usr/share/php/Symfony/Component/Console/Application.php(943): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /usr/share/php/Symfony/Component/Console/Application.php(751): Symfony\Component\Console\Application->getSttyColumns()
#3 /usr/share/php/Symfony/Component/Console/Application.php(712): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /usr/share/php/Symfony/Component/Console/Application.php(645): Symfony\Component\Console\Application->getTerminalWidth()
#5 /usr/share/php/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(ErrorException), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /usr/share/php/Composer/Console/Application.ph in /usr/share/php/Symfony/Component/Console/Application.php on line 943

Fatal error: Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /usr/share/php/Symfony/Component/Console/Application.php:943
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', '/usr/share/php/...', 943, Array)
#1 /usr/share/php/Symfony/Component/Console/Application.php(943): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /usr/share/php/Symfony/Component/Console/Application.php(751): Symfony\Component\Console\Application->getSttyColumns()
#3 /usr/share/php/Symfony/Component/Console/Application.php(712): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /usr/share/php/Symfony/Component/Console/Application.php(645): Symfony\Component\Console\Application->getTerminalWidth()
#5 /usr/share/php/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(ErrorException), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /usr/share/php/Composer/Console/Application.ph in /usr/share/php/Symfony/Component/Console/Application.php on line 943
$ free
              total        used        free      shared  buff/cache   available
Mem:        1014384       49112      873628        1308       91644      832716
Swap:       1048572      257092      791480

It was very strange to read in error's description:

The following exception is caused by a lack of memory and not having swap configured

as my free command show that I have swap . Also I need to notice that command

sudo composer install

was hung for more 5 minutes...

Any ideas?

P.S : I created new laravel app with default packages and composer installed it ok... as it has very few packeges? Can it be that some packages in my packages listing above raised this problem ?

21 Jun
1 month ago

PetroGromovo left a reply on Why Installing Laravel 5.7 On Ubuntu I Have Fork Failed - Cannot Allocate Memory In Error

I still search for a decision. I tried to install other project, which has less number of installed packages(actually that is laravel / vuejs app), but I got the same error :

# composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/polyfill-ctype (v1.11.0)
    Downloading: 100%         
The following exception is caused by a lack of memory and not having swap configured
Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

PHP Fatal error:  Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /usr/share/php/Symfony/Component/Console/Application.php:943
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', '/usr/share/php/...', 943, Array)
#1 /usr/share/php/Symfony/Component/Console/Application.php(943): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /usr/share/php/Symfony/Component/Console/Application.php(751): Symfony\Component\Console\Application->getSttyColumns()
#3 /usr/share/php/Symfony/Component/Console/Application.php(712): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /usr/share/php/Symfony/Component/Console/Application.php(645): Symfony\Component\Console\Application->getTerminalWidth()
#5 /usr/share/php/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(ErrorException), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /usr/share/php/Composer/Console/Application.ph in /usr/share/php/Symfony/Component/Console/Application.php on line 943

Fatal error: Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /usr/share/php/Symfony/Component/Console/Application.php:943
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', '/usr/share/php/...', 943, Array)
#1 /usr/share/php/Symfony/Component/Console/Application.php(943): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /usr/share/php/Symfony/Component/Console/Application.php(751): Symfony\Component\Console\Application->getSttyColumns()
#3 /usr/share/php/Symfony/Component/Console/Application.php(712): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /usr/share/php/Symfony/Component/Console/Application.php(645): Symfony\Component\Console\Application->getTerminalWidth()
#5 /usr/share/php/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(ErrorException), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /usr/share/php/Composer/Console/Application.ph in /usr/share/php/Symfony/Component/Console/Application.php on line 943

composer.json of this project:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "fzaninotto/faker": "^1.8",
        "intervention/image": "^2.4",
        "laracasts/utilities": "^3.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "orangehill/iseed": "^2.6",
        "pusher/pusher-php-server": "^3.4",
        "tymon/jwt-auth": "^1.0.0",
        "wboyz/laravel-enum": "^0.2.1",
        "zizaco/entrust": "^1.9"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "beyondcode/laravel-query-detector": "^1.0",
        "filp/whoops": "^2.0",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0",
        "xethron/migrations-generator": "^2.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

Also strange thing that I have installed both applications in ubuntu 18 under Digital Ocean with the same memory quantity. on AWS Ubuntu 16:

# lsb_release -d; uname -r; uname -i
Description:    Ubuntu 16.04.6 LTS
4.4.0-1084-aws
x86_64

# free
              total        used        free      shared  buff/cache   available
Mem:        1014384       48724      856564         700      109096      824368
Swap:       1048572      264404      784168

on Digital Ocean Ubuntu 18:

# lsb_release -d; uname -r; uname -i
Description:    Ubuntu 18.04.1 LTS
4.15.0-47-generic
x86_64
# free
              total        used        free      shared  buff/cache   available
Mem:        1009156      324640      109012       52520      575504      473160
Swap:       1048572      357888      690684

Can the reason of error on AWS Ubuntu 16 that something is not configured properly? Though I installed and configured both servers, maybe I missed something on AWS Ubuntu 16 ?

20 Jun
1 month ago

PetroGromovo started a new conversation How To Install Postgresql And Phppgadmin With Nginx?

Hello,

I need to install postgresql and phppgadmin with nginx installed under ubuntu 16(AWS) I installed packages :

$ sudo apt-get -y install postgresql postgresql-contrib phppgadmin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
phppgadmin is already the newest version (5.1+ds-1ubuntu1).
postgresql is already the newest version (9.5+173ubuntu0.2).
postgresql-contrib is already the newest version (9.5+173ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.

in phpinfo I see drivers installed http://ec2-18-224-82-207.us-east-2.compute.amazonaws.com/info.php

PostgreSQL driver for PDO   Edin Kadribasic, Ilia Alshanetsky
PostgreSQL  Jouni Ahto, Zeev Suraski, Yasuo Ohgaki, Chris Kings-Lynne

But running phppgadmin in url like : http://ec2-18-224-82-207.us-east-2.compute.amazonaws.com/phppgadmin I got error :

404 Not Found
nginx/1.10.3 (Ubuntu)

Searching for decision I found that /etc/nginx/sites-available/phppgadmin directory, but :

$ cd /etc/nginx/sites-available
[email protected]:/etc/nginx/sites-available$ ls -la
total 16
drwxr-xr-x 2 root root 4096 Jun 18 05:15 .
drwxr-xr-x 6 root root 4096 Jun 12 15:46 ..
-rw-r--r-- 1 root root 2327 Jun 17 12:02 default
-rw-r--r-- 1 root root 2074 Jun 12 15:49 default.bak

Which steps I have to take to run phppgadmin and laravel 5 app ?

Thanks!

15 Jun
1 month ago

PetroGromovo left a reply on Why Installing Laravel 5.7 On Ubuntu I Have Fork Failed - Cannot Allocate Memory In Error

Do you mean that it depends on (count of) my installed packeges?

composer.json :
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "alaouy/youtube": "^2.2",
        "aloha/twilio": "^4.0",
        "arrilot/laravel-widgets": "^3.12",
        "beyondcode/laravel-websockets": "^1.0",
        "cviebrock/eloquent-sluggable": "^4.5",
        "davejamesmiller/laravel-breadcrumbs": "5.x",
        "doctrine/dbal": "^2.8",
        "elasticquent/elasticquent": "dev-master",
        "facebook/graph-sdk": "^5.7",
        "fideloper/proxy": "^4.0",
        "google/apiclient": "^2.2",
        "intervention/image": "^2.4",
        "itsgoingd/clockwork": "^3.0",
        "jrean/laravel-user-verification": "^7.0",
        "laravel/framework": "5.8.*",
        "laravel/socialite": "^3.2",
        "laravel/tinker": "^1.0",
        "laravelium/sitemap": "^3.1",
        "maatwebsite/excel": "^3.1",
        "mews/captcha": "^2.2",
        "mews/purifier": "^2.1",
        "proengsoft/laravel-jsvalidation": ">2.2.0",
        "pusher/pusher-php-server": "~3.0",
        "rap2hpoutre/laravel-log-viewer": "^0.19.1",
        "s-ichikawa/laravel-sendgrid-driver": "~2.0",
        "snowfire/beautymail": "dev-master",
        "socialiteproviders/instagram": "^3.0",
        "spatie/browsershot": "^3.27",
        "spatie/laravel-activitylog": "^3.1",
        "spatie/laravel-backup": "^6.1",
        "spatie/laravel-feed": "^2.1",
        "spatie/laravel-newsletter": "^4.2",
        "spatie/laravel-sitemap": "^5.3",
        "spatie/laravel-tags": "^2.1",
        "spipu/html2pdf": "^5.2",
        "themsaid/laravel-mail-preview": "^2.0",
        "unisharp/laravel-filemanager": "^1.9",
        "wboyz/laravel-enum": "^0.2.1",
        "willvincent/feeds": "1.1.*",
        "yajra/laravel-datatables-oracle": "^9.0.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.1",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "orangehill/iseed": "^2.6",
        "phpunit/phpunit": "^7.0",
        "xethron/migrations-generator": "^2.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ],


        "post-update-cmd": [
            "php artisan vendor:publish --provider=\"Proengsoft\JsValidation\JsValidationServiceProvider\" --tag=public --force"
        ]

    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

any of them could demand too much of memory?

and additively package.json :
{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.18",
        "bootstrap": "^4.1.0",
        "cross-env": "^5.1",
        "laravel-mix": "^2.1.14",
        "lodash": "^4.17.11",
        "popper.js": "^1.14.6",
        "vue": "^2.5.7"
    },
    "dependencies": {
        "bootstrap-colorpicker": "^3.0.3",
        "datatables.net-bs": "^1.10.19",
        "font-awesome": "^4.7.0",
        "jquery": "^3.3.1",
        "jquery-confirm": "^3.3.2",
        "laravel-echo": "^1.5.2",
        "mustache": "^2.3.0",
        "puppeteer": "^1.14.0",
        "pusher-js": "^4.3.1"
    }
}

PetroGromovo started a new conversation Why Installing Laravel 5.7 On Ubuntu I Have Fork Failed - Cannot Allocate Memory In Error

Hello, Installing Laravel 5.7 app with LEMP on ubunutu 16 under AWS I got allocate memory error :

$ composer install
Cannot create cache directory /home/ubuntu/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/ubuntu/.composer/cache/files/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)

PHP Fatal error:  Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /usr/share/php/Symfony/Component/Console/Application.php:943
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', '/usr/share/php/...', 943, Array)
#1 /usr/share/php/Symfony/Component/Console/Application.php(943): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /usr/share/php/Symfony/Component/Console/Application.php(751): Symfony\Component\Console\Application->getSttyColumns()
#3 /usr/share/php/Symfony/Component/Console/Application.php(712): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /usr/share/php/Symfony/Component/Console/Application.php(645): Symfony\Component\Console\Application->getTerminalWidth()
#5 /usr/share/php/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(RuntimeException), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /usr/share/php/Composer/Console/Application. in /usr/share/php/Symfony/Component/Console/Application.php on line 943

Fatal error: Uncaught ErrorException: proc_open(): fork failed - Cannot allocate memory in /usr/share/php/Symfony/Component/Console/Application.php:943
Stack trace:
#0 [internal function]: Composer\Util\ErrorHandler::handle(2, 'proc_open(): fo...', '/usr/share/php/...', 943, Array)
#1 /usr/share/php/Symfony/Component/Console/Application.php(943): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /usr/share/php/Symfony/Component/Console/Application.php(751): Symfony\Component\Console\Application->getSttyColumns()
#3 /usr/share/php/Symfony/Component/Console/Application.php(712): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /usr/share/php/Symfony/Component/Console/Application.php(645): Symfony\Component\Console\Application->getTerminalWidth()
#5 /usr/share/php/Symfony/Component/Console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(RuntimeException), Object(Symfony\Component\Console\Output\StreamOutput))
#6 /usr/share/php/Composer/Console/Application. in /usr/share/php/Symfony/Component/Console/Application.php on line 943

I suppose that is memory lack error

phpinfo shows me :
memory_limit    2056M   2056M

I checked parameters both in /etc/php/7.2/fpm/php.ini and files /etc/php/7.2/cli/php.ini files:

memory_limit = 2056M
max_execution_time = 3300 
max_input_time = 240 

upload_max_filesize = 200M 
post_max_size = 200M
output_buffering = on 
short_open_tag = On  



$ uname -a
Linux serge 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


$ free
              total        used        free      shared  buff/cache   available
Mem:        1014384      224744      454504       13848      335136      611300
Swap:       1048572           0     1048572

$ whoami
ubuntu

I think this memory must be enough for my app, but why error ? Which parameters have I to pay attention at ?

Thanks!

13 Jun
1 month ago

PetroGromovo left a reply on Can You Advice Some Bootstrap / Vuejs Templates?

Thank you, very interesting! I found https://www.creative-tim.com/product/now-ui-dashboard very interesting, but

  1. I want to clarify where can I check that is bootstrao 4/vuejs template?
  2. I see "Upgrade to PRO" buttom. I have to pay $49 for full version?

PetroGromovo left a reply on Can You Advice Some Bootstrap / Vuejs Templates?

Thank you for provided link, but I need more practice in bootstrap, especially with bootstrap/vuejs templates. Sure I searched and found some, but they do not like very good at my glance...

12 Jun
1 month ago

PetroGromovo started a new conversation Can You Advice Some Bootstrap / Vuejs Templates?

Hello, I am a php/laravel developer and I have some expierence with Bootstrap and vuejs. I want more of practice with bootstrap 4.3/ vuejs 2.5 templates. Can you advice some? Free preferable.

Thanks!

04 Jun
1 month ago

PetroGromovo left a reply on When Page Is Opened Image In Vue-carousel Is Not Visible. Need To Click.

Searching for a decision I found vue-focus directive. I installed it to my app and checking it on simple text input I see that it works ok. I tried to use it in carousel component as :

                    <carousel
                            v-show="hostelImages.length"
                            :centerMode="false"
                            :perPage="1"
                            :navigationEnabled="true"
                            paginationColor="#7e7e7e"
                            paginationPosition="bottom"
                            class="m-4"
                            zIndex= "100 !important"
                    >
                        <slide v-for="nextHostelImage, index in hostelImages" :key="nextHostelImage.id">
                            <img
                                    :src="nextHostelImage.filenameData.image_url"
                                    :alt="nextHostelImage.filename"
                                    style="width:320px; height : auto; "
                                    v-focus.lazy="true"
                            >
                            <p class="description-text pl-5 pr-5">
                                {{ nextHostelImage.info }}
                            </p>
                        </slide>
                    </carousel>

OR

                    <carousel
                            v-show="hostelImages.length"
                            :centerMode="false"
                            :perPage="1"
                            :navigationEnabled="true"
                            paginationColor="#7e7e7e"
                            paginationPosition="bottom"
                            class="m-4"
                            zIndex= "100 !important"
                            v-focus.lazy="true"
                    >
                        <slide v-for="nextHostelImage, index in hostelImages" :key="nextHostelImage.id">
                            <img
                                    :src="nextHostelImage.filenameData.image_url"
                                    :alt="nextHostelImage.filename"
                                    style="width:320px; height : auto; "
                            >
                            <p class="description-text pl-5 pr-5">
                                {{ nextHostelImage.info }}
                            </p>
                        </slide>
                    </carousel>

But in both cases I do not see images on page opened.

  1. If there is a way to simulate click of a mouse on carousel's image?

  2. Testing in browser I noticed that when I change device in browse I see that my carousel's image becomes visible. Can that be decision for my problem ?

03 Jun
1 month ago

PetroGromovo started a new conversation When Page Is Opened Image In Vue-carousel Is Not Visible. Need To Click.

Hello, Working with Laravel 5.7 / Vuejs 2.6 / Bootstrap 4.3 app I use "vue-carousel": "^0.18.0" I have a problem that defing carousel with images at page opening the page is not visible at all. But if to click on the empty image space then image is visible and carousel works ok. in vue file :

                <div class="col-sm-12">

                    <div class="pull-left" style="max-width: 350px;">
                        <carousel
                                v-show="hostelImages.length"
                                :centerMode="false"
                                :perPage="1"
                                :navigationEnabled="true"
                                paginationColor="#7e7e7e"
                                paginationPosition="bottom"
                                class="m-4"
                                zIndex= "100 !important"
                        >
                            <slide v-for="nextHostelImage, index in hostelImages" :key="nextHostelImage.id">
                                <img :src="nextHostelImage.filenameData.image_url" :alt="nextHostelImage.filename" style="width:320px; height : auto; ">
                                <p class="description-text pl-5 pr-5">
                                    {{ nextHostelImage.info }}
                                </p>
                            </slide>
                        </carousel>

                        <a class="a_link" href="/images/emptyImg.png" v-show="!hostelImages.length">
                            <!--{{  "?dt=".time()  }}-->
                            <img class="single_vote_image_left_aligned" src="/images/emptyImg.png" alt="alt text">
                        </a>
                    </div>


                    <p class="card-text mt-3 description-text" v-html="hostelRow.descr"></p>
                    ...

<script>
    import {bus} from '../../../app';
    import appMixin from '../../../appMixin';
    import hostelsMixin from '../../../hostelsMixin';
    import {Carousel, Slide} from 'vue-carousel';

    export default {

        components: {
            Carousel,
            Slide
        },

...
<style scoped lang="css">

   #container {
      padding: 0 60px;
   }

   .VueCarousel-slide {
      position: relative;
      background: #42b983;
      border: 2px dotted green;
      color: #fff;
      font-size: 24px;
      text-align: center;
      min-height: 100px;
   }

   .label {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
   }

</style>

You can look at it live : http://hostels-tours.nilov-sergey-demo-apps.tk/hostel/new-hostel-test21/south-australia/far-north/adelaide-1

Why error and how to fix it ?

Thanks!

01 Jun
1 month ago

PetroGromovo started a new conversation Error With Style Definitions For Vuejs-paginate

Hello, Working with Laravel 5.7 / Vuejs 2.6 / Bootstrap 4.3 app I use "vuejs-paginate": "^2.1.0" and I have styles problems, that defining in the same vue file paginate component ans css definitions, like

        <div class="row p-0 pl-3 pr-3 m-0">
            <paginate
                    :page-count="getPagesCount"
                    :click-handler="paginationPageClicked"
                    :prev-text="'Prev'"
                    :next-text="'Next'"
                    :container-class="'className'"

                    :pageRange="3"
                    :marginPages="2"
                    :page-class="'paginate-page-item'"

                    :active-class="'paginate-active'"
                    :first-last-button="true"
                    :margin-pages="5"

            >
            </paginate>
        </div>

<style lang="css" >
    ul.className {
        list-style-type: none;
        padding: 0;
        max-height: 30px !important;
    }

    /*li {*/
    li.paginate-page-item {
        display: inline-block !important;
        margin: 0 10px !important;
        background: yellow !important;
    }

    .paginate-active {
        font-weight: bold !important;
        color: grey;
        background-color: lightgrey;
        padding: 2px 5px 2px 5px;
    }


</style>

If to uncomment line :

/*li {*/

above, my pagination looks good. But I do not like this way, as li style definition influence other pages

If to define :

    li.paginate-page-item {

then paginaion conponent is broken, you can look to it live: http://hostels-tours.nilov-sergey-demo-apps.tk/

I added yellow class to the background of the component to see definitions are applied.

Why error and how to fix it ?

Thanks!

31 May
1 month ago

PetroGromovo started a new conversation Purifier For Vuejs ?

Hello, Working with Laravel 5 / blade I use mews/purifier and in blade template I wrote :

                {!! Purifier::clean($voteItemImagePropsAttribute['file_info']) !!}

Do we need to use are there similar tools for vuejs >= 2.5 ? I searched including here https://github.com/vuejs/awesome-vue

and did not frind a solution...

Thanks!

26 May
1 month ago

PetroGromovo started a new conversation How Set Password In Envoy

Hello, With laravel 5.7 app running envoy command I can set some parameters, like

envoy run Hostels2Deploy  --lardeployer_password=mypass 

and on any block I have to enter manually password. How can I use password parameter if in my envoy file I have

@setup
    $server_login_user= 'lardeployer';
    ...
@endsetup
    ...
    @servers(['dev' => $server_login_user.'@NN.NN.NN.NN'])

Thanks!

22 May
2 months ago

PetroGromovo left a reply on How To Send Report In In Scheduled Time

My report is run by (local )url : http://local-boxbooking2.com/admin/report/available-spaces-by-zones I remade so that if to run url http://local-boxbooking2.com/admin/report/available-spaces-by-zones/send-email-on-open

in browser report is opened and checking “send-email-on-open” javascript function is triggered to sent by email (with Sendgrid service ) content of the page(report actually)

I tried to trigger command by cron tasks : In app/Console/Commands/reportAvailableSpacesByZones.php :

class reportAvailableSpacesByZones extends Command
{
    public function handle()
    {
        \Log::info( 'Report From inside app/Console/Commands/reportAvailableSpacesByZones.php run # ' . time()  );
        return redirect()->to('/admin/report/available-spaces-by-zones/send-email-on-open');
    }

I see log info , but no reports by email. Which way is correct ?

18 May
2 months ago

PetroGromovo left a reply on How Better To Filter Data Which Were Read With Curl ?

Searching I found using of temporary table in laravel, like https://stackoverflow.com/questions/42555512/how-to-create-temporary-table-in-laravel and https://laracasts.com/discuss/channels/laravel/how-to-implement-temporary-table . which are session based. I want take advantage of filters for Model, Which I will create for this temporary tanle. That looks like what I need, but is it ok for my task. I hope I explained clearly what I need. Has laravel some better tools for it? Who worked with it?

16 May
2 months ago

PetroGromovo started a new conversation How Better To Filter Data Which Were Read With Curl ?

Hello, In my new Laravel 5.8 app I read data from external source using curl which has some filters. I need more filters applied and to save filtered rows in db. My question is how better to filter data which were read with curl.

First idea to save all data in temp table with session_unique_id field as system is multiuser and apply filters on these data. The thing is that there more 10 filters in the system and using scopes I can controle filteres like:

    public function scopeGetByVote($query, $vote_id= null)
    {
        if (!empty($vote_id)) {
            if ( is_array($vote_id) ) {
                $query->whereIn( with(new VoteItem)->getTable().'.vote_id', $vote_id );
            } else {
                $query->where( with(new VoteItem)->getTable() . '.vote_id', $vote_id );
            }
        }
        return $query;
    }

as some filters can be selected, but some not.

Has Laravel 5.8 some better tools for rows filtering without writing data to temp tables? Are there some better tools from point of productivity? That is multiusers system and can have quite a lot of requests...

Thanks!

13 May
2 months ago

PetroGromovo started a new conversation How To Send Report In In Scheduled Time

Hallo, In laravel 5.8 I have a report with a button “Send Email” by clicking on this button ajax request is run, with content of a report in “report_html” var to control like:

    public function sentReportEmailContent()
    {
        $request= request();
        $requestData= $request->all();

        $report_html= $requestData['report_html'];

        $loggedUser= Auth::user();

        $reportAvailableSpacesByZonesAcceptorsArray = config('app.reportAvailableSpacesByZonesAcceptorsArray', []);
        $site_name                                  = config('app.name', '');
        if ( count($reportAvailableSpacesByZonesAcceptorsArray) == 0 ) {
            return response()->json(['error_code' => 1, 'message' => 'There are no receiver emails specified !'], HTTP_RESPONSE_INTERNAL_SERVER_ERROR);
        }

        $to= $reportAvailableSpacesByZonesAcceptorsArray[0];
        $subject= 'Available Spaces By Zones report was sent at ' . $site_name;
        $additiveVars= [ 'html'=> $report_html ];

        unset($reportAvailableSpacesByZonesAcceptorsArray[0]);
        $cc= $reportAvailableSpacesByZonesAcceptorsArray;
        \Mail::to($to)->send( new SendgridMail( 'emailContainer', $to, $cc, $subject , $additiveVars ) );

        return response()->json(['error_code' => 0, 'message' => '', 'user'=> $loggedUser->id], HTTP_RESPONSE_OK);
    }

and with Sendgrid service report is sent to users defined in config ok.

Now I need to run this report and send email to recievers in scheduler.

I created a new command :
php artisan make:command reportAvailableSpacesByZones  --command=report:available-spaces-by-zones
which has handle method:
    public function handle()
    {
        \Log::info( 'Report run # ' . time()  );
    }

which is triggered in scheduled time. But how can I run my report and sent it's content like it is done manually ?

Thanks!

11 May
2 months ago

PetroGromovo started a new conversation I Have No Access To Console Of My Server

Hello, Working with laravel 5.8 I have no access to console of my server(only ftp access) and I have problems with running console commands. I know that there is Artisan::call method, which can be usefull in my case, but are some plugings/tools helfull in this case ?

Thanks!

10 May
2 months ago

PetroGromovo started a new conversation How In Laravel / Vuejs / Jwt To Make Time Of Session Much Bigger?

Hello, In my laravel 5.8 / "vue": "^2.5.17" / "vuex": "^3.1.0" / "tymon/jwt-auth": "^1.0.0" app I login into the system and current logged user is saved in localStorage with line like:

     localStorage.setItem("loggedUser", JSON.stringify(state.currentLoggedUser));

I want to make time of session much bigger, and I found option in my config/auth.php :

<?php

return [


    'defaults' => [
        'guard' => 'api',
        'passwords' => 'users',
    ],

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'jwt',
            'provider' => 'users',
            'hash' => false,
        ],
    ],

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],

    ],


    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 460, // I modified this option !
        ],
    ],

];

But as I see that does not help, and seems tine of my session expired is rather short, withing 1 hour. Are there some other config options to make time of session much bigger ?

Thanks!

02 May
2 months ago

PetroGromovo started a new conversation Problems Installin Frogetor Admin Dashboard Template To My Laravel 5.8

Hello, I try to install Frogetor admin dashboard template to my laravel 5.8 / Bootstrap 4 /vuejs 2/ boostrat 4 app, but seems not all is appliued properly.

In the docs of the template I read :


Files are explained below:

File    Description
bootstrap.min.css   Frogetor uses the bootstrap v4.3.1. The core bootstrap file is being used in all the pages.
icons.css   Combines various font icons. You should remove the fonts you don't plan to use from this file and recompile it.
style.css   The main stylesheet file, it's being generated from less and contains all the css styles combined.
Javascript
Frogetor uses jQuery, Bootstrap JS framework(at its core) and some of the third-party plugins. There are may more third party plugin which you can use according to your needs. The css is already containing matching style for these plugins so you will not need to do anything around it.

They are explained below:

File    Description
jquery.js, bootstrap.bundle.min.js, etc.    These files are used at core of the theme.
app.js  This is a main js file. It contains the custom JS code needed for features including layout, sidebar, etc.
pages/*.js  These are the files containing pages specific code. They are mainly used for demo purpose.
plugins/**.js   All supported and integrated third-party plugins are included in here.


I consider I need to exclude all jquery/bootstrap files from my app and include all  jquery/bootstrap files from this template.
In resources/js/bootstrap.js file I commented lines with jquery/bootstrap :

window._ = require('lodash');

try { // window.$ = window.jQuery = require('jquery');

// require('bootstrap');

} catch (e) {}

window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';


In resources/views/index.blade.php file which is base of my app I added lines with jquery/bootstrap  of this template :

    <title id="app_title">{{ config('app.name', 'Laravel') }}</title>

    <link href="{{ asset(('css/Horizontal/icons.css')) }}" rel="stylesheet" type="text/css">
    <link href="{{ asset(('css/Horizontal/metismenu.min.css')) }}" rel="stylesheet" type="text/css">
    <link href="{{ asset(('css/Horizontal/style.css')) }}" rel="stylesheet" type="text/css">
    <link href="{{ asset(('css/app.css')) }}" rel="stylesheet" type="text/css">
    <link href="{{ asset(('css/Horizontal/bootstrap.min.css')) }}" rel="stylesheet" type="text/css">

</head>
<body>
    <div id="app">
        <mainapp></mainapp>
    </div>
</body>

@include('footer')
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/bootstrap.bundle.min.js') }}"></script>
<script src="{{ asset('js/app.js') }}{{  "?dt=".time()  }}"></script>


But page looks ugly : https://imgur.com/a/cdzjbLd
in cosole I see that all attached files rendered ok : https://imgur.com/a/mKXZT90

This page is at http://phpstack-231450-819857.cloudwaysapps.com/horizontal/auth-login.html
I see that icons are not applied, without button styles...
Did I miss something ?

Thanks!
29 Apr
2 months ago

PetroGromovo left a reply on How To Implement Roles/groups With Jwt-auth ?

Usually I follow the rule not to work with plugins which has last modifications more 1 year... Do you follow this rule? What as for this case?

27 Apr
2 months ago

PetroGromovo started a new conversation How To Implement Roles/groups With Jwt-auth ?

Hello, In laravel 5.7/Vuejs 2.6 app I use jwt-auth for auth and I need to implement roles/groups for logged user. Googling I found https://github.com/Zizaco/entrust decision, the only thing that raised my doubts is that last time it was is 2 years. How do you think is it good decision now? Can you advice some other decision ?

Thanks!

25 Apr
2 months ago

PetroGromovo left a reply on How Define Different Skin In Other Components Dirs

But as app.js has some init code it means that for any skin I need to keep all modifications in all app.js, that seems not good... Any other decision?

PetroGromovo left a reply on How Define Different Skin In Other Components Dirs

Can it be in some other way? Different resources/js/routes.js which is also imported in app.js?Some better desicion ?

24 Apr
2 months ago

PetroGromovo started a new conversation How Define Different Skin In Other Components Dirs

Hello, In laravel 5.7/Vuejs 2.6 app I want to get components from directory depending on user's option (different skin), like in resources/js/app.js :

let template_name = 'BS4'; // this option would be from user's profile data
Vue.component('editor-header', require('./components/'+template_name+'/lib/EditorHeader.vue').default);

and code above works ok

But defining routes in resources/js/routes.js:

let template_name = 'BS4';
import Home from './components/'+template_name+'/Home.vue';

I got error :

 Unexpected token, expected ";" (7:32)

I tried as :

let template_name = 'BS4';
if ( template_name == 'BS4' ) {
import
    Home
    from
    './components/BS4/Home.vue';
}

and got error:

'import' and 'export' may only appear at the top level (8:0)

If there is a valid way value to make it ?

Thanks!

12 Apr
3 months ago

PetroGromovo left a reply on How To Auth Into App With 2 Tables

@CRONIX - Thanks, I made 1 table(User) with different roles. But I would prefer create and use Customer model(which actually read data from users table but with some role, referring users_roles table). If that is possible and if yes how?

09 Apr
3 months ago

PetroGromovo started a new conversation How To Auth Into App With 2 Tables

Hello, In my laravel 5.7 / Vuejs application with standart users table and by this table user can login into the system. Rows in users table means “employees” and they can login into backend part of the site. I need to add “customers” table(actuaslly I have this table with existing data) by which customers also can login into frontend part of the site.

I use “auth” module and my question is if there is a way to use 2 tables for auth functionality?

If yes how?

I use tymon/jwt-auth for authantification.

Thanks!

PetroGromovo started a new conversation Error Generating Migrations With Postgres Type Fields

Hello, In my laravel 5.5.18 version I use https://github.com/Xethron/migrations-generator (version "^2.0")

and running migration generator from postgres (PostgreSQL 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0, 64-bit) I got error :

Setting up Tables and Index Migrations
Created: /mnt/_work_sdb8/wwwroot/lar/lprods/database/migrations/2019_04_08_145315_create_pd_category_table.php                                                                                                         
                                                                                                                                                                                                                       
                                                                                                                                                                                                                       
  [Doctrine\DBAL\DBALException]                                                                                                                                                                                        
  Unknown database type type_attributelabel requested, Doctrine\DBAL\Platforms\PostgreSQL92Platform may not support it.                                                                                                

I have table defined :

CREATE TABLE public.pd_attribute (
    id smallserial NOT NULL,
    "name" varchar(50) NOT NULL,
    label varchar(50) NOT NULL,
    "type" type_attributelabel NOT NULL,
    "ordering" int2 NOT NULL,
    created_at timestamp NOT NULL DEFAULT now(),
    CONSTRAINT ind_pd_attribute_label_unique UNIQUE (label),
    CONSTRAINT ind_pd_attribute_name_unique UNIQUE (name),
    CONSTRAINT pd_attribute_pkey PRIMARY KEY (id)
)
WITH (
    OIDS=FALSE
) ;

and definition with :

CREATE TYPE type_attributelabel AS ENUM (
    'S',
    'I'
);

If there is a way to generate mysql compatible files, with enums for such cases, or just string field ?

Thanks!

29 Mar
3 months ago

PetroGromovo left a reply on Error Installing Laravel 5 App With Refering Db In AppServiceProvider.php Boot

I added method to define is cli running :

    public   function isCliCommand( ) {
        if (strpos(php_sapi_name(), 'cli') !== false) {
            return true;
        }
        return false;
    }

and add it to boot method condition :

    public function boot()
    {

        if ( \Schema::hasTable(with( new Settings)->getTable() ) and !$this->isCliCommand() ) {   // It is run under web/ command line / tests
            //  we do not need it  command line
            $settingsArray = Settings::getSettingsList(['site_name', 'site_heading', 'noreply_email'], -1, __FILE__, __LINE__);
            $site_name     = !empty($settingsArray['site_name']) ? $settingsArray['site_name'] : '';
            $site_heading  = !empty($settingsArray['site_heading']) ? $settingsArray['site_heading'] : '';
            $noreply_email = !empty($settingsArray['noreply_email']) ? $settingsArray['noreply_email'] : '';

            config(['feed.feeds.main.title' => htmlspecialchars_decode($site_name . ' : ' . $site_heading)]);
            config(['mail.from.name' => htmlspecialchars_decode($site_name . ' support')]);
            config(['mail.from.address' => htmlspecialchars_decode($noreply_email)]);
        }
        if( !$this->isDeveloperComp() ) {
            \URL::forceScheme('https');
        }

Looks like it works, though I am not sure if that is best decision ?

28 Mar
3 months ago

PetroGromovo left a reply on Error Installing Laravel 5 App With Refering Db In AppServiceProvider.php Boot

Thank you for your feedback! That seems sensible! Can you give example which middleware it can be? usually middleware are applied in routes file some some request or group of requests. In my case it must be applied to all web requests...

PetroGromovo left a reply on Error Installing Laravel 5 App With Refering Db In AppServiceProvider.php Boot

I still search for a decision. Is there is a better way to fill config values from databse setting, not in app/Providers/AppServiceProvider.php ?

PetroGromovo started a new conversation Error Installing Laravel 5 App With Refering Db In AppServiceProvider.php Boot

Hello, In laravel 5.8 app I need tofill config values from databse setting and for this I do in app/Providers/AppServiceProvider.php :

    public function boot()
    {
        $request= request();
        if ( \Schema::hasTable(with( new Settings)->getTable() ) ) {
            $settingsArray = Settings::getSettingsList(['site_name', 'site_heading', 'noreply_email'], -1, __FILE__, __LINE__);
            $site_name     = !empty($settingsArray['site_name']) ? $settingsArray['site_name'] : '';
            $site_heading  = !empty($settingsArray['site_heading']) ? $settingsArray['site_heading'] : '';
            $noreply_email = !empty($settingsArray['noreply_email']) ? $settingsArray['noreply_email'] : '';

            config(['feed.feeds.main.title' => htmlspecialchars_decode($site_name . ' : ' . $site_heading)]);
            config(['mail.from.name' => htmlspecialchars_decode($site_name . ' support')]);
            config(['mail.from.address' => htmlspecialchars_decode($noreply_email)]);
        }

It works ok, but not when I install my app on server, it looks like that there is reference to boot method above while running

composer install

and I got database error, as I have no .env file yet. If to comment the code above all installation works ok. If there is some proper way for additive checking, like if key was generated here?

Thanks!

25 Mar
3 months ago

PetroGromovo started a new conversation Valid Condition In Blade Form Input

Hello, How to make valid condition for value tag in laravel 5.7 if field was modified and we have to show new value if field was modified ? I tried like that ( with required for this field) condition :

    (old('common_settings_site_name') ? old('common_settings_site_name') : ( isset($common_settings_site_name) ?$common_settings_site_name : '' ) ),

it is good, bur not in case when field with existing value was cleared, then original value(not old - clear) is shown.

Like text field had some text “Value” The field was cleared before submitting. submitting form text “Value” would be shown, not empty string as I exepcted ?

How to fix it ?

Thanks!

23 Mar
3 months ago

PetroGromovo started a new conversation Is It Possible To Use Https Access To Bitbucket Rep With Envoy In Laravel 5.7 App?

Hello, Is it possible to use https access to bitbucket rep with envoy in Laravel 5.7 app?

If I run command in console :

git clone https://[email protected]/client/project_name.git

on the target server(ubuntu 18 ubder Digital Ocean) it is cloned ok.

I tried to use http in envoy file with file's structure like:

@setup
$server_login_user= 'deployer_user';
...
# $repo= 'git clone [email protected]:myaccount/votes.git';
$repo= 'git clone https://[email protected]/myaccount/votes.git';

$branch= '';


@endsetup

@servers(['production' => $server_login_user.'@NNN.NN.NN.NN'])


@task( 'clone', ['on'=>$on] )

git clone {{ $branch }} "{{ $repo }} {{ $release_number }}"
@endtask

But running envoy in console I got error:

$ envoy run Deploy
[email protected]'s password:
[[email protected]]: Cloning into 'dest_directory'...
[[email protected]]: fatal: I don't handle protocol 'git clone https'
[✗] This task did not complete successfully on one of your servers.

Thanks!

16 Mar
4 months ago

PetroGromovo started a new conversation I Have Problems Implementing Infinite-Scroll Functionality

Hello, with https://infinite-scroll.com/ plugin in my laravel 5.7 / Bootstrap v4.1. / blade / jquery-3.3.1 / Infinite Scroll PACKAGED v3.0.5 application I implemented infinite-scroll functionality It works, but not fully. The problem is that when I scroll more pages than I have rows pagination still continues working and I got invalid rows loaded label.

Please look live https://www.votes.nilov-sergey-demo-apps.tk/all-external-news at top left of the page there is number of items loaded, buit moving bottom I got invalid message like

540 of 121 External News loaded

and no end of the page:

My base template has :

@extends($frontend_template_name.'.layouts.frontend')

@section('content')

    @inject('viewFuncs', 'App\library\viewFuncs')


    <h1 class="text-center">
        @if(isset($site_heading))<span>{{ $site_heading }}@endif</span>
        <br> {{ $all_external_news_count }} News
    </h1>


    @include($frontend_template_name.'.layouts.logged_user')

    <div class="row ml-2 mb-3">
        {{ Breadcrumbs::render('all-external-news', 'External News') }}
    </div>
    <div class="row ml-2 mb-3 small_title">
        <span id="span_external_news_loaded_count">{{ $external_news_loaded_count }}</span>&nbsp;of&nbsp;{{ $all_external_news_count }}&nbsp;External News loaded
    </div>


    <div class="row ml-1 mr-1">
        <div class="col-sm-8 ">

            <div class="row">

                <div id="infinite_scroll_container">

                    @foreach($allExternalNews as $nextAllExternalNews)
                        <article class="all-external-news-listing-append-block">

                            <div class="card">
                                <div class="card-body pt-2">

                                    <h5 class="card-title mb-0 pb-0">
                                        <a href="{{ route('news', $nextAllExternalNews['slug'] ) }}">
                                            {{ Purifier::clean($nextAllExternalNews['title']) }}
                                        </a>
                                        @if( $nextAllExternalNews['is_featured'] )
                                            <span class="float-right mt-0 pt-0 badge badge-pill badge-primary">Featured</span>
                                        @endif
                                    </h5>

                                    @if( !empty($nextAllExternalNews['content_shortly']) )
                                        <div class="card-footer mt-0 pt-0 mb-0 pb-0">
                                            <small>{!! Purifier::clean($nextAllExternalNews['content_shortly']) !!}</small>
                                        </div>
                                    @endif

                                    <div class="card-footer  mt-0 pt-0">
                                        <div class="row float-right mt-0 pt-0 published_by_author">
                                            Published at {{ $viewFuncs->getFormattedDateTime($nextAllExternalNews['created_at'], 'mysql', 'ago_format') }} by {{
    $nextAllExternalNews['source_type'] }}
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </article>
                    @endforeach
                </div>

                <div class="all-external-news-listing-load-status-block">
                    END OF CONTENT
                    <div class="loader-ellips infinite-scroll-request">
                        <span class="loader-ellips__dot"></span>
                        <span class="loader-ellips__dot"></span>
                        <span class="loader-ellips__dot"></span>
                        <span class="loader-ellips__dot"></span>
                    </div>
                    <p class="infinite-scroll-last">End of content</p>
                    <p class="infinite-scroll-error">No more pages to load</p>
                </div>

            </div>
        </div>


        @include($frontend_template_name.'.layouts.right_menu_block' , ['show_questions_block' => false, 'show_most_rated_quizzes_block' => true,
'show_most_taggable_votes_block' => true, 'show_Vote_categories_block'=> true ] )

    </div>

@endsection



@section('scripts')

    <script src="{{ asset('js/infinite-scroll.pkgd.min.js') }}{{  "?dt=".time()  }}"></script>
    <script src="{{ asset('js/'.$frontend_template_name.'/all_external_news.js') }}{{  "?dt=".time()  }}"></script>

    <script>
        /*<![CDATA[*/

        var frontendAllExternalNews = new frontendAllExternalNews('view',  // must be called before jQuery(document).ready(function ($) {
            <?php echo $appParamsForJSArray ?>
        );
        jQuery(document).ready(function ($) {
            frontendAllExternalNews.onFrontendPageInit('view')
        });

        /*]]>*/
    </script>

@endsection

so when page is opened first 20 rows are already shown

Moving down new data are uploaded with template :

@inject('viewFuncs', 'App\library\viewFuncs')
@if( !empty($latestExternalNewsData) and count($latestExternalNewsData) > 0 )
    <div class="latest-news-block mt-0 mb-0 mt-3 bordered">

        <h3 class="text-center">Our Partners  News</h3>
        <ul class="news-line">
        @foreach($latestExternalNewsData as $nextExternalLatestNew)

            <div class="card">
                <div class="card-body pt-0">

                    <h5 class="card-title mb-0 pb-0">
                        <a href="{{ $nextExternalLatestNew['source_url'] }}">
                            {!! Purifier::clean($nextExternalLatestNew['title']) !!}
                        </a>
                        @if( $nextExternalLatestNew['is_featured'] )
                            <span class="float-right mt-0 pt-0 badge badge-pill badge-primary">Featured</span>
                        @endif
                    </h5>

                    @if( !empty($nextExternalLatestNew['content_shortly']) )
                        <p class=" m-0 pt-0 ">
                            <small>
                                {!! Purifier::clean($nextExternalLatestNew['content_shortly']) !!}
                            </small>
                        </p>
                    @endif

                    <div class="card-footer  mt-0 pt-0">
                        <div class="row float-right mt-0 pt-0 published_by_author">
                            Published at {{ $viewFuncs->getFormattedDateTime($nextExternalLatestNew['created_at'], 'mysql', 'ago_format') }} by <b>&nbsp;{{
                            $nextExternalLatestNew['source_type'] }}</b>
                        </div>
                    </div>

                </div>
            </div>

        @endforeach
        </ul>


        @if( $all_external_news_count > count($latestExternalNewsData) )
            <div class="card">
                <div class="card-body pt-0">
                    <a href="{{ route('all-external-news' ) }}">
                        Our Partners All News
                    </a>
                </div>
            </div>
        @endif

    </div>
@else
    @if( !empty($config['show_no_items_label']) )
        <div class="alert alert-warning small" role="alert">
            There are no Our Partners news yet
        </div>
    @endif
@endif

and javascript file with infinity imnitialization :
var this_frontend_home_url
var this_infinite_scroll_rows_per_scroll_step
var this_csrf_token


function frontendAllExternalNews(page, paramsArray) {  // constructor of frontend AllExternalNews's editor - set all params from server
    // alert( "paramsArray page::"+var_dump(paramsArray) )
    this_frontend_home_url = paramsArray.frontend_home_url;
    this_infinite_scroll_rows_per_scroll_step = paramsArray.infinite_scroll_rows_per_scroll_step;
    this_csrf_token = paramsArray.csrf_token;

    if (page == "view") {
        this.InitInfiniteScroll()
    }
} // function frontendAllExternalNews(Params) {  constructor of frontend AllExternalNews's editor - set all params from server


frontendAllExternalNews.prototype.InitInfiniteScroll = function () {
    var infScroll = new InfiniteScroll('#infinite_scroll_container', {
            path: function () {
                console.log(" path this.loadCount::")
                console.log( this.loadCount )

                console.log("this.loadCount * this_infinite_scroll_rows_per_scroll_step::")
                console.log( this.loadCount * this_infinite_scroll_rows_per_scroll_step )

                if ( this.loadCount > 0 ) {
                    $("#span_external_news_loaded_count").html(this.loadCount * this_infinite_scroll_rows_per_scroll_step)
                }
                return '/get-all-external-news-listing/' + ( ( this.loadCount + 1 ) * this_infinite_scroll_rows_per_scroll_step );
            },
            append: '.all-external-news-listing-append-block',
            status: '.all-external-news-listing-load-status-block',
        }
        , function (data) {
        }
    )

}


frontendAllExternalNews.prototype.onFrontendPageInit = function (page) {  // all vars/objects init
    frontendInit()
} // frontendAllExternalNews.prototype.onFrontendPageInit= function(page) {

I have defined status block but it does not work. Why? Can it be the reason?

  1. Scrolling down I see that my url is changed to https://www.votes.nilov-sergey-demo-apps.tk/get-all-external-news-listing/20 I suppose that is not valid, but I do not see why?

Thanks!

PetroGromovo left a reply on Error In Migration With Use Prefix Set In Modal Constructor

Thank you, Looks like that was a reason of my errors.

Could, you, also,please, look at the net example:

        $mostRatingQuizQualityResultsDataTemp = QuizQualityResult
            ::select( $votes_tb.'.name as vote_name', $votes_tb.'.slug as vote_slug', $quiz_quality_results_tb.'.vote_id', 'count('.$quiz_quality_results_tb.'.quiz_quality_id) as quiz_quality_count', 'avg('.$quiz_quality_results_tb . '.quiz_quality_id) as quiz_quality_avg' )
            ->getByVoteStatus('A')
            ->orderBy($this->config['order_by_field_name'], $this->config['order_by_field_ordering'])
            ->groupBy('vote_id')
            ->groupBy('vote_slug')
            ->groupBy('vote_name')
            ->join( $votes_tb, $votes_tb.'.id', '=', $quiz_quality_results_tb.'.vote_id' )
            ->limit ($this->config['items_per_block'] )
            ->get();

which raise error :

ErrorException (E_ERROR)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'vt2_count(quiz_quality_results.quiz_quality_id)' in 'field list' (SQL: select `vt2_votes`.`name` as `vote_name`, `vt2_votes`.`slug` as `vote_slug`, `vt2_quiz_quality_results`.`vote_id`, `vt2_count(quiz_quality_results`.`quiz_quality_id)` as `quiz_quality_count`, `vt2_avg(quiz_quality_results`.`quiz_quality_id)` as `quiz_quality_avg` from `vt2_quiz_quality_results` inner join `vt2_votes` on `vt2_votes`.`id` = `vt2_quiz_quality_results`.`vote_id` where `vt2_votes`.`status` = A group by `vote_id`, `vote_slug`, `vote_name` order by `quiz_quality_avg` desc limit 8

?

15 Mar
4 months ago

PetroGromovo left a reply on Error In Migration With Use Prefix Set In Modal Constructor

Please look at this request, joining 2 tables :

        $activeQuizVotes = Vote
            ::getByStatus('A')
            ->getByIsHomepage(true)
            ->getByIsQuiz(true)
            ->orderBy('ordering', 'desc')
            ->orderBy('created_at', 'desc')
            ->leftJoin( "vote_categories", 'vote_categories.id', '=', 'votes.vote_category_id' )
            ->select( "votes.*, vote_categories.name as vote_category_name, vote_categories.slug as vote_category_slug" )
            ->paginate($home_page_ref_items_per_pagination)
            ->onEachSide((int)($home_page_ref_items_per_pagination / 2));

and it raised error :

Column not found: 1054 Unknown column 'vt2_votes.*, vote_categories.name' in 'field list' (SQL: select `vt2_votes`.`*, vote_categories`.`name` as `vote_category_name, vote_categories.slug` from `vt2_votes` left join `vt2_vote_categories` on `vt2_vote_categories`.`id` = `vt2_votes`.`vote_category_id` where `vt2_votes`.`status` = A and `vt2_votes`.`is_homepage` = 1 and `vt2_votes`.`is_quiz` = 1 order by `ordering` desc, `created_at` desc limit 8 offset 0)

I made vt2_ prefix in config/database.php file : and no prefix defined in config/app.php or model's constructor, what I show before.

PetroGromovo left a reply on Error In Migration With Use Prefix Set In Modal Constructor

@NASH - Thank you for your feedback! Actually I need DB::raw( for ->select( statement. I had problems in this part of requests. Let me check it more, but please look at your join requests with ->select definition , like in my example. Does it work for you without any raw methods?

PetroGromovo left a reply on Error In Migration With Use Prefix Set In Modal Constructor

I tried to keep db_prefix in configuration file and assign it in constructor. That way seems correct as I wrote above.

14 Mar
4 months ago

PetroGromovo left a reply on Error In Migration With Use Prefix Set In Modal Constructor

Thanks, you are right, But I suppose that not relative to my problem?