mstdmstd

mstdmstd

Member Since 1 Year Ago

Experience Points 8,610
Experience
Level
Lessons Completed 1
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

16 Jan
7 hours ago

mstdmstd left a reply on AJAX Lazy Loading Listing For Laravel/jquery Project

I tried to make infinite scrolling functionality with https://github.com/metafizzy/infinite-scroll plugin in my ( jquery-3.3.1 / Infinite Scroll PACKAGED v3.0.5 ) application I implemented infinite-scroll functionality looking at demo https://codepen.io/desandro/pen/WOjqNM I search if there is a way to implement infinite-scroll with data in bootstrap responsive table? That must be infinite scrolling data of rows in backend part of application. I tried to make like :

                <div class="table-responsive">
                    <table class="table table-bordered table-striped text-primary">
                        <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Location</th>
                            <th>Level count</th>
                            <th>Created At</th>
                            <th>Updated At</th>
                            <th></th>
                            <th></th>
                        </tr>
                        </thead>
                    </table>



                    <tbody id="infinite_scroll_container">
                    <tr class="warehouses-listing-append-block">
                        <td>Id</td>
                        <td>Name</td>
                        <td>Location</td>
                        <td>Level count</td>
                        <td>Created At</td>
                        <td>Updated At</td>
                        <td></td>
                        <td></td>
                    </tr>
                    </tbody>


                    <div class="warehouses-listing-load-status-block">
                        <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>

In js init function with code :

    var infScroll = new InfiniteScroll( '#infinite_scroll_container', {
        path: function() {
            return '/admin/get-warehouses-listing/' + ( ( this.loadCount + 1 ) * this_rows_per_scroll_step );
        },
        append: '.warehouses-listing-append-block',
        status: '.warehouses-listing-load-status-block',
    )

But I got JS error in console :

infinite-scroll.pkgd.min.js:12 Bad element for InfiniteScroll: #infinite_scroll_container
  1. If there is a way to use table here?
  2. Can similar functionality of table (horizontal scrolling with header row ) be implemented with other tag, not table ?

Thanks!

14 Jan
2 days ago

mstdmstd left a reply on AJAX Lazy Loading Listing For Laravel/jquery Project

Yes, how could it be implemented with laravel 5.7/jquery 3 / blade?

mstdmstd started a new conversation AJAX Lazy Loading Listing For Laravel/jquery Project

Hello! With new task description my client wrote

 AJAX lazy loading so we don’t have huge number of pagination based pages but we should show always show count of the number of results

I suppose that is like scrolling on youtube ? When there is no pagination bar and scrolling down more data rows are retrieved? It was supposed to be laravel 5.7/jquery 3 project with using of https://datatables.yajrabox.com/ for listings. But seems this lib has no such functionality. Are there some compatible libraries with such functionality ?

Thanks !

13 Jan
3 days ago

mstdmstd left a reply on How To Add Npm Into Docker Project Based On Apache?

Thank you for your feedback! I modified my web/Dockerfile.yml file as :

FROM php:7.2-apache

RUN apt-get update && \
    apt-get install -y \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    nano \
    git-core \
    curl \
    build-essential \
    openssl \
    libssl-dev \
    libgmp-dev \
    libldap2-dev \
    netcat \
    sqlite3 \
    libsqlite3-dev \
     && git clone https://github.com/nodejs/node.git \
     && cd node \
     && ./configure \
     && make \
     && sudo make install \
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/ && \
    docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite

COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf

and running

docker-compose up -d --build

command after long output I got error :

Processing triggers for libc-bin (2.24-11+deb9u3) ...
Cloning into 'node'...
Checking out files: 100% (31121/31121), done.
./configure: 4: exec: python: not found
ERROR: Service 'web' failed to build: The command '/bin/sh -c apt-get update &&     apt-get install -y     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     nano     git-core     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     sqlite3     libsqlite3-dev      && git clone https://github.com/nodejs/node.git      && cd node      && ./configure      && make      && sudo make install     docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/ &&     docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif && a2enmod rewrite' returned a non-zero code: 127

Have I to add some package with python ? Which ?

12 Jan
4 days ago

mstdmstd started a new conversation How To Add Npm Into Docker Project Based On Apache?

Hello,

How correctly add npm / nodejs to my php 7.2 / laravel 5 docker project based on php:7.2-apache ?

In my web/Dockerfile.yml I added line with " nodejs ":

FROM php:7.2-apache

RUN apt-get update && \
    apt-get install -y \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    nano \
    libgmp-dev \
    libldap2-dev \
    netcat \
    sqlite3 \
    nodejs \
    git \
    libsqlite3-dev && \
    docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/ && \
    docker-php-ext-install gd pdo pdo_mysql pdo_sqlite zip gmp bcmath pcntl ldap sysvmsg exif \
&& a2enmod rewrite

and running command :

docker-compose up -d --build

I did not get any errors during installation and I entered the bash, but failed testing

$ docker-compose exec web bash
[email protected]:/var/www/html# npm -v
bash: npm: command not found
[email protected]:/var/www/html# node -v
bash: node: command not found

I tried to add npm in the listing above, but got error that no candidate found...

Thanks !

09 Jan
1 week ago

mstdmstd started a new conversation How To Escase Astring In Laravel-datatables-oracle Table?

Hello,

In my laravel 5.7 app I use laravel-datatables-oracle": "^8.7" and defining js function on confirmation of deletion I call ja function like

            ->editColumn('action_delete',
                '<a href="#" onclick="javascript:backendPageContent.deletePageContent({{$id}},\'{{$title}}\')"><i class="fa fa-remove a_link"></i></a>')
            ->rawColumns(['action', 'action_delete'])

It works ok, until in $title happen “'” char and it raise error.

Usually in my laravel/jquery apps I use method json_encode in such cases, but here i tried like

            ->editColumn('action_delete',
//                '<a href="#" onclick="javascript:backendPageContent.deletePageContent({{$id}},json_encode(\'{{$title}}\'))"><i class="fa fa-remove a_link"></i></a>')
                '<a href="#" onclick="javascript:backendPageContent.deletePageContent({{$id}},\'{{  json_encode($title)  }}\'))"><i class="fa fa-remove a_link"></i></a>')
            ->rawColumns(['action', 'action_delete'])

But in both cases I failed. Which is right way ?

Thanks!

06 Jan
1 week ago

mstdmstd left a reply on Syntax Error Addin DejaVu Sans Font Fromt Using Html2pdf

I try to add some additive fonts In the link abobe there is method mentioned

$fontname = $pdf->addTTFfont(‘/path-to-font/DejaVuSans.ttf’, ‘TrueTypeUnicode’, “, 32);

but it is not accessible for Spipu\Html2Pdf class Searching in the app I found file vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php with class TCPDF_FONTS defintion with method

    /**
     * Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).
     * @param $fontfile (string) Font file (full path).
     * @param $fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional.
     * @param $enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats.
     * @param $flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font.
     * @param $outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder.
     * @param $platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1).
     * @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4.
     * @param $addcbbox (boolean) If true includes the character bounding box information on the php font file.
     * @param $link (boolean) If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts.
     * @return (string) TCPDF font name or boolean false in case of error.
     * @author Nicola Asuni
     * @since 5.9.123 (2010-09-30)
     * @public static
     */
    public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1, $addcbbox=false, $link=false) {
    ...

Can it be helpfull, but how to call it from Spipu\Html2Pdf class?

I can use fonts like Courier, Helvetica, Times after installiong them in my kubuntu OS, but I wpould like to extend these fonts with native linux fonts, like “themify”, “DejaVu Sans”, which are installed in my system and in my app. But I have strange errors as mentioned above and trying to use

        $html2pdf->addFont( 'themify', '', public_path('/fonts/themify/themify.ttf')  );

I have strange error

syntax error, unexpected '@'

?

04 Jan
1 week ago

mstdmstd started a new conversation Syntax Error Addin DejaVu Sans Font Fromt Using Html2pdf

Hello, Installing laravel 5.7 I convirt html code into pdf using "spipu/html2pdf": "^5.2" and got error :

syntax error, unexpected '>=' (T_IS_GREATER_OR_EQUAL), expecting end of file

when I try to attach DejaVu Sans font to my app. I use this font in html in source code, like

style="font-family: 'DejaVu Sans')

My control :

        $pdf_content= !empty($requestData['pdf_content']) ? $requestData['pdf_content'] : '';
        $pdf_filename= !empty($requestData['pdf_filename']) ? $requestData['pdf_filename'] : '';
        $page_orientation = 'P';/* P or Portrait (default) L or Landscape */
        $page_format = 'A4'; // A4  A6

        $page_lang = 'en';
        $page_unicode = true;
        $page_encoding = 'UTF-8';
        $page_margins = array(5, 5, 5, 8);
        $page_pdfa = false;

        $html2pdf = new Html2Pdf(  $page_orientation, $page_format, $page_lang, $page_unicode, $page_encoding, $page_margins, $page_pdfa  );


        $html2pdf->addFont(  'DejaVu Sans', '', public_path('/fonts/DejaVuSans/DejaVuSans-Bold.ttf')  );


        $html2pdf->addFont(  'courier'  );
        $html2pdf->addFont(  'helvetica'  );
        $html2pdf->addFont(  'symbol'  );
        $html2pdf->addFont(  'times'  );
        $html2pdf->writeHTML( $pdf_content );

        $html2pdf->output($pdf_filename, 'D');

But that is not syntax error of my application anyway, if to comment line
        $html2pdf->addFont(  'DejaVu Sans', '', public_path('/fonts/DejaVuSans/DejaVuSans-Bold.ttf')  );

there is no error and pdf file is generated, but area with DejaVu Sans font is black, I suppose that is because the DejaVu Sans font is not found in the app. That how error looks on my side : https://imgur.com/a/vuGWUPp

Why error and how to fix it ?

Thanks!

03 Jan
1 week ago

mstdmstd left a reply on How To Set Url Of Laravel App Under Docker Without “public”?

I have found valid decision for me at https://github.com/petecoop/docker-laravel I looked that at end of web/Dockerfile.yml there was a line :

COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf

and in this 000-default.conf “/public” path and other parameters were written.

02 Jan
2 weeks ago

mstdmstd left a reply on Is Bootstrap-multiselect Plugin Is Compatible With Bootstrap 4.1 ?

Looks like bootstrap 4 support was added to this plugin https://imgur.com/a/YDQVq76 But which is correct way to install this plugin with bootstrap 4 support to my app? I know how git/branch works, but that is samewhat complicated.

I suppose that I can run in console

composer require davidstutz/bootstrap-multiselect

and after that manually to apply changes in file on printscreen above. Is it valid way ?

mstdmstd started a new conversation How To Set Url Of Laravel App Under Docker Without “public”?

Hello, Installing laravel 5.7 app under docker(based on php:7.2-apache ) I need to use "/public" in my url to run my app, so root url of my app is

http://127.0.0.1:8081/public

I modified .env of my laravel app as

APP_URL=http://127.0.0.1:8081/public/

But it did not help, as I browser I got image url :

http://127.0.0.1:8081/storage/mysites/-mysite-16/Babe_ver1.jpg?dt=1546059015

which way is invalid, as valid way must be :

http://127.0.0.1:8081/public/storage/mysites/-mysite-16/Babe_ver1.jpg?dt=1546059015

The similar way with ajax requests, as I got invalid ways :

http://127.0.0.1:8081/admin/get_activity_log_rows/1

But valid must be

http://127.0.0.1:8081/public/admin/get_activity_log_rows/1

In my docker-compose.yml :

version: '3.1'

services:

    web:

        build:
            context: ./web
            dockerfile: Dockerfile.yml

        environment:
            - APACHE_RUN_USER=www-data
        volumes:
            - ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
        ports:
            - 8081:80
        working_dir: ${APP_PTH_CONTAINER}


    composer:
        image: composer:1.8
        volumes:
            - ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
        working_dir: ${APP_PTH_CONTAINER}
        command: composer install

and in .env of docker project :

# PATHS
DB_PATH_HOST=./databases
APP_PATH_HOST=./Mysites
APP_PTH_CONTAINER=/var/www/html/


How to set root url  of my site with “/public” ?


Thanks!
30 Dec
2 weeks ago

mstdmstd started a new conversation Does Laravel-websockets Need Pusher Parameters ?

Hello,

I try to install in my larabel 5 app https://docs.beyondco.de/laravel-websockets/

and I stuck on a question if using this plugin I need to fill in my .env PUSHER_APP_ID, PUSHER_APP_KEY, PUSHER_APP_SECRET parameters?

Reading here https://docs.beyondco.de/laravel-websockets/1.0/basic-usage/pusher.html I found that it is replacement of pusher?

If there is a way to use this plugin without pusher parameters please give a link how to make it ?

Thanks!

28 Dec
2 weeks ago

mstdmstd left a reply on Under Docker Error Call To Undefined Function Intervention\Image\Gd\imagecreatefromjpeg

@OHFFS - Thanks! But next I got error :

Unsupported image type. GD/PHP installation does not support WebP format.

But I do not use any WebP files in my app. Which extentions these files mut be? Or how to fix this error?

mstdmstd left a reply on Under Docker Error Call To Undefined Function Intervention\Image\Gd\imagecreatefromjpeg

Thank you for your feedback! I tried to remade web/Dockerfile.yml according to your links and I got file :

FROM php:7.2-apache

RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        nano \
        libjpeg62-turbo-dev \
        libpng-dev \
        libmcrypt-dev \
        libicu-dev \
        libxml2-dev \
    && docker-php-ext-install -j$(nproc) iconv \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

RUN docker-php-ext-install \
    pdo_mysql \
    && a2enmod \
    rewrite
RUN docker-php-ext-install gd

and running command :

docker-compose up -d --build

I got warning(I suppose it is not critical)

warning: gd (gd.so) is already loaded!

I checked logs and found no errors :

docker logs --tail=20  votes_docker_web_1
docker logs --tail=20  votes_docker_db_1
docker logs --tail=20  votes_docker_phpmyadmin_1
docker logs --tail=20  votes_docker_composer_1   

I check modules installed in the box and see gd installed:

# php -m
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
SimpleXML
sodium
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

But anyway opening the project in browser I got error:

Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg()

Did I miss something in commands of web/Dockerfile.yml ?

mstdmstd started a new conversation Under Docker Error Call To Undefined Function Intervention\Image\Gd\imagecreatefromjpeg

Hello, I try to install my laravel 5.7.19 application under docker and running some pages I got error:

Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg()

I include jpeg files in web/Dockerfile.yml:

FROM php:7.2-apache

RUN apt-get update -y && apt-get install -y libpng-dev libjpeg-dev libxpm-dev libfreetype6-dev  nano  \
    && docker-php-ext-configure gd \
    --with-freetype-dir=/usr/include/ \
    --with-jpeg-dir=/usr/include/ \
    --with-xpm-dir=/usr/include/ \
    --with-vpx-dir=/usr/include/

RUN docker-php-ext-install \
    pdo_mysql \
    && a2enmod \
    rewrite


RUN docker-php-ext-install gd

But I have the same error anyway. Is path “/usr/include/” valid and how to check it ?

My working OS is Kubuntu 18...

Thanks!

25 Dec
3 weeks ago

mstdmstd started a new conversation How To Check Correctly If Websocket Is Running

Hello,

In my laravel 5.7 app I use

     "beyondcode/laravel-websockets": "^1.0",

and in resources/js/app.js file I define :

import Echo from 'laravel-echo'  // If to comment // require('./bootstrap'); line above then we need to install echo here
window.Pusher = require('pusher-js');
console.log("check -0 Echo::")
console.log( Echo )

window.Echo = new Echo({
    broadcaster: 'pusher',
    encrypted : false,  // TO FIX
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    wsHost : window.location.hostname,
    wsPort : 6001,
    disableStats : true
});

and in when I open page, which uses socket I attach file public/js/cardsBS41Frontend/user_chat.js with code like:

    Echo.join('make_votes_chat')
        .here((activeUsers) => {
            console.log("here  activeUsers::")
            console.log( activeUsers )
            this_activeUsers= activeUsers
            $("#span_show_chat_members_count").html(activeUsers.length)
        })
        .joining((user) => {
            console.log("joining  user::")
            console.log(user.id + ' = ' + user.username);
            popupAlert( user.username + " joined this chat !", 'info')
        })
        ...

My question is how to check correctly if websocket is running now and if it is not running to run it ?

I suppose that I can to check if Echo var if not undefined ant to run command using ajax request and

Artisan::call("php artisan websockets:serve");

command, but if that is good way/tools/plugins for this purpose?

Thanks!

mstdmstd left a reply on Setting Https Secure Certificates On Laravel 5

Thank you for feedbacks! I suppose to make cron task to refresh letsencypt certificates is not complicated. Are there any other ssl certificates accessible, maybe with more more 89 days ?

 Did you open port 443 on your server?

I missed what is the issue with 443 port ?

23 Dec
3 weeks ago

mstdmstd left a reply on How To Imoplement Laravel-widgets With Additive Ajax Requests

Searching In net I found this https://github.com/nWidart/laravel-modules plugin, which seems good for me, when I need to use the same block of code in different apps. Did anybody use it?

mstdmstd left a reply on Setting Https Secure Certificates On Laravel 5

Thank you, I installed certificates and got message:

Your cert will expire on 2019-03-20. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"

The period of certificates seems not too long. What expects my cite at 2019-03-20 and after? Which steps have I to take not to have problems with certificates period expired ?

21 Dec
3 weeks ago

mstdmstd started a new conversation Setting Https Secure Certificates On Laravel 5

Hello, I set https secure certificates on my laravel 5.7 app as it was written in https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04 article The only thing that I had to modify was in .env to modify

APP_URL=https://mysite

and callback urls for socialite plugin. I do not have any more url pointing to my site...

If there is something more I have to pay attention moving to https?

Thanks!

17 Dec
4 weeks ago

mstdmstd started a new conversation How To Imoplement Laravel-widgets With Additive Ajax Requests

Hello, I use https://github.com/arrilot/laravel-widgets in my Laravel 5.7 app it is ok for my blocks of code, but now I need to implement some additive ajax requests related with logged user and I wonder how better to make control actions? In the doc there is next:

class RecentNews extends AbstractWidget
{
    /**
     * The configuration array.
     *
     * @var array
     */
    protected $config = [];

    /**
     * Treat this method as a controller action.
     * Return view() or other content to display.
     */
    public function run()
    {
        //

But no additive control action described... I suppose to make 1 more class file with methods implemented and trigger its methods in profile control, but is there is a better way?

Thanks!

13 Dec
1 month ago

mstdmstd started a new conversation How To Auth To The System Without New Row In Users

hello, I have a system "tymon/jwt-auth" is used with OTP and twillio.

But we also need to create new person (shop) who has to create itself and login to the system. But we create 1 row in shop only, not users. If there is a way to auth to the system without annd new row in users, if yes how? composer.json:

 {
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "tymon/jwt-auth": "^1.0.0"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.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"
        ]
    }
}

Thanks!

11 Dec
1 month ago

mstdmstd left a reply on Please, Look At Design Of My Site

Searching in net I found this template https://blackrockdigital.github.io/startbootstrap-sb-admin/ It is based on Bootstrap v4.1.3 How do you think is it good template to start with ?

mstdmstd started a new conversation Is It Possible To Change Value In _variables.scss File Depending On Request Parameters?

Hello! If there is a way in laravel 5.7 app /blade/scssproject to change value in resources/sass/_variables.scss file depending on request parameters?

That could be usefull for debugging. Something like that:

$debug_mode: <?php echo (  !empty( $_REQUEST['is_debug'] ? 1: ''  ); ?>;

But that raise compliation errors.

That syntax

$debug_mode: "<?php echo (  !empty( $_REQUEST['is_debug'] ? 1: ''  ); ?>";

does not raise compliation errors

But it does not work as I expected in other scss file, like:

.block_container {
  min-width: 300px !important;
  padding-right: 5px;
  padding-left: 5px;
  @if ($debug_mode  == 1) {
    background-color: yellow;
    border: 2px dotted blue;
  }
}

Can it be done in some other way ?

Thanks!

10 Dec
1 month ago

mstdmstd started a new conversation Has Laravel-jsvalidation Client Events ?

Hello, I use https://github.com/proengsoft/laravel-jsvalidation plugin in my laravel 5.7 app. Has this plugin success/failure validation events on client side? I want to use it in big form to show popup dialog when user clicks on submit button and depending on validation results popup message must be different ...

Thanks!

06 Dec
1 month ago

mstdmstd left a reply on Please, Look At Design Of My Site

Thank you for your feedback!

  1. As I see https://blackrockdigital.github.io/startbootstrap-sb-admin-2/pages/index.html is based on Bootstrap v3.3.7, that seems not good for new projects. I have expierence in remaking from Bootstrap v3.3.7 to Bootstrap v4.1. That was some issue for me. Can you advice similar backend template but based on Bootstrap v4.1?
05 Dec
1 month ago

mstdmstd started a new conversation Please, Look At Design Of My Site

Hello!

Could you, please, to look at design of my site backend (it has credetials filled): http://votes.nilov-sergey-demo-apps.tk/login and frontend : http://votes.nilov-sergey-demo-apps.tk/home and say if it has some design problems/bugs(and if possible shortly say way to fix it). On different devices.

That is my prior app remade with new version of laravel 5.7/Bootstrap 4.1 . I am more php developer, less html/bootsrap. I want more practice in html/bootsrap...

Thanks!

03 Dec
1 month ago

mstdmstd left a reply on Error Creating Elasticsearch Mapping With Elasticquent Lib

This file rather big, backend and frontend part. But I did not added any specific routes to my routes/web.php. Looks like I missed something setting mappings. Could you please to point at what I missed?

mstdmstd left a reply on Error Creating Elasticsearch Mapping With Elasticquent Lib

Sorry that is not clear. Please, more detailed.

02 Dec
1 month ago

mstdmstd started a new conversation Error Creating Elasticsearch Mapping With Elasticquent Lib

Hello! In my Laravel 5.7 app I try to work with elasticsearch with composer.json :

{
    "require": {
        ...
        "elasticquent/elasticquent": "dev-master",
        ...
    },

reading article https://appdividend.com/2018/06/30/laravel-elasticsearch-tutorial-example/ I want to start with creting mapping and bulking data. For this in my model app/Vote.php:

<?php

namespace App;

use DB;
...
use Elasticquent\ElasticquentTrait;
...
class Vote extends MyAppModel
{
    use ElasticquentTrait;
...


    protected $table = 'votes';
    protected $primaryKey = 'id';
    public $timestamps = false;

    protected $fillable = ['name', 'slug', 'description', 'creator_id', 'vote_category_id', 'is_quiz', 'status', 'image'];
    protected $mappingProperties = array(

        'id'               => [
            'type' => 'integer',
            "analyzer" => "standard",
            'include_in_all' => FALSE
        ],
//            'user'    => array(  // THERE would be nested data later
//                'type' => 'object',
//                'properties' => array(
//                    'name'      => array('type' => 'string', 'include_in_all' => TRUE),
//                    'fullName'  => array('type' => 'string', 'include_in_all' => TRUE, 'boost' => 2)
//                ),
//            ),
        'name'             => [
            'type' => 'string',
            "analyzer" => "standard",
            'include_in_all' => TRUE
        ],
        'slug'             => [
            'type' => 'string',
            "analyzer" => "standard",
            'include_in_all' => TRUE
        ],
        'description'      => [
            'type' => 'string',
            "analyzer" => "standard",
            'include_in_all' => FALSE
        ],
        'created_at'       => [
            'type' => 'date',
            "analyzer" => "standard",
            'include_in_all' => FALSE
        ],


    public function getTableName(): string
    {
        return $this->table;
    }

    public function getPrimaryKey(): string
    {
        return $this->primaryKey;
    }



    public static function setVotesElasticMapping()
    {

//        Vote::deleteMapping();

        Vote::createIndex(/*$shards = null, $replicas = null*/);

        Vote::putMapping(/*$ignoreConflicts = true*/);

        Vote::addAllToIndex ();
    }


}

But calling method setVotesElasticMapping I got error:

{"error":{"root_cause":[{"type":"resource_already_exists_exception","reason":"index [select_vote/IxHrJ300SIWSZ_s12-jAJw] already exists","index_uuid":"IxHrJ300SIWSZ_s12-jAJw","index":"select_vote"}],"type":"resource_already_exists_exception","reason":"index [select_vote/IxHrJ300SIWSZ_s12-jAJw] already exists","index_uuid":"IxHrJ300SIWSZ_s12-jAJw","index":"select_vote"},
"status":400}1

That is clear, as I have created the index before and "select_vote" is "default_index" in config/elasticquent.php file. But uncommenting line

        Vote::deleteMapping();

I got error :

Elasticsearch \ Common \ Exceptions \ BadRequest400Exception (405)
{"error":"Incorrect HTTP method for uri [/select_vote/votes/_mapping] and method [DELETE], allowed: [PUT, GET, POST]","status":405}

Can you say why error and how to fix it? I think anyway I need this method calling, say if I remade structure of mapping...

Thanks!

01 Dec
1 month ago

mstdmstd left a reply on Outofmemory Error Trying Debug MessageComponentInterface Method Vars

I still search for decision and I found this https://laravel.io/forum/01-16-2015-loading-laravels-session-using-ratchet article, byt when I tried to run it with method :

  public function onMessage(ConnectionInterface $from, $msg) {
       $from->session->start();
       $idUser = $from->session->get(Auth::getName());

I got error :

Undefined property: Ratchet\Server\IoConnection::$session

In the mentioned article there was a comment :

(you must decrypt cookie to get the session id in Laravel 5) :

I searche for this I found this

In web request context cookies are usually automatically encrypted and decrypted by the EncryptCookies middleware. 
So easiest option would be just to enable this middleware (and it's enabled by default in Laravel).

and in my app/Http/Kernel.php there is line with EncryptCookies

    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,

but that is web application, but I run console app. Can the reason of the error that I have to add EncryptCookies to some other group in app/Http/Kernel.php ?

Or why error ?

30 Nov
1 month ago

mstdmstd started a new conversation How To Fix Call To Undefined Method Illuminate\Session\Store::set Error?

Hello! In my Laravel 5.7 I try to implement youtube video using this https://www.sitepoint.com/displaying-youtube-videos-php/ article. I added my client id/secret in my .env and made using of them in config/google.php. After in app/Http/Kernel.php file I added GoogleLogin Middleware so running my app I got error :

Call to undefined method Illuminate\Session\Store::set()

That is printscreen : https://imgur.com/a/4BhFL4t

That is full error description :

[2018-11-29 05:58:04] local.ERROR: Call to undefined method Illuminate\Session\Store::set() {"userId":50,"email":"[email protected]","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to undefined method Illuminate\Session\Store::set() at /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Support/Manager.php:146)
[stacktrace]
#0 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(223): Illuminate\Support\Manager->__call('set', Array)
#1 /mnt/_work_sdb8/wwwroot/lar/Votes/app/Services/GoogleLogin.php(36): Illuminate\Support\Facades\Facade::__callStatic('set', Array)
#2 /mnt/_work_sdb8/wwwroot/lar/Votes/app/Http/Middleware/GoogleLogin.php(18): App\Services\GoogleLogin->isLoggedIn()
#3 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): App\Http\Middleware\GoogleLogin->handle(Object(Illuminate\Http\Request), Object(Closure))
#4 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#5 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#6 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#7 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#8 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(75): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#9 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#10 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#11 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#12 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#14 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#18 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#22 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#23 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(684): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#25 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#26 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#27 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(614): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#28 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#29 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#30 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/themsaid/laravel-mail-preview/src/MailPreviewMiddleware.php(19): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Themsaid\MailPreview\MailPreviewMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/proengsoft/laravel-jsvalidation/src/RemoteValidationMiddleware.php(53): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#34 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Proengsoft\JsValidation\RemoteValidationMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#45 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#46 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#49 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#50 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#51 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#52 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#54 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/itsgoingd/clockwork/Clockwork/Support/Laravel/ClockworkMiddleware.php(29): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#55 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Clockwork\Support\Laravel\ClockworkMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#57 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#58 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#59 /mnt/_work_sdb8/wwwroot/lar/Votes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#60 /mnt/_work_sdb8/wwwroot/lar/Votes/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#61 {main}
"} 

Googling I found that it is issue of early 5 laravel versions and advices like:

Replacing

 \Session::set('u2f.registerData', $req);

WIth

session(['u2f.registerData' => $req]);

Works

OR

set -> put

But as file with error is inside of /vendor/laravel/framework/src/Illuminate I do not know what have I to edit and how to fix this error ?

Thanks!

29 Nov
1 month ago

mstdmstd started a new conversation How To Check Backend Pages Under Validator.w3.org

Hello! With my Laravel 5.7 I want to check html pages of my site, icluding backend with url like https://validator.w3.org/nu/?doc=http://mysite/admin/dashboard. I use auth, jrean/laravel-user-verification and my own middleware CheckUserStatus to check that user->status='Y' In routes/web.php I haqve admin group

Route::group(['middleware' => ['auth', 'isVerified', 'CheckUserStatus'], 'prefix' => 'admin', 'as' => 'admin.'], function () {

I suppose that when in https://validator.w3.org I set one of my admin page it is redirected to /login page and I results on this page only.

If there is way to check my backend page unbder https://validator.w3.org without break authority protection of my site?

Or what I have to do to minimize my changes for checking under https://validator.w3.org and revert back? To comment 3 middleware in group above?

Any other decisions are possible here?

Thanks!

28 Nov
1 month ago

mstdmstd left a reply on Outofmemory Error Trying Debug MessageComponentInterface Method Vars

In file:///etc/php/7.2/cli/php.ini I modified

memory_limit = 8048M

and restarted apache

also I tried to check how many of memory in my script :

         echo '<pre>onMessage getNiceFileSize(memory_get_usage()) ::' . print_r( $this->getNiceFileSize(memory_get_usage()) , true ) ;
it shows :19241736 ~18 MiB 

error message :

 Out of memory (allocated 1623195648) (tried to allocate 1600131072 bytes)

I tried to calculated and got values 1.51 GiB and 1.49 GiB...

  1. why memory_get_usage returns such small value
  2. Why dumping gets 1.5 GiB? That is a big value
  3. Any ideas how to deal it?
  4. Auth::id() returns nothing and as far I understand it would not help, as message can be sent by some other logged user, but not currently logged...
27 Nov
1 month ago

mstdmstd started a new conversation Outofmemory Error Trying Debug MessageComponentInterface Method Vars

In my laravel 5.7 app I use MessageComponentInterface for chat app with a class like

<?php

namespace App\Classes\Socket;

use App\Classes\Socket\Base\BaseSocket;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class ChatSocket extends BaseSocket
{
    protected $clients;

    public function __construct()
    {
        $this->clients = new \SplObjectStorage;
    }

    public function onOpen(ConnectionInterface $conn) {
        $this->clients->attach($conn);
        echo '<pre>New Connection ::'.print_r($conn->resourceId,true).'</pre>';
    }

    public function onMessage(ConnectionInterface $from, $msg) {
        $numRecv= count($this->clients)-1;
         echo '<pre>onMessage $msg::' . print_r( $msg, true ) ;
//        var_dump($from);
        dump($from);
        die("-1 XXZ000");
        echo '<pre>onMessage $from::' . print_r( $from, true ) ;
        ...

The problem is that in onMessage event I want to this message write to db table, but I can not find where to get user_id of user who sent this message? I tried to debug outputing values to screen with

echo '<pre>onMessage $from::' . print_r( $from, true ) ;

But I got out of memory error, but in /etc/php/7.2/cli/php.ini I modified options:

max_execution_time = 3330
max_input_time = 240
memory_limit = 4048M
and restarted my server, but anyway I got outof memory error

using these methods:

//        var_dump($from);
        dump($from);
I got endless output in console and I could not catch anything...

How to debug these values ?

Thanks!

22 Nov
1 month ago

mstdmstd left a reply on Using Cboden/ratchet I Got Interface 'Rachet\MessageComponentInterface' Not Found Error

Thank you for feedback !

1)Reading the askedio/laravel-ratchet dosc I found mentioned:

This will run a simple example server based on src/Examples/Pusher.php.

Does it user Pusher(and PUSHER_APP_ID, PUSHER_APP_KEY, PUSHER_APP_SECRET) provided?

  1. Which steps have I to do to create my own service provider for "cboden/ratchet" ? This decision seems preferable...
21 Nov
1 month ago

mstdmstd left a reply on Generating Of Banners Dynamically

I mean something like that https://imgur.com/a/9P47A9z As any separate button or full listing(in this case possibility to select hor/ver layout). It would be nice to set some options like text, url, font, color, size, icon at left or right, paddings, margins...

mstdmstd started a new conversation Using Cboden/ratchet I Got Interface 'Rachet\MessageComponentInterface' Not Found Error

Hello!

In my laravel 5.7 app I installed cboden/ratchet composer.json :

    "type": "project",
    "require": {
        ...
        "cboden/ratchet": "^0.4.1",

With app/Classes/Socket/Base/BaseSocket.php :

<?php
namespace App\Classes\Socket\Base;

use Rachet\MessageComponentInterface;
use Rachet\ConnectionInterface;

class BaseSocket implements MessageComponentInterface {

    public function onOpen(ConnectionInterface $conn) {

    }

    public function onMessage(ConnectionInterface $conn, $mgs) {

    }

    public function onClose(ConnectionInterface $conn) {

    }

    public function onError(ConnectionInterface $conn, \Exception $e) {

    }

}

and console command app/Console/Commands/ChatServer.php :

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

use Ratchet\Http\HttpServer;
use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use App\Classes\Socket\ChatSocket;

class ChatServer extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'chat_server:serve';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'chat_server description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info("Start server!");
        $server= IoServer::factory(
            new HttpServer(
                new WsServer(
                    new ChatSocket()
                )
            ),
            8080
        );

        $server->run();
    }
}

But running command in console I got error:

$ php artisan chat_server:serve
Start server!
PHP Fatal error:  Interface 'Rachet\MessageComponentInterface' not found in /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php on line 7

   Symfony\Component\Debug\Exception\FatalErrorException  : Interface 'Rachet\MessageComponentInterface' not found

  at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
     3| 
     4| use Rachet\MessageComponentInterface;
     5| use Rachet\ConnectionInterface;
     6| 
  >  7| class BaseSocket implements MessageComponentInterface {
     8| 
     9|     public function onOpen(ConnectionInterface $conn) {
    10| 
    11|     }


   Whoops\Exception\ErrorException  : Interface 'Rachet\MessageComponentInterface' not found

  at /mnt/_work_sdb8/wwwroot/lar/Votes/app/Classes/Socket/Base/BaseSocket.php:7
     3| 
     4| use Rachet\MessageComponentInterface;
     5| use Rachet\ConnectionInterface;
     6| 
  >  7| class BaseSocket implements MessageComponentInterface {
     8| 
     9|     public function onOpen(ConnectionInterface $conn) {
    10| 
    11|     }

Did I miss some declarations or have I to add declarations to app.php what I usually do with new plugins?

Thanks!

mstdmstd left a reply on Elasticsearch Syntax Error With Multi Fields Search

Making some search I found working next syntax :

        $elasticQuery = [
            "bool" => [
                'should' => [


                        [
                                "multi_match" => [
                                    "query"  => $text,
                                    "type"   => "cross_fields",
                                    "fields" => [
                                        "name^4",
                                        "description"
                                    ]
                                ]
                        ],

                        [
                            'match' => [
                                'category_id' => [
                                    'query' => 1,
                                ]
                            ]
                        ],

                        [
                            'match' => [
                                'category_id' => [
                                    'query' => 3,
                                ]
                            ]
                        ],
                    
                ]
            ]
        ];

when I need to make search by text fields and array of category (1 and 3) in example above.

It works, but looks like it works like "OR" condition, but I need to make restriction as "AND" if to use sql terminology...

Which way is correct to make restriction as "AND" ?

20 Nov
1 month ago

mstdmstd left a reply on Generating Of Banners Dynamically

Something like listing of buttons with title and link to other url. But generated dynamically from listing of banners.

mstdmstd started a new conversation Generating Of Banners Dynamically

Hello!

Are there some libs for generating of banners dynamically for laravel 5.7/Bootstrap 4.1 ?

Thanks!

19 Nov
1 month ago

mstdmstd left a reply on Elasticsearch Syntax Error With Multi Fields Search

I tried to set array:

            "bool" => [
                "must" => [
                    "multi_match" => [
                        "query"  => $text,
                        "type"   => "cross_fields",
                        "fields" => [
                            "name^4",
                            "description"
                        ]
                    ]
                ]
            ]
        ];

But I got error :

Also I see that in example above only fields defined as "[]" :

but the rest of conditions as "{}". How have I to set elasticQuery var ?

18 Nov
1 month ago

mstdmstd started a new conversation Elasticsearch Syntax Error With Multi Fields Search

Hello! I look at "Elasticsearch Do's, Don'ts and Pro-Tips - Itamar Syn Hershko" video tutorial at https://www.youtube.com/watch?v=c9O5_a50aOQ I see condition on several fiedls https://imgur.com/a/17zAZ4w and try to make it in my Laravel 5.7 app(with elasticsearch/elasticsearch plugin) as :

        $elasticQuery = [
            "bool" => [
                'must'   => [
                    'multi_match' => [
                        'query'  => $text,
                        'fields' => ['name^4', 'description']
                    ],
                ],
                "should" => [
                    'term' => [
                        "category_id" => 1,
                    ]
                ]
            ]
        ];

but I got error :

{"error":{"root_cause":[{"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":130}],"type":"parsing_exception","reason":"[bool] malformed query, expected [END_OBJECT] but found [FIELD_NAME]","line":1,"col":130},"status":400}

When I use simple condition:

                $elasticQuery = [
                    'multi_match' => [
                        'query' => $text,
                        'fields' => ['name^4', 'description'],
                    ],
                ];

I got valid results as :

[hits] => Array
     (
         [total] => 1
         [max_score] => 7.4126062
         [hits] => Array
             (
                 [0] => Array
                     (
                         [_index] => select_vote
                         [_type] => vote
                         [_id] => 16
                         [_score] => 7.4126062
                         [_source] => Array
                             (
                                 [id] => 16
                                 [slug] => in-the-film-babe-what-type-of-animal-was-babe
                                 [name] => In the film Babe, what type of animal was Babe?
                                 [description] => Babe is a 1995 A...
                                 [created_at] => 2018-11-10 09:14:15
                                 [category_id] => 2
                                 [category] => Array
                                     (
                                         [name] => Movie&Cartoons
                                         [slug] => movie-cartoons
                                         [created_at] => 2018-11-10 09:14:12
                                     )

                             )

                     )

             )

     )

Which is valid format for multi request ?

Thanks!

17 Nov
1 month ago

mstdmstd left a reply on Here Is A Tutorial On How To Use Laravel With Elasticsearch

Hello! I found this share, but looking at the references package I see that https://github.com/adamfairholm/Elasticquent referenced. But in this package description I found

This version of Elasticquent is no longer maintained

with link to https://github.com/elasticquent/Elasticquent

Can I to use elasticquent/Elasticquent with examples of this article?

Also in my current laravel 5.7 app I have

        "cviebrock/laravel-elasticsearch": "^3.2",

installed. Have I to remove it to work with elasticquent/Elasticquent ?

Isn't this article absolute ?

Thanks!

15 Nov
2 months ago

mstdmstd started a new conversation How To Make Search Laravel / Elasticsearch With Joined Tables?

Hello!

In my laravel 5.7/mysql app I use elasticsearch based on https://michaelstivala.com/learning-elasticsearch-with-laravel/ article. That is clear for me how to save/delete/search data which are besd one one table. But I have tables :

CREATE TABLE `votes` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_ci',
    `description` MEDIUMTEXT NOT NULL COLLATE 'utf8mb4_unicode_ci',

with searching on name and description fields

but I also have a table

CREATE TABLE `vote_items` (
    `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `vote_id` INT(10) UNSIGNED NULL DEFAULT NULL,
    `name` VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_ci',

and I want to make search also on name field.

That seems somewhat tricky. In my vote model I defined methods to sync data with elasticsearch:

<?php

namespace App;

use DB;

class Vote extends Model
{
    protected $table = 'votes';
    protected $elasticsearch_type  = 'vote';
    protected $primaryKey = 'id';
    ...
    public function getElasticsearchType(): string
    {
        return $this->elasticsearch_type;
    }

    protected static function boot() {
        parent::boot();

        static::saved(function ($vote) {
            $elastic = app(\App\Elastic\Elastic::class);
            $elasticsearch_root_index  = config('app.elasticsearch_root_index');
            $elasticsearch_type        = with(new Vote)->getElasticsearchType();

            $elastic->delete([
                'index' => $elasticsearch_root_index,
                'type'  => $elasticsearch_type,
                'id'    => $vote->id,
            ]);

            if ($vote->status == 'A') { // only active votes must be saved in elasticsearch
                $elastic->index([
                    'index' => $elasticsearch_root_index,
                    'type'  => $elasticsearch_type,
                    'id'    => $vote->id,
                    'body'  => [
                        'id'          => $vote->id,
                        'slug'        => $vote->slug,
                        'name'        => $vote->name,
                        'description' => $vote->description,
                    ]
                ]);
            } // if ($vote->status == 'A') { // only active votes must be saved in elasticsearch

        });
        static::deleted(function ($vote ) {
            $elastic = app(\App\Elastic\Elastic::class);
            $elasticsearch_root_index  = config('app.elasticsearch_root_index');
            $elasticsearch_type        = with(new Vote)->getElasticsearchType();
            $elastic->delete([
                'index' => $elasticsearch_root_index,
                'type' => $elasticsearch_type,
                'id' => $vote->id,
            ]);
        });
    }


    public static function bulkVotesToElastic()
    {
        $elastic = app(\App\Elastic\Elastic::class);

        $elasticsearch_root_index  = config('app.elasticsearch_root_index');
        $elasticsearch_type        = with(new Vote)->getElasticsearchType();

        Vote::chunk(100, function ($Votes) use ($elastic, $elasticsearch_root_index, $elasticsearch_type) {
            foreach ($Votes as $nextVote) {
                if ($nextVote->status!= 'A') continue; // only active votes must be saved in elasticsearch
                $elastic->index([
                    'index' => $elasticsearch_root_index,
                    'type'  => $elasticsearch_type,
                    'id'    => $nextVote->id,
                    'body'  => [
                        'id'          => $nextVote->id,
                        'slug'        => $nextVote->slug,
                        'name'        => $nextVote->name,
                        'description' => $nextVote->description,
                    ]
                ]);
            }
        });
    }


}

I suppose that I could make similar methods for vote_items model and saved all data with different type, but I think that is not valid way... Have I to make vote_item element as child node of vote with elasticsearch syntax? Which way is valid? Are there some examples how this could be implemented ?

Thanks!

14 Nov
2 months ago

mstdmstd started a new conversation How To Make Redirection To Some Vue Form From Laravel's Control?

Hello! In my Laravel 5.6 application with vue.js 2.5.7 I and vue-router 3 I use Socialite for login into the system and in case of success I need to make redirection to some vue form with success message and next options available.

For this I make redirection like:

            $url= $site_hosting . "/home";
            return redirect()->route($url, [])->with([
                'text'   => 'google_new_user',
                'type'   => 'success',
                'action' => 'successful_login'
            ]);

where url has value like

http://mysite.com/home

the question is that I do not know how redirecting from Laravel control to point to Vue component, defined in resources/assets/js/app.js file as

const routes = [
    {
        components: {
            notFound: NotFound,
        ...

How can it be done ?

Thanks!

05 Nov
2 months ago

mstdmstd left a reply on Error Wrapping Elasticsearch Class

Sorry, I still search for decision... If somebody use this script?

mstdmstd left a reply on Error Wrapping Elasticsearch Class

On this

$elastic = \App\Elastic::class;

I got string value, so I got error next, as there must be object later

On this

        $elastic =app(App\Elastic::class);

line I got error

Class App\Elastic does not exist

Have I to make declaration in use block and which?

mstdmstd started a new conversation Error Wrapping Elasticsearch Class

Hello, In my Laravel 5.7 application I want to use elasticsearch and I found this https://michaelstivala.com/learning-elasticsearch-with-laravel/ article. Firstly I wanted to import all data from a table I want to use with elasticsearch

  1. I created a wrapper file app/Elastic.php, with content from githubusercontent. Is this proper dir for this file?

  2. In my model app/Vote.php I added function

    public static function bulkVotesToElastic()
    {

        $elastic = app(App\Elastic\Elastic::class);
        Vote::chunk(100, function ($Votes) use ($elastic) {
            foreach ($Votes as $Vote) {
                $elastic->index([
                    'index' => 'select_vote',
                    'type' => 'vote',
                    'id' => $Vote->id,
                    'body' => $Vote->toArray()
                ]);
            }
        });
    }

As I have seeder for filling of init data. But calling this method I got error:

Class App\App\Elastic\Elastic does not exist

Why error and how to fix it?

actually this line

$elastic = app(App\Elastic\Elastic::class);

is behind my laravel expierense...

Thanks!

04 Nov
2 months ago

mstdmstd started a new conversation How To Stop Only Frontend Of App?

Hello, In 5 laravel with

php artisan down

command that is easily to stop working of all application with message, but if there is a way to stop in similar way only frontend, while admins have access to backend?

when all backend routes are defined in routes/web.php as :

  Route::group(['middleware' => ['auth', 'isVerified'], 'prefix' => 'admin', 'as' => 'admin.'], function () {
  ...

Thanks!