mstdmstd

Member Since 3 Years Ago

Experience Points
19,840
Total
Experience

160 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
2
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

  • Community Pillar

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

Level 4
19,840 XP
Jan
18
18 hours ago
Activity icon

Started a new Conversation How To Set Parameters For Laravel 8 Factory?

Hello, In my Laravel 8 app I need to set params in factory call, which are not model fields, but I need them for calculations of some fields. In my case I need to set expire_date as interval of 1 month (with 2 parameters as year and month) Reading https://laravel.com/docs/8.x/database-testing#factory-states I made factory with states and I did not find how to get my additive parameters :

<?php

namespace Database\Factories;

use Config;
use Carbon\Carbon;
use App\Models\Ad;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
//use Cviebrock\EloquentSluggable\Sluggable;
use \Cviebrock\EloquentSluggable\Services\SlugService;

class AdFactory extends Factory
{
    protected $model = Ad::class;

    public function definition()
    {
        $text= $this->faker->text;
        $slugValue = SlugService::createSlug(Ad::class, 'slug', $text);

        \Log::info(  varDump($this, ' -1 $attributes::') );
        $startDate = new Carbon('first day of this month');
        return [
            'title' => $text,
            'ad_token' => $text,
            'slug' => $slugValue,
            'phone_display' => (rand(1, 3) == 1),
            'has_locations' => (rand(1, 4) == 1),
            'status' => 'A', // password
            'price' => mt_rand(10, 500),
            'ad_type' => (rand(1, 2) == 1 ? 'B' : 'S'),
            'expire_date' => $this->faker->dateTimeInInterval($startDate, '1 month', Config::get('app.timezone'))->format('Y-m-d H:i:s'),
//            'description' => $this->faker->paragraphs(rand(1, 4), true),
            'creator_id' => rand(1, 5),
        ];
    }

    public function expired()
    {
        return $this->state(function (array $attributes, $var1=null, $var2=null) {

            // $var1and $var 2 are null and $attributes has no year/month parameters 
            \Log::info(  varDump($var1, ' -1 expired $var1::') );
            \Log::info(  varDump($var2, ' -1 expired $var2::') );
            \Log::info(  varDump($attributes, ' -1 expired $attributes::') );
            return [ // I need something like that
                'expire_date' => $var1,
            ];
        });
    }
}

and I pass parameters in factory calling:

        $ads = Ad::factory()->count(10)->expired($year, $month)->create([

I failed to set $year and $month inside of factory... If there is a valid way ?

Thanks!

Jan
17
1 day ago
Activity icon

Started a new Conversation Why Setting Permission In Spatie\Permission Hav Invalid Model_type Value?

Hi all, In Laravel 8 app I set permission to user with control:

    public function store( $user_id )
    {

        $request = request();
        $requestData = $request->all();
        $permission_id= $requestData['permission_id'];
        $permission= Permission::find($permission_id);
        $user= Permission::find($user_id);

        DB::beginTransaction();
        try {
            \Log::info(  varDump($permission->name, ' -1 $permission->name::') );
            $user->givePermissionTo($permission->name); // Valid permission name
            DB::commit();
        } catch (\Exception $e) {
            DB::rollback();

            return response()->json(['message' => $e->getMessage()], HTTP_RESPONSE_INTERNAL_SERVER_ERROR);
        }
        return response()->json(['message' => ''], HTTP_RESPONSE_OK);
    }

It is added, but model_type has ‘Spatie\Permission\Models\Permission’, not ‘App\Models\User’ as I expected, so Permission does not work properly...

Making init seeding like:

        $editAdPermission = Permission::create(['name' => PERMISSION_EDIT_AD, 'guard_name' => 'web']);
        $adsEditorRole->givePermissionTo($editAdPermission); // means : adsEditor can edit ad
        $editAdUser= User::find(1);
        if ( $editAdUser ) {
            $editAdUser->givePermissionTo($editAdPermission);
            $editAdUser->givePermissionTo($deleteAdPermission);
        }

I have many rows with model_type == ‘App\Models\User’ : https://prnt.sc/wstzqk Also row with model_type == ‘Spatie\Permission\Models\Permission’ is not in collection returned by

$user->getPermissionNames() . 

I think because of wrong model_type value.

I did not modify default config/permission.php and in App\Models\User I use HasRoles trait .

How correctly ?

Thanks!

Jan
15
3 days ago
Activity icon

Replied to In Laravel App FortifyService Login And Regster Pages Are Redirected To Home

Not sure. I found that I have to comment lines in app/Http/Middleware/RedirectIfAuthenticated.php

<?php

namespace App\Http\Middleware;

use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class RedirectIfAuthenticated
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string|null  ...$guards
     * @return mixed
     */
    public function handle(Request $request, Closure $next, ...$guards)
    {
        $guards = empty($guards) ? [null] : $guards;

        \Log::info(  varDump($guards, ' -1 app/Http/Middleware/RedirectIfAuthenticated.php ::') );
        /* I trace value :

    [0] => 
)        
         */
//        foreach ($guards as $guard) {
//            if (Auth::guard($guard)->check()) {
//                return redirect(RouteServiceProvider::HOME);
//            }
//        }

        return $next($request);
    }
}

in this way I can open/submit login and open other pages, but looks like I break my security. But what caused this issue?

Jan
14
4 days ago
Activity icon

Started a new Conversation In Laravel App FortifyService Login And Regster Pages Are Redirected To Home

Hello, In Laravel 8 Backend app I tried to add access to api with "laravel/sanctum": "^2.8" and after that I can not open Login or regioster page :

In app/Providers/FortifyServiceProvider.php :

    public function boot()
    {

        \Log::info(  ' -11 app/Providers/FortifyServiceProvider.php boot::');
        Fortify::loginView(function () {
            $viewParamsArray                 = getAppParameters(true, ['csrf_token'], []);
            \Log::info(  ' -22 loginView::');
            return view('auth.login', $viewParamsArray );
        });
        Fortify::registerView(function () {
            \Log::info(  ' -33 registerView::');
            $viewParamsArray                 =  getAppParameters(true, ['csrf_token'], []);
            return view('auth.register', $viewParamsArray );
        });

I the logs I see only 1st line of boot method with “-11 ...” text - repeated 3 times

In routes/web.php :

<?php

use Illuminate\Support\Facades\Route;
//use App\Http\Controllers\Admin\RoleController;
use App\Http\Controllers\Admin\UserController;
use App\Http\Controllers\Admin\CategoryController;
use App\Http\Controllers\Admin\AdController;
use App\Http\Controllers\Admin\ChatController;
use App\Http\Controllers\Admin\AdLocationController;
use App\Http\Controllers\Admin\AdImageController;
use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\TeamChatController;
use App\Http\Controllers\TwilioChatController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\Admin\SearchController;

use App\Http\Controllers\Profile\UserProfileController;

Route::get('/', function () {
    return view('welcome');
});

Route::get('/home', function () {
    return view('welcome');
});


Route::get('search', [SearchController::class, 'index'])->name('search'); // https://www.itsolutionstuff.com/post/laravel-8-autocomplete-search-from-database-exampleexample.html
Route::get('autocomplete', [SearchController::class, 'autocomplete'])->name('autocomplete');

Route::post('token',  [TwilioChatController::class, 'getToken']);

Route::get( 'chat', [TwilioChatController::class, 'index'] );
Route::get( 'test', [DashboardController::class, 'test'] );
Route::get( 'test2', [DashboardController::class, 'test2'] );

Route::get( 'logged-user', [HomeController::class, 'get_logged_user'] );

//Auth::routes();

Route::group(['middleware' => ['auth'], 'prefix' => 'profile', 'as' => 'profile.'], function () {
    Route::resource( 'profile', UserProfileController::class );

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

    ///  DASHBOARD BLOCK START
    Route::get('dashboard', array(
        'as'      => 'dashboard',
        'uses'    => 'Admin\[email protected]'
    ));
    ///  DASHBOARD BLOCK END

    Route::resource( 'chat', ChatController::class );
    Route::post('/check_chat_channel', [ChatController::class, 'check_chat_channel']);
    Route::post('/chat_token', [ChatController::class, 'generate']);



    Route::resource('users', UserController::class);   // app/Http/Controllers/Admin/UserController.php
    Route::get( 'get-users-dt-listing', [UserController::class, 'get_users_dt_listing'] );
    Route::post('/user/generate-password/{user_id}', [UserController::class, 'generate_password'] );

    Route::resource('categories', CategoryController::class);   // app/Http/Controllers/Admin/CategoryController.php
    Route::get( 'get-categories-dt-listing', [CategoryController::class, 'get_categories_dt_listing'] );


    Route::resource('ads', AdController::class);   // app/Http/Controllers/Admin/AdController.php
    Route::get( 'get-ads-dt-listing', [AdController::class, 'get_ads_dt_listing'] );
    Route::post('/get_ad_presentation_card_info_by_id/{ad_id}', [AdController::class, 'get_ad_presentation_card_info_by_id'] );
    Route::post('/generate_ad_presentation_card_info_by_id', [AdController::class, 'generate_ad_presentation_card_info_by_id'] );

    Route::get('fullcalendar', [AdController::class, 'get_ad_events']);
    Route::post('fullcalendarAjax', [AdController::class, 'ajax']);

    Route::get('get_search_info', [
            'as'   => 'get_search_info',
            'uses' => 'App\Http\Controllers\Admin\[email protected]_search_info']
    );

    Route::get('get_system_info', [
            'as'   => 'get_system_info',
            'uses' => 'App\Http\Controllers\Admin\[email protected]_system_info']
    );

    Route::get( 'sanctum_testing', [TeamChatController::class, 'sanctum_testing'] );
    Route::get( 'team-chat', [TeamChatController::class, 'index'] );

    Route::group(['prefix' => 'ads'], function ($router) {

        Route::patch('/{ad_id}/upload_image_to_tmp', [AdImageController::class, 'upload_image_to_tmp']);
        Route::post('/{ad_id}/upload_image_to_ad', [AdImageController::class, 'upload_image_to_ad']);
        Route::get('/{ad_id}/load_ad_images', [AdImageController::class, 'load_ad_images']);

        Route::resource('/{ad_id}/ad_locations', AdLocationController::class, [
            'names' => [
                'index' => 'ads.ad_locations.index',
                'create' => 'ads.ad_locations.create',
                'store' => 'ads.ad_locations.store',
                'edit' => 'ads.ad_locations.edit',
                'update' => 'ads.ad_locations.update',
            ]
        ]);


    });

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

and in routes/api.php :

<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\SecretController;

use App\Http\Controllers\API\RegisterController;
use App\Http\Controllers\API\AdController;

Route::get('/secrets', [SecretController::class, 'index']);

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

//Route::post('register', [RegisterController::class, 'register']);
//Route::post('login', [RegisterController::class, 'login']);

Route::middleware('auth:sanctum')->group( function () {
    Route::resource('ads', AdController::class);
});

In app/Http/Kernel.php :

<?php

namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        \App\Http\Middleware\TrustHosts::class,
        \App\Http\Middleware\TrustProxies::class,
        \Fruitcake\Cors\HandleCors::class,
        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
        \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
        \App\Http\Middleware\TrimStrings::class,
        \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' => [

            \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
            'throttle:api',
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
        'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
        'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
        'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,

        'auth' => \App\Http\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
        'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
    ];
}

I run commands :

php artisan config:cache
php artisan route:cache
php artisan cache:clear
php artisan view:clear
php artisan  clear-compiled

composer dump-autoload

Any hints what was broken and how to fix it?

Thanks!

Jan
13
5 days ago
Activity icon

Started a new Conversation How With JQuery Catch If Login Session Was Expired ?

Hello, In my Laravel 8 app I use jQuery 3.5.1 and wonder if there is a way in case if login session was expired to catch this error in 1 place to make logout from the app?

Thanks!

Activity icon

Started a new Conversation How To Implement External Service Api With Sanctum?

Hello, I have Laravel 8 / blade / jQuery 3.5.1 / bootstrap 4.5.3 backend application with ads and I need to add external api with functionality like : a) Read our ads by some criteria b) Registered client can add ads to our database ... I added https://laravel.com/docs/8.x/sanctum to my app and use it as access token provider service to external api.

So I see it as next: When client fills special form (Register to services) he also select(subscribes) to several our services and on submit 1 row in personal_access_tokens will be added, like :

tokenable_type - not sure, what this field is for ? Some label like “Ads_Service” ? tokenable_id - not sure, what this field is for ? Reference to user.id(client must be registered at this table) name - not sure, what this field is for ?

token = returned token from Register to services form. This token would be used later for 'can_read_ads''can_add_ads' operations abilities = {'can_read_ads''can_add_ads', ‘some other service’} and for any selected functionality

last_used_at = when last operation was done.

How do you think ? What did I miss and what can be added?

Thanks!

Jan
05
1 week ago
Activity icon

Replied to Twilio Method Inside Of Promise Does Not Work

I made more checking and debugging I see that all parameters are valid : https://prnt.sc/wh8gg3 and https://prnt.sc/wh8hfl I mean that is not problem that invalid variables or invalid scope. But I do not catch why code inside of

vm.tc.messagingClient.getSubscribedUsers().then(function(users)

does not run. This circle works ok inside of a promise... Is my promise invalid ?

Activity icon

Started a new Conversation Twilio Method Inside Of Promise Does Not Work

Hello, Reading https://www.twilio.com/blog/implementing-programmable-chat-php-laravel-vue-js I try implement chat in my Laravel 8 / jQuery 3.5.1 / vue 2.6 app.

This docs has defined :


setupChannel(channel){
    let vm = this;
    return this.leaveCurrentChannel()
        .then(function() {
        return vm.initChannel(channel);
        })
        .then(function(_channel) {
        return vm.joinChannel(_channel);
        })
        .then(this.initChannelEvents);
},

I want to extend joinChannel method, as I want to make checks if current logged user (laravel auth) is already joined. I try to make it with promise and failes, as code inside of

vm.tc.messagingClient.getSubscribedUsers() is not run. I do 
          setupChannel(channel){
               let vm = this;
                return this.leaveCurrentChannel()
                    .then(function() {
                        return vm.initChannel(channel);
                    })
                    .then(function(_channel) {

                        let promise = new Promise((resolve, reject) => {

                            // debugger
                            vm.tc.messagingClient.getSubscribedUsers().then(function(users) {
                              // THESE CODE IS NOT RUN.  If to uncomment console and debugging it is not triggered
                                // console.log('++ users::')
                                // console.log(users)
                                // debugger
                                for (let i = 0; i < users.length; i++) {
                                    const user = users[i];
                                    console.log('user.identity: ' + JSON.stringify(user.identity) );
                                    // console.log('user: ' + JSON.stringify(user, null, 2) );
                                    if( user.identity === vm.loggedUser.name ) {
                                        resolve("result")
                                    }
                                }

                                debugger // THESE CODE IS NOT RUN
                                resolve("error")
                            })
                            
                        })
                        console.log('++ promise::')
                        console.log(promise) // I SEE this promise in pending state
                        promise
                            .then(
                                result => {
                                    alert("result: " + result);
                                    return _channel;
                                },
                                error => {
                                    alert("error: " + error);
                                    return vm.joinChannel(_channel);
                                }
                            )
                        // return vm.joinChannel(_channel);
                    })
                    .then(this.initChannelEvents);

If to run code

 vm.tc.messagingClient.getSubscribedUsers().then(function(users)
  ...
i```
nside of promise, it works ok and I got valid results.
  
What is wrong in my promise structure and how can I fix it?

Thanks!
Jan
02
2 weeks ago
Activity icon

Replied to I Got .fileupload Is Not A Function Error In My Laravel 8 App

That is how console of my browser looks like : https://prnt.sc/wes6dq Apart I use and init gijgo datepicker, tinymce, autonumeric component when jquery is inited and they all works ok. I mean jquery was inited ok. Any hints ?

Jan
01
2 weeks ago
Activity icon

Replied to I Got .fileupload Is Not A Function Error In My Laravel 8 App

I checked. All files found with 200 return code

Activity icon

Replied to I Got .fileupload Is Not A Function Error In My Laravel 8 App

Still suffer this error ... Not any ideas or how to debug it ?

Dec
30
2 weeks ago
Activity icon

Started a new Conversation I Got .fileupload Is Not A Function Error In My Laravel 8 App

Hello, In my Laravel 8 / jQuery 3.5.1 / bootstrap 4.5.3 app I want to add jQuery-File-Upload library and adding all files to my project I got error

Uncaught TypeError: $(...).fileupload is not a function

At line with fileupload calling:

      <div class="col-xs-12 col-sm-6">
          <input id="fileupload"  type="file" class="ad_image_fileupload" name="files[]" >
      </div>


@section('scripts')
    
    <link href="{{ asset('css/gijgo.min.css') }}" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="{{ url('css/jquery.fileupload.css') }} "/>


    <script src="{{ asset('node_modules/tinymce/tinymce.js') }}"></script>
    <script src="{{ asset('js/[email protected]') }}"></script>

    <script src="{{ url('js/fileupload/jquery.ui.widget.js') }}"></script>

    <script src="{{ url('js/fileupload/jquery.iframe-transport.js') }}"></script>
    <script src="{{ url('js/fileupload/jquery.fileupload.js') }}"></script>
    
    <script src="{{ url('js/fileupload/jquery.fileupload-process.js') }}"></script>
    <script src="{{ url('js/fileupload/jquery.fileupload-ui.js') }}"></script>
    <script src="{{ url('js/fileupload/jquery.fileupload-validate.js') }}"></script>
    <script src="{{ url('js/fileupload/jquery.fileupload-video.js') }}"></script>

    <script src="{{ asset('js/gijgo.min.js') }}"></script>

    <script>
        console.log('resources/views/admin/ads/edit.blade.php::')
        jQuery.noConflict();  //Not to conflict with other scripts
        jQuery(document).ready(function ($) {
            console.log('-2 resources/views/admin/ads/edit.blade.php::')


            $('.ad_image_fileupload').fileupload({
               url: href,
               type: "POST",

in my resources/views/admin/layouts/app.blade.php :

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    <link href="{{ asset('css/plugins.css') }}" rel="stylesheet">
    <link href="{{ asset('css/solar/bootstrap.min.css') }}{{  "?dt=".time()  }}" rel="stylesheet">
    
    <link href="{{ asset('css/jquery-confirm.css') }}" rel="stylesheet" type="text/css">   
    
    <!-- Scripts -->
    <script src="{{ asset('js/jquery.min.js') }}"></script>    
    <script src="{{ asset('js/app.js') }}{{  "?dt=".time()  }}" defer></script>
    
    <script src="{{ asset('js/admin/common.js') }}{{  "?dt=".time()  }}"></script>

</head>

<body class="d-flex flex-column">
<div id="app" class="d-flex flex-column">
    
    <header>
        @include('admin.layouts.navbar')
    </header>
    <main class="container-fluid flex-fill">
        @yield('content')
    </main>
    
    <footer>
        @include($current_admin_template.'.layouts.footer')
    </footer>
    @yield('scripts')

</div>
</body>

and in resources/js/bootstrap.js :

window._ = require('lodash');

console.log('resources/js/bootstrap.js::')

try {
    window.Popper = require('popper.js').default;
    window.$ = window.jQuery = require('jquery');
    window.confirm =  require('jquery-confirm')

    window.toastr =  require('toastr')

    require('bootstrap');
    require('toastr');
    require('bootstrap-notify'); //     <script src="{{ asset('/js/jquery.bootstrap-growl.min.js') }}"></script>

} catch (e) {}


window.axios = require('axios');

I am sure that fileupload is triggered afetr quesry is loaded. I tried to change order of files in my blade file, but got this error anyway...

I tried to change place of @yield('scripts') inside of app.blade.php and location of js files inside of my blade file, but failed...

How it can be fixed?

Thanks!

Dec
28
3 weeks ago
Activity icon

Replied to How To Make Screen Sharing With Twilio API ?

Thanks for your feedbacks! Following the docs I found link to “Update: Event Pages and Background Pages” page at https://developer.chrome.com/docs/apps/event_pages/ with :

Caution
Important: Chrome will be removing support for Chrome Apps on all platforms. Chrome browser and the 
Chrome Web Store will continue to support extensions. Read the announcement and learn more about 
migrating your app.

and next I read :

December 2020: End support for Chrome Apps on Windows, Mac, and Linux.

If there is a sense to read this manual and try to impement it in my laravel 5.8 app?

Dec
26
3 weeks ago
Activity icon

Started a new Conversation How To Generate Power Point Document From Html Block?

Hi, I need to generate Power Point document from ad item based on row from database. I made a modal dialog with cards displaing ad info I need. next I want to use html code of root dive to want to write it into Powrer Point file. I used similar way with https://github.com/spatie/browsershot when I had to create pdf file.

I find https://github.com/PHPOffice/PHPPresentation, but triyng to write html code into it I failed... Looks like that is not how pluging is supposed to work ?

Can I do what I need with this(or otger) plugin to generate Power Point document ?

Thanks!

Dec
24
3 weeks ago
Dec
23
3 weeks ago
Activity icon

Started a new Conversation How To Make Screen Sharing With Twilio API ?

Hello, I need to make screen sharing with twilio API in my Laravel 5 app. Searching in net I found this https://www.twilio.com/blog/2018/01/screen-sharing-twilio-video.html article. Not sure, is it offifial docs from Twillio? Also what raise my doubts that The Chrome extension was created in this post. So all users need to install this extension to use it? That seems not very good decision? Are there some other ways to create screen sharing with twilio API with srep by steps documentation... Thanks!

Dec
22
3 weeks ago
Activity icon

Replied to With Twilio API In Vuejs2 App I Got Error

Thanks, I saw such scripts and tried to follow them. It seems to me that there was a reference to some very old version of API and I do not see why...

Dec
21
4 weeks ago
Activity icon

Replied to With Twilio API In Vuejs2 App I Got Error

I tried to debug this issue in Twilio.js:258 and found : https://prnt.sc/w79oys

and ref to undefined element https://prnt.sc/w79pqi

and I see ref 10 years old https://prnt.sc/w79q4s can it be reason of my error and why so ?

I tried version of twilio 3.54.1 (latest) and 3.54.0 but I have the same error and the same data I see debugging...

Activity icon

Replied to With Twilio API In Vuejs2 App I Got Error

by your link in code :

const Chat = require('twilio-chat');
Chat.Client.create(token).then(client => {

token must be provided... Where can I get it from ?

Dec
20
4 weeks ago
Activity icon

Started a new Conversation With Twilio API In Vuejs2 App I Got Error

Hello, I want to use twilio API in my vuejs2 app looking at demo https://github.com/TwilioDevEd/sdk-starter-node:

I try to follow it and read token backendpoint, which looks like “eyJ0eXAiO...” and I try next :

...
const Twilio = require('twilio')

console.log('$twilio::')
console.log(Twilio)

console.log('$twilio.Chat::')
console.log(Twilio.Chat)

const client = await Twilio.Chat.Client.create(token)

I got error :

TypeError: Cannot read property 'Client' of undefined

and in console I see invalid twilio object : https://prnt.sc/w41cc7

I suppose I imported invalid twilio object, but how correctly ? looks like in the sdk-starter-node-master was done in the same way and I do not see difference?

package.json :

"axios": "^0.19.0",
"core-js": "^3.3.2",
...
"twilio": "^3.54.0",
"vue": "^2.6.10",
...

Thanks!

Activity icon

Started a new Conversation Using Laravel-datatables In Laravel I See Only Header Of Table

Reading manual https://yajrabox.com/docs/laravel-datatables/master/quick-starter

I try to add laravel-datatables to my laravel 8 app and I have in the control:

    public function index(UsersDataTable $dataTable)
    {
        $viewParamsArray = getAppParameters(true, ['csrf_token'], []);
        return $dataTable->render('admin.users.index', $viewParamsArray);
    }

In app/DataTables/UsersDataTable.php :

<?php

namespace App\DataTables;

use App\Models\User;
use Yajra\DataTables\DataTables;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;

class UsersDataTable extends DataTable
{
    public function dataTable($query)
    {
        return datatables()
            ->eloquent($query)
            ->addColumn('action', 'users.action');
    }

    public function query(User $model)
    {
        \Log::info( '-10 query ::' . print_r( -10, true  ) ); // I do not see this line in log

        return $model->newQuery()->orderBy('users.id', 'asc')   ->map
            (function ($userItem) {
            $userItem->slashed_name = addslashes($userItem->name);
            $permissionsLabel       = '';
                \Log::info(  varDump($userItem->getPermissionNames(), ' -000 $userItem->getPermissionNames()::') );
            foreach ($userItem->getPermissionNames() as $v) {
                $permissionsLabel .= $v . ', ';
            }
            $userItem->permissions_label = trimRightSubString(trim($permissionsLabel), ',');

            return $userItem;
        })
        ->all();
    }

    public function html()
    {
        \Log::info( '-1  public function html( ::' . print_r( -3, true  ) );
        // I see this line in log
        return $this->builder()
                    ->setTableId('users-table')
                    ->columns($this->getColumns())
                    ->minifiedAjax()
                    ->dom('Bfrtip')
                    ->orderBy(1)
                    ->buttons(
                        Button::make('create'),
                        Button::make('export'),
                        Button::make('print'),
                        Button::make('reset'),
                        Button::make('reload')
                    );
    }

    protected function getColumns()
    {
        return [
            'id',
            'name',
            'email',
            'phone',
        ];
    }

    protected function filename()
    {
        return 'Users_' . date('YmdHis');
    }
}

In resources/views/admin/users/index.blade.php :

@extends($current_admin_template.'.layouts.app')

@section('content')
<div class="backend_listing_container">
    <div class="card col-sm-12">
        <div class="card-header">
            ...
        </div>

        <div class="card-body data_listing_bordered_block">

            @include($current_admin_template.'.layouts.page_header')

            <div class="table-responsive dataTables_header">
                <table class="table table-bordered table-striped text-primary" id="users-table">
                    {{$dataTable->table()}}
                </table>
            </div>

        </div> <!-- card-body -->

    </div>  <!-- card -->
    {{$dataTable->scripts()}}

</div>

@endsection

As result I see only header of table with id="users-table" and no sql-tracement to db. What did miss to make data uploaded on page load and how better to make as I need custome filters form(name text, status/group selection input) to reload data by clicking on “Search” button?

Thnaks!

Dec
19
4 weeks ago
Activity icon

Started a new Conversation Is It Correct To Include Jquery.min.js In App.blade.php Of Laravel App?

Hi, If to comment line with query.min.js in resources/views/admin/layouts/app.blade.php of laravel 8 app

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    <link href="{{ asset('css/flatly/bootstrap.min.css') }}{{  "?dt=".time()  }}" rel="stylesheet">
    
    <link href="{{ asset('css/jquery-confirm.css') }}" rel="stylesheet" type="text/css">
    
    
    <!-- Scripts -->
    <script src="{{ asset('js/jquery.min.js') }}"></script>
    <script src="{{ asset('js/app.js') }}{{  "?dt=".time()  }}" defer></script>
    
    <script src="{{ asset('js/admin/common.js') }}{{  "?dt=".time()  }}"></script>

</head>
<body>

I have some problems in my form :

@section('scripts')
    <script>
        // I do not see console line below
        console.log('resources/views/admin/users/edit.blade.php::')
        jQuery(document).ready(function ($) { // this block is not triggered 
            console.log('-2 resources/views/admin/users/edit.blade.php::')
            backendInit('edit', 'user', <?php echo $user->id ?>)

but in my resources/js/bootstrap.js I have lines :

window._ = require('lodash');

// I see this line in the console
console.log('resources/js/bootstrap.js::')

try {
    window.Popper = require('popper.js').default;
    window.$ = window.jQuery = require('jquery');
    window.confirm =  require('jquery-confirm');

    require('bootstrap');
    require('bootstrap-notify'); //     <script src="{{ asset('/js/jquery.bootstrap-growl.min.js') }}"></script>
    require('datatables.net-bs4')
    require('datatables.net-buttons-bs4')
    ...

I have installed in package-lock.json :

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --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 --disable-host-check --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 --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.19",
        "bootstrap": "^4.0.0",
        "cross-env": "^7.0",
        "font-awesome": "^4.7.0",
        "jquery": "^3.2",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.19",
        "popper.js": "^1.12",
        "resolve-url-loader": "^3.1.0",
        "sass": "^1.15.2",
        "sass-loader": "^8.0.0",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "bootstrap-notify": "^3.1.3",
        "datatables.net-bs4": "^1.10.23",
        "datatables.net-buttons-bs4": "^1.6.5",
        "jquery-confirm": "^3.3.4"
    }
}
I supposed that with require in bootstrap.js  jquery lib would be able in all parts of my app,

But I need to add line with :

   <script src="{{ asset('js/jquery.min.js') }}"></script>

in resources/views/admin/layouts/app.blade.php...

Which way is valid ?

Thanks!

Dec
17
1 month ago
Activity icon

Started a new Conversation I Search Replacement For Bootstrap-growl

Hello, can you advice some message popup library like https://github.com/ifightcrime/bootstrap-growl for laravel 8/bootstrap 4/ jquery 3.2 app?

bootstrap-growl seems too old... Thanks!

Activity icon

Started a new Conversation With Twilio API In Vuejs2 App I Got Error Client.on Is Not A Function

Hello, I want to use twilio API in my vuejs2 app looking at demo https://github.com/TwilioDevEd/sdk-starter-node:

I got client object with Twilio credentials, but next I want to assign tokenAboutToExpire with code like :

                const client = new Twilio(
                    process.env.VUE_APP_TWILIO_API_KEY,
                    process.env.VUE_APP_TWILIO_API_SECRET,
                    {
                        accountSid: process.env.VUE_APP_TWILIO_ACCOUNT_SID,
                    }
                )
                console.log('client::')
                console.log(client)
                console.log('client.chat::')
                console.log(client.chat)
                
                client.on("tokenAboutToExpire", async () => { // Error line
                // client.chat.on("tokenAboutToExpire", async () => { // If to uncomment this line 
                    const token = await this.fetchChatToken()
                    client.updateToken(token)
                })

and got error:

Uncaught (in promise) TypeError: client.on is not a function
    at _callee3$ (usersChat.vue?ec5f:264)
    at tryCatch (runtime.js?96cf:63)
    at Generator.invoke [as _invoke] (runtime.js?96cf:293)

and in the console I see that I have client and client.chat : https://prnt.sc/w4frzp What is wrong? Is it invalid client object?

Thanks!

Dec
12
1 month ago
Activity icon

Replied to Why In Docker Adminer Failed With Port Address Already In Use Error?

Thanks for the link. After OS restarted I run docker again :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ systemctl restart docker
[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ docker-compose up -d
Starting container_web ...
Starting container_composer ...
Starting container_composer
container_db is up-to-date
Starting container_web
Starting container_adminer ...
Starting container_web ... done
[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ docker logs --tail=40  -t  container_db
2020-12-12T04:27:13.866591595Z 2020-12-12T04:27:13.866463Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-12-12T04:27:13.866619557Z 2020-12-12T04:27:13.866504Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-12-12T04:27:14.866684276Z 2020-12-12T04:27:14.866593Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11

I make checks :

netstat -lpn | grep 8089
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::8089                 :::*                    LISTEN      -

Trying o kill this process:

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ sudo lsof -t -i:8089
11974
[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ sudo kill -9 11974

Check that all is cleared :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ sudo lsof -t -i:8089
[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ netstat -lpn | grep 8089
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)

And the same error running docker again :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ docker-compose up -d
container_web is up-to-date
Starting container_composer ...
container_db is up-to-date
Starting container_composer
Starting container_composer ... done
[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ docker logs --tail=40  -t  container_web
2020-12-11T15:51:27.153557880Z AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.3. Set the 'ServerName' directive globally to suppress this message
2020-12-11T15:51:27.173414849Z AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.3. Set the 'ServerName' directive globally to suppress this message
2020-12-11T15:51:27.221060829Z [Fri Dec 11 15:51:27.220631 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.2.34 configured -- resuming normal operations
2020-12-11T15:51:27.221095154Z [Fri Dec 11 15:51:27.220916 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
2020-12-11T16:13:55.435812735Z 172.22.0.3:80 172.22.0.1 - - [11/Dec/2020:16:13:55 +0000] "GET /wallet HTTP/1.1" 200 509 "http://127.0.0.1:8088/transactions" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36"
2020-12-11T16:13:55.887374112Z 172.22.0.3:80 172.22.0.1 - - [11/Dec/2020:16:13:55 +0000] "GET /favicon.ico HTTP/1.1" 304 178 "http://127.0.0.1:8088/wallet" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36"
2020-12-11T16:14:46.981847045Z 172.22.0.3:80 172.22.0.1 - - [11/Dec/2020:16:14:46 +0000] "-" 408 0 "-" "-"
2020-12-11T16:25:37.016476912Z [Fri Dec 11 16:25:37.001024 2020] [mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully
2020-12-12T04:26:36.584784428Z AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.5. Set the 'ServerName' directive globally to suppress this message
2020-12-12T04:26:36.703910666Z AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.22.0.5. Set the 'ServerName' directive globally to suppress this message
2020-12-12T04:26:36.904703169Z [Sat Dec 12 04:26:36.904401 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.2.34 configured -- resuming normal operations
2020-12-12T04:26:36.904726552Z [Sat Dec 12 04:26:36.904638 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name__DOCKER$ docker logs --tail=40  -t  container_db
2020-12-12T04:33:11.960345116Z 2020-12-12T04:33:11.960225Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-12-12T04:33:11.960379414Z 2020-12-12T04:33:11.960255Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
2020-12-12T04:33:12.960599392Z 2020-12-12T04:33:12.960422Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11

again check ports :

$ sudo lsof -t -i:8089
17620

and :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name/__DOCKER$ ps uax | grep mysql
mysql     1745  0.0  1.4 1426956 115216 ?      Sl   06:17   0:01 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
serge     4412  0.0  2.1 2554892 171268 ?      Sl   06:17   0:01 /usr/sbin/mysqld --defaults-file=/home/serge/.local/share/akonadi/mysql.conf --datadir=/home/serge/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-serge.jyO3Cq/mysql.socket --pid-file=/tmp/akonadi-serge.jyO3Cq/mysql.pid
999      11112  0.0  1.4 1078304 117536 ?      Ssl  06:24   0:01 mysqld
999      21312  1.3  2.1 562796 177700 ?       Ssl  06:52   0:00 mysqld
serge    21481  0.0  0.0  18008  1020 pts/3    S+   06:52   0:00 grep --color=auto mysql

and again the same :

sudo kill -9 17620

and the same error running again :

docker-compose up -d
...
$ docker logs --tail=40  -t  container_db
2020-12-12T04:59:43.634814622Z 2020-12-12T04:59:43.634657Z 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2020-12-12T04:59:43.634853715Z 2020-12-12T04:59:43.634686Z 0 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.
...

All the command I run in hosting Kubuntu 18.

I do not see why stopping compose and killing process I got error again? Is something wrong in my config files?

__DOCKER/docker-compose.yml :
version: '3.5'

services:


    web:
        container_name: container_web

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

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


    db:
        container_name: container_db
        image: mysql:5.7.28
        # image: mysql:8.0.21
        restart: always
        environment:
            - MYSQL_DATABASE=DockerDB
            - MYSQL_USER=docker_user
            - MYSQL_PASSWORD=4321
            - MYSQL_ALLOW_EMPTY_PASSWORD=false
            - MYSQL_ROOT_PASSWORD=321
            - TZ=Europe/Kiev

        volumes:
            - ${DB_PATH_HOST}:/var/lib/mysql



    adminer:
      container_name: container_adminer
      image: adminer
      restart: always
      ports:
        - 8089:8080
      links:
        - db


    composer:
        container_name: container_composer
        image: composer:1.8
        volumes:
            - ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
        working_dir: ${APP_PTH_CONTAINER}
        command: composer install --ignore-platform-reqs

and __DOCKER/web/Dockerfile.yml:

FROM php:7.2-apache

RUN apt-get update && \
    apt-get install -y \
    python \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    libzip-dev \
    nano \
    mc \
    git-core \

#    libmagickwand-dev --no-install-recommends && \
#    pecl install imagick && imagick && \
#    docker-php-ext-enable imagick && \

    curl \
    build-essential \
    openssl \
    libssl-dev \
    libgmp-dev \
    libldap2-dev \
    netcat \
    locate \
    # composer \
    && git clone https://github.com/nodejs/node.git && \
  cd node  \
  && git checkout v12.0.0 \
  && ./configure \
  && make \
  && make install

  RUN npm install cross-env

  RUN npm install -g yarn

  RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/

  RUN apt-get install -y zlib1g-dev libicu-dev g++ \
  && docker-php-ext-configure intl \
  && docker-php-ext-install intl

  # Install Composer
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

  RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
&& a2enmod rewrite

  # RUN install-php-extensions imagick

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

?

Dec
11
1 month ago
Activity icon

Started a new Conversation Why In Docker Adminer Failed With Port Address Already In Use Error?

Hello, Installing laravel app under docker from FROM php:7.2-apache I got errors that start service adminer failed and port address already in use:

Creating gotoconsult_adminer ...
Creating gotoconsult_adminer ... error

ERROR: for gotoconsult_adminer  Cannot start service adminer: driver failed programming external connectivity on endpoint gotoconsult_adminer (06771e791ffbd3a04af81f13f8a6a885c9dd11e8031aa34bb9a2a037fbfdfc3e): Error starting userland proxy: listen tcp 0.0.0.0:8089: bind: address already in use

ERROR: for adminer  Cannot start service adminer: driver failed programming external connectivity on endpoint gotoconsult_adminer (06771e791ffbd3a04af81f13f8a6a885c9dd11e8031aa34bb9a2a037fbfdfc3e): Error starting userland proxy: listen tcp 0.0.0.0:8089: bind: address already in use
ERROR: Encountered errors while bringing up the project.

I stop docker :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name/__DOCKER$ docker-compose down
Stopping gotoconsult_db  ... done
Stopping gotoconsult_web ... done
Removing gotoconsult_adminer  ... done
Removing gotoconsult_db       ... done
Removing gotoconsult_web      ... done
Removing gotoconsult_composer ... done
Removing network docker_default

and check empty containers list :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name/__DOCKER$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

I run next :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name/__DOCKER$ ps uax | grep mysql
mysql     1670  0.0  0.5 1361220 42796 ?       Sl   16:25   0:02 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
serge     4097  0.0  0.1 2554892 8504 ?        Sl   16:25   0:02 /usr/sbin/mysqld --defaults-file=/home/serge/.local/share/akonadi/mysql.conf --datadir=/home/serge/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-serge.wsi8ij/mysql.socket --pid-file=/tmp/akonadi-serge.wsi8ij/mysql.pid
999      13286  0.0  0.5 1078304 42036 ?       Ssl  16:32   0:02 mysqld
serge    15672  0.0  0.0  18008   972 pts/3    S+   17:51   0:00 grep --color=auto mysql

Not sure which mysql is it? I have running apache2 with mysql on my hosting Ubuntu 18? Can it be the issue?

and running composer again I got error :

[email protected]:/mnt/_work_sdb8/wwwroot/lar/project_name/__DOCKER$ docker-compose up -d
Creating network "docker_default" with the default driver
Creating gotoconsult_web ...
Creating gotoconsult_db ...
Creating gotoconsult_composer ...
Creating gotoconsult_web
Creating gotoconsult_composer
Creating gotoconsult_db ... done
Creating gotoconsult_adminer ...
Creating gotoconsult_adminer ... error

ERROR: for gotoconsult_adminer  Cannot start service adminer: driver failed programming external connectivity on endpoint gotoconsult_adminer (aafcc2af19f6589c62586dbc3b9c57562b6416f7500cdf0b40a37052d138da3b): Error starting userland proxy: listen tcp 0.0.0.0:8089: bind: address already in use

ERROR: for adminer  Cannot start service adminer: driver failed programming external connectivity on endpoint gotoconsult_adminer (aafcc2af19f6589c62586dbc3b9c57562b6416f7500cdf0b40a37052d138da3b): Error starting userland proxy: listen tcp 0.0.0.0:8089: bind: address already in use
ERROR: Encountered errors while bringing up the project.

In my __DOCKER/docker-compose.yml I have :

    adminer:
      container_name: project_name_adminer
      image: adminer
      restart: always
      ports:
        - 8089:8080
      links:
        - db

Why error and how to fix it?

Thanks!

Dec
06
1 month ago
Activity icon

Started a new Conversation How To Define 2 Alpines Components In 2 Livewire Files

Hello, In laravel 7 /livewire 1.3 / alpinejs 2 project I make crud, when for adding/editing I include livewire.admin.app-news.form inside of data listing(resources/views/livewire/admin/app-news/container.blade.php) : in this file adminNewsComponent is defined :

<article class="admin_page_container">
    
    <div class="form-admin-news" x-data="adminNewsComponent()"  x-init="initAdminNewsComponent()" >
        
        <div class="">
            ...
    
            @include('livewire.common.alert_messages')
    
    
            @if($updateMode=='edit' or $updateMode=='add')
                @include('livewire.admin.app-news.form')
            @endif
            
            @if($updateMode=='browse')
                @if(count($newsDataRows) == 0)
                    <div class="alert alert-info" role="alert">
                        No data found
                    </div>
                @endif
                
                @if(count($newsDataRows) > 0)
                    
                    <div class="table-responsive table-wrapper-for-data-listing" x-data="selectedNewsIdsBoxXData()">
                        DATA LISTING
                    </div> <!-- <div class="table-responsive table-wrapper-for-data-listing"> -->
                
                @endif {{-- @if(count($newsDataRows) > 0) --}}
            @endif {{-- @if($updateMode=='browse')  --}}
        </div> <!-- <div class=""> -->
        
        
        <section class="mt-2">
            @if($updateMode=='browse' and count($newsDataRows) > 0)
                {{ $newsDataRows->links() }}
            @endif
        </section>
    
    </div> <!-- <div class=""> -->
</article> <!-- page_content_container -->

@push('styles')
    <link href="/css/quill.snow.css" rel="stylesheet">
@endpush

@push('scripts')
    <script src="{{ asset('/js/quill.js') }}"></script>
@endpush

@push('scripts')
    <script>
        function selectedNewsIdsBoxXData() {
            console.log('!!!selectedNewsIdsBoxXData::')
                ...
        }


        function adminNewsComponent() {

            ...

        } // function adminNewsComponent() {



    </script>
@endpush

all methods and data of adminNewsComponent works ok but the problem is that when I open editor form with line :

            @if($updateMode=='edit' or $updateMode=='add')
                @include('livewire.admin.app-news.form')
            @endif

I can not define similar component inside of resources/views/livewire/admin/app-news/form.blade.php :

<article>
    
    @inject('viewFuncs', 'App\library\viewFuncs')
    
    <form class="form-editor" @if($updateMode=='edit')  wire:submit.prevent="update"
          @else  wire:submit.prevent="store" @endif >
        <div class="card" x-data="adminNewsEditorComponent()" x-init="initAdminNewsEditorComponent()" >
            <div class="card-body card-block">

                ...
    
    
                @section('scripts')
                <script>


                    function adminNewsEditorComponent() {

I got ReferenceError: adminNewsEditorComponent is not defined. I suppose the reason is that @include( is used here and actually I would like to diffferent files and 2 different components defined.

How that could be fixed ?

Thanks!

Dec
03
1 month ago
Activity icon

Replied to How To Install Livewire-devtools Under Chrome?

I returned to "livewire/livewire": "^1.3" and have no this error. Seems that is error of branch 2. Who has worked with livewire - is it stable ? If there is a sense to move to it now?

Dec
01
1 month ago
Activity icon

Replied to How To Install Livewire-devtools Under Chrome?

Looking at branch https://github.com/beyondcode/livewire-devtools/issues/6 I found some hints how it can be fixed:

  1. In file package.json I added
    "devDependencies": {
        "eslint": "^7.9.0"
    },

eslint line and run

npm install
npm run watch-poll

with success

  1. In my project I found 3 files :
/vendor/livewire/livewire/dist/manifest.json
/public/mix-manifest.json
/public/vendor/livewire/manifest.json

but all these 3 files are autogenerated I do not know which file have I to edit as I read :

{
  ...
  "permissions": [
    "http://*/*",
    "https://*/*",
+   "contextMenus"
  ],
  ...
}
contextMenus is missed in manifest.json

?

Nov
30
1 month ago
Activity icon

Started a new Conversation How To Install Livewire-devtools Under Chrome?

Hello, In the console of my Livewire/livewire 2 / laravel 7 app I got error :

login?email=admin%40mail.com&password=111111:60 Uncaught TypeError: window.livewire.devTools is not a function
    at login?email=admin%40mail.com&password=111111:60
(anonymous) @ login?email=admin%40mail.com&password=111111:60
livewire-turbolinks.js:31 Uncaught TypeError: Livewire.hook is not a function

I loaded and installed package from https://github.com/beyondcode/livewire-devtools and selected it under chrome://extensions/ but I see errors buttons red: https://prnt.sc/vqgk51

and clicking on it I see error:

Error in event handler: ReferenceError: suffix is not defined
Context
_generated_background_page.html
Stack Trace
build/background.js:1 (anonymous function)


!function(e){var n={};function o(t){if(n[t])return n[t].exports;var s=n[t]={i:t,l:!1,exports:{}};return e[t].call(s.exports,s,s.exports,o),s.l=!0,s.exports}o.m=e,o.c=n,o.d=function(e,n,t){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=659)}({659:function(e,n){const o={};let t;chrome.runtime.onConnect.addListener(e=>{let n,t;!function(e){return+e+""===e}(e.name)?(n=e.sender.tab.id,t="backend"):(n=e.name,t="devtools",function(e){chrome.tabs.executeScript(e,{file:"/build/proxy.js"},function(n){n?console.log("injected proxy to tab "+e):o[e].devtools.postMessage("proxy-fail")})}(+e.name)),o[n]||(o[n]={devtools:null,backend:null}),o[n][t]=e,o[n].devtools&&o[n].backend&&function(e,n,t){function s(n){if("log"===n.event)return console.log("tab "+e,n.payload);console.log("devtools -> backend",n),t.postMessage(n)}function c(o){if("log"===o.event)return console.log("tab "+e,o.payload);console.log("backend -> devtools",o),n.postMessage(o)}function r(){console.log("tab "+e+" disconnected."),n.onMessage.removeListener(s),t.onMessage.removeListener(c),n.disconnect(),t.disconnect(),o[e]=null}n.onMessage.addListener(s),t.onMessage.addListener(c),n.onDisconnect.addListener(r),t.onDisconnect.addListener(r),console.log("tab "+e+" connected.")}(n,o[n].devtools,o[n].backend)}),chrome.runtime.onMessage.addListener((e,n)=>{n.tab&&e.livewireDetected&&(chrome.browserAction.setIcon({tabId:n.tab.id,path:{16:"icons/1.png",48:"icons/48.png",128:"icons/128.png"}}),chrome.browserAction.setPopup({tabId:n.tab.id,popup:e.devtoolsEnabled?`popups/enabled${suffix}.html`:`popups/disabled${suffix}.html`}))}),chrome.tabs.onActivated.addListener(({tabId:e})=>{t=e}),chrome.contextMenus.onClicked.addListener((e,n)=>{chrome.runtime.sendMessage({vueContextMenu:{id:e.menuItemId}})})}});

I reopened Chrome and reloaded Kubutu. What can be the issue and how to fix it ?

Thanks!

Nov
27
1 month ago
Activity icon

Replied to I Got Contains Nonaggregated Column When Add 1 More Subquery

Yes, strange I check

SHOW VARIABLES;

and

select VERSION() 

both on my local and adding in dbfiddle and on : My local :

5.7.31-0ubuntu0.18.04.1
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

on dbfiddle:

5.7.32
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

database engine in my config/database.php is default :

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

Can it be the issue?

...

Nov
26
1 month ago
Activity icon

Started a new Conversation I Got Contains Nonaggregated Column When Add 1 More Subquery

Hello, In laravel 7 app I have request with several calc fields

        $forumThreads = ForumThread
            ::with('latestForumPost.creator')
            ->withCount('forumPosts')
            ->with('creator')
            ->getByForumId($forum_id)
            ->orderBy($order_by, $order_direction)
            ->offset($limit_start)
            ->take($forum_threads_per_page)
            ->addSelect([
                'forum_posts_viewed_sum' =>
                    ForumPost::query()
                       ->selectRaw('SUM(viewed)')
                       ->whereColumn('forum_thread_id', 'forum_threads.id'),
            ]) 
            ->get();

and it works for me ok and tracing I see several sql requests :

   SELECT SUM(viewed)     AS forum_posts_viewed_sum, `vfrm_forum_threads`.`forum_id`     AS `laravel_through_key` 
    FROM `vfrm_forum_posts` 
    INNER JOIN `vfrm_forum_threads` on `vfrm_forum_threads`.`id` = `vfrm_forum_posts`.`forum_thread_id` 
    WHERE `vfrm_forum_threads`.`forum_id` in (1) 
    GROUP BY `forum_id` 
  
  
   SELECT `vfrm_forum_threads`.*, (  SELECT count(*) 
    FROM `vfrm_forum_posts` 
    WHERE `vfrm_forum_threads`.`id` = `vfrm_forum_posts`.`forum_thread_id`)     AS `forum_posts_count`, (  SELECT SUM(viewed) 
    FROM `vfrm_forum_posts` 
    WHERE `forum_thread_id` = `vfrm_forum_threads`.`id`)     AS `forum_posts_viewed_sum` 
    FROM `vfrm_forum_threads` 
    WHERE `vfrm_forum_threads`.`forum_id` = '1' 
    ORDER BY `id` desc limit 20 offset 0 
  
  
   SELECT * 
    FROM `vfrm_forum_posts` 
    WHERE `vfrm_forum_posts`.`forum_thread_id` in (1, 2, 3, 12, 13, 14, 15, 16, 17, 18) 
    ORDER BY `created_at` desc 
  
  
   SELECT * 
    FROM `vfrm_users` 
    WHERE `vfrm_users`.`id` in (1, 2, 3, 4, 5, 6, 7, 8, 9) 
  
  
   SELECT * 
    FROM `vfrm_users` 
    WHERE `vfrm_users`.`id` in (1, 2, 3, 4, 5, 7, 9) 
  
  
   SELECT count(*)     AS aggregate 
    FROM `vfrm_forum_threads` 
    WHERE `vfrm_forum_threads`.`forum_id` = '1' 
  
  
   SELECT count(*)     AS aggregate 
    FROM `vfrm_forum_posts` 
    INNER JOIN `vfrm_forum_threads` on `vfrm_forum_threads`.`id` = `vfrm_forum_posts`.`forum_thread_id` 
    WHERE `vfrm_forum_threads`.`forum_id` = '1' 

But when I want to add 1 more calculable column is_salved_count:

        $forumThreads = ForumThread
            ::with('latestForumPost.creator')
            ->withCount('forumPosts')
            ->with('creator')
            ->getByForumId($forum_id)
            ->orderBy($order_by, $order_direction)
            ->offset($limit_start)
            ->take($forum_threads_per_page)
            ->addSelect([
                'forum_posts_viewed_sum' =>
                    ForumPost::query()
                       ->selectRaw('SUM(viewed)')
                       ->whereColumn('forum_thread_id', 'forum_threads.id'),
            ])
            ->addSelect([
                'is_salved_count' =>
                    ForumPost::query()
                       ->selectRaw('COUNT(is_salved)')
                       ->whereColumn('forum_thread_id', 'forum_threads.id')
                       ->where('is_salved', true)
//                        ->groupBy('forum_threads.id') // if to uncomment this line itdoes not work anyway
            ])
            ->get();

I got error:

[2020-11-24 07:41:08] local.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'yt3.vfrm_forum_threads.id'; this is incompatible with sql_mode=only_full_group_by (SQL: select `vfrm_forum_threads`.*, (select count(*) from `vfrm_forum_posts` where `vfrm_forum_threads`.`id` = `vfrm_forum_posts`.`forum_thread_id`) as `forum_posts_count`, (select SUM(viewed) from `vfrm_forum_posts` where `forum_thread_id` = `vfrm_forum_threads`.`id`) as `forum_posts_viewed_sum`, (select COUNT(is_salved) from `vfrm_forum_posts` where `forum_thread_id` = `vfrm_forum_threads`.`id` and `is_salved` = 1) as `is_salved_count` from `vfrm_forum_threads` where `vfrm_forum_threads`.`forum_id` = 1 order by `id` desc limit 20 offset 0) {"exception":"[object] (Illuminate\Database\QueryException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1140 In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'yt3.vfrm_forum_threads.id'; this is incompatible with sql_mode=only_full_group_by (SQL: select `vfrm_forum_threads`.*, (select count(*) from `vfrm_forum_posts` where `vfrm_forum_threads`.`id` = `vfrm_forum_posts`.`forum_thread_id`) as `forum_posts_count`, (select SUM(viewed) from `vfrm_forum_posts` where `forum_thread_id` = `vfrm_forum_threads`.`id`) as `forum_posts_viewed_sum`, (select COUNT(is_salved) from `vfrm_forum_posts` where `forum_thread_id` = `vfrm_forum_threads`.`id` and `is_salved` = 1) as `is_salved_count` from `vfrm_forum_threads` where `vfrm_forum_threads`.`forum_id` = 1 order by `id` desc limit 20 offset 0) at

I know about option

sql_mode=only_full_group_by 

but I do not like to use it. I wonder why error and how can I fix it?

Thanks!

Nov
24
1 month ago
Activity icon

Replied to How To Get Summary Of Related Table?

Thanks! It helped. The only thing : in debugging I see that data have rather complicated structure :

            [forum_posts_viewed_sum] => Array
                (
                    [0] => Array
                        (
                            [forum_thread_id] => 18
                            [forum_posts_viewed_sum] => 90
                        )

                )

and on client(I use vuejs) I have to use line like:

              {{ forumThread.forum_posts_viewed_sum[0].forum_posts_viewed_sum }}

If there is a way to shorten it?

Nov
23
1 month ago
Activity icon

Started a new Conversation How To Get Summary Of Related Table?

Hello, In laravel 7 app I have 2 related tables ForumThread:

        Schema::create('forum_threads', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            ...
            $table->integer('forum_id')->unsigned();
            $table->foreign('forum_id')->references('id')->on('forums')->onUpdate('RESTRICT')->onDelete('CASCADE');

        });

and ForumPost:

        Schema::create('forum_posts', function (Blueprint $table) {
            $table->bigIncrements('id')->unsigned();
            ...
            $table->integer('forum_thread_id')->unsigned();
            $table->foreign('forum_thread_id')->references('id')->on('forum_threads')->onUpdate('RESTRICT')->onDelete('CASCADE');
            ...
            $table->integer('viewed')->unsigned()->default(0);

        });

The last have field viewed and I need to calculate sum of viewed field of related forum_posts rows. I model app/ForumThread.php I addded forumPostsViewedSum method :

    public function forumPosts()
    {
        return $this->hasMany('App\ForumPost');
    }

    public function forumPostsViewedSum()
    {
        return $this->hasMany('App\ForumPost')
                    ->selectRaw('SUM(viewed) as forum_posts_viewed_sum')
                    ->groupBy('forum_thread_id');
//                    ->groupBy('forum_id');
    }

and in controller :

        $forumThreads = ForumThread
            ::with('latestForumPost.creator')
            ->withCount('forumPosts')
            ->with('creator')
            ->getByForumId($forum_id)
            ->orderBy($order_by, $order_direction)
            ->offset($limit_start)
            ->take($forum_threads_per_page)
            ->with('forumPostsViewedSum')
            ->get();
        \Log::info(varDump($forumThreads, '  get_forum_threads  -3 $forumThreads::'));

Looking at traced sql I see what I need

   SELECT * 
    FROM `vfrm_forum_posts` 
    WHERE `vfrm_forum_posts`.`forum_thread_id` in (2, 3) 
    ORDER BY `created_at` desc 
...  
  
  
   SELECT SUM(viewed)     AS forum_posts_viewed_sum 
    FROM `vfrm_forum_posts` 
    WHERE `vfrm_forum_posts`.`forum_thread_id` in (2, 3) 
    GROUP BY `forum_thread_id` 

Last request returns data I expect, but in returned data and in traced data(Log::info) I got empty array for forum_posts_viewed_sum field .

Why invalid data for forum_posts_viewed_sum and how can I do it?

Thanks!

Nov
18
2 months ago
Activity icon

Started a new Conversation How With Factory Create New Forum Post Items Only With 1 Is_best_decision = True For Any Thread?

Hello, In laravel 7 app I have 2 related tables ForumThread:

        Schema::create('forum_threads', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string('title', 255);
            $table->string('slug', 260)->unique();

            $table->integer('creator_id')->unsigned();
            $table->foreign('creator_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');

            $table->integer('forum_id')->unsigned();
            $table->foreign('forum_id')->references('id')->on('forums')->onUpdate('RESTRICT')->onDelete('CASCADE');

            $table->boolean('is_salved')->default(false);

            $table->integer('views')->unsigned()->default(0);
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable();
            $table->index(['created_at'], 'forum_threads_created_at_index');

            $table->index(['creator_id', 'title'], 'forum_threads_creator_id_title_index');
            $table->index(['forum_id', 'is_salved'], 'forum_threads_forum_id_is_salved_index');
        });

and ForumPost:

        Schema::create('forum_posts', function (Blueprint $table) {
            $table->bigIncrements('id')->unsigned();

            $table->mediumText('body');
            $table->boolean('is_best_decision')->default(false);

            $table->integer('user_id')->unsigned();
            $table->foreign('user_id')->references('id')->on('users')->onUpdate('RESTRICT')->onDelete('CASCADE');

            $table->integer('forum_thread_id')->unsigned();
            $table->foreign('forum_thread_id')->references('id')->on('forum_threads')->onUpdate('RESTRICT')->onDelete('CASCADE');

            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable();
            $table->index(['created_at'], 'forum_posts_created_at_index');
            $table->index(['user_id', 'is_best_decision'], 'threads_user_id_is_best_decision_index');

        });

any ForumThread can have many ForumPost and ForumThread is considered as salved if one of its ForumPost items have is_best_decision = true. In this case ForumThread.is_salved is set to true

I need to add new forum post items with this rule for some ForumThreads. some of them are left as not salved.

in seeder I do :

        $forumThreads = ForumThread
            ::orderBy('id', 'asc')
            ->get();

        foreach ($forumThreads as $nextForumThread) {
            $ForumPostParams= [
                'user_id'          => rand(1, 9),
                'is_best_decision' => (rand(1, 3) == 1) ? '1' : '0',
                'forum_thread_id'  => $nextForumThread->id
            ];
            factory(App\ForumPost::class, rand(1, 9))->create($ForumPostParams);
        } 

and in database/factories/ForumPostFactory.php :

$factory->define(ForumPost::class, function (Faker $faker, $parentParams) {
    return [ 
        'body' => $faker->paragraphs(rand(2, 8), true),
        'is_best_decision' => $parentParams['is_best_decision'],
        'user_id' => rand(1,9),
        'forum_thread_id' => $parentParams['forum_thread_id'],
    ];
});

and it works ok, the only thing I need only for forum posts with same forum_thread_id only 1 field is_best_decision can be true.

How can I do it?

Thanks!

Nov
13
2 months ago
Activity icon

Started a new Conversation Running Docker App I Got Error : _work: Read-only File System

Hello, I try to run my laravel 7 app docker under on my home laptop(Kubuntu 18) and got unexpected errors:

$ docker-compose up -d --build           
Building web
[WARNING]: Empty continuation line found in:
    RUN apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&   cd node    && git checkout v12.0.0   && ./configure   && make   && make install
[WARNING]: Empty continuation lines will become errors in a future release.
Step 1/8 : FROM php:7.3-apache
 ---> 20155fe4a974
Step 2/8 : RUN apt-get update &&     apt-get install -y     python     libfreetype6-dev     libwebp-dev     libjpeg62-turbo-dev     libpng-dev     libzip-dev     nano     mc     git-core     curl     build-essential     openssl     libssl-dev     libgmp-dev     libldap2-dev     netcat     locate     && git clone https://github.com/nodejs/node.git &&   cd node    && git checkout v12.0.0   && ./configure   && make   && make install
 ---> Using cache
 ---> 9aa258ef129f
Step 3/8 : RUN npm install cross-env
 ---> Using cache
 ---> 6439d3bf3413
Step 4/8 : RUN npm install -g yarn
 ---> Using cache
 ---> 74de2bcbbd9f
Step 5/8 : RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/
 ---> Using cache
 ---> d9558ab78615
Step 6/8 : RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
 ---> Using cache
 ---> efed7310658d
Step 7/8 : RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  && a2enmod rewrite
 ---> Using cache
 ---> 0d5aeb75837f
Step 8/8 : COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
 ---> Using cache
 ---> cfcf4aebb475

Successfully built cfcf4aebb475
Successfully tagged docker_web:latest
Starting hostels3_web ... 
Starting hostels3_composer ... 
Starting hostels3_web                                                                                                                                                                                                  
hostels3_db is up-to-date                                                                                                                                                                                              
Starting hostels3_composer                                                                                                                                                                                             
Starting hostels3_adminer ...                                                                                                                                                                                          
Starting hostels3_composer ... error
                                                                                                                                                                                                                       
Starting hostels3_adminer ... error
                                                                                                                                                                                                                       
Starting hostels3_web ... error
                                                                                                                                                                                                                       
ERROR: for hostels3_web  Cannot start service web: error while creating mount source path '/_work/wwwroot/lar/hostels3': mkdir /_work: read-only file system

ERROR: for web  Cannot start service web: error while creating mount source path '/_work/wwwroot/lar/hostels3': mkdir /_work: read-only file system

ERROR: for adminer  Cannot start service adminer: OCI runtime create failed: container with id exists: 6186b90cbab305276cc19ba24e7dd4d38408740e133889bd368db1fcc989431a: unknown

ERROR: for composer  Cannot start service composer: error while creating mount source path '/_work/wwwroot/lar/hostels3': mkdir /_work: read-only file system
ERROR: Encountered errors while bringing up the project.

I check :

$ docker info
Client:
 Debug Mode: false

Server:
 Containers: 6
  Running: 3
  Paused: 0
  Stopped: 3
 Images: 45
 Server Version: 19.03.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: 
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 4.15.0-121-generic
 Operating System: Ubuntu Core 16
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.711GiB
 Name: AtHome
 ID: 634A:HXQC:3CRK:RFFZ:X7IR:3V6W:23FQ:JD3B:ILAK:4ZI3:JSD7:A45D
 Docker Root Dir: /var/snap/docker/common/var-lib-docker                                                                                                                                                               
 Debug Mode: false                                                                                                                                                                                                     
 Registry: https://index.docker.io/v1/                                                                                                                                                                                 
 Labels:                                                                                                                                                                                                               
 Experimental: false                                                                                                                                                                                                   
 Insecure Registries:                                                                                                                                                                                                  
  127.0.0.0/8                                                                                                                                                                                                          
 Live Restore Enabled: false                                                                                                                                                                                           
                                                                                                                                                                                                                       
WARNING: No swap limit support                                                                                                                                                                                         
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
docker_web          latest              cfcf4aebb475        47 hours ago        2.07GB
adminer             latest              476c78d02a95        5 days ago          89.9MB
master_app          latest              7a3cd36c8bbc        4 weeks ago         5.72GB
php                 7.3-apache          20155fe4a974        5 weeks ago         410MB
mysql               5.7                 ef08065b0a30        2 months ago        448MB
composer            1.8                 3874930a8658        8 months ago        181MB
mysql               5.7.28              db39680b63ac        10 months ago       437MB
$ docker ps    
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                 NAMES
d0008034a6b0        mysql:5.7.28        "docker-entrypoint.s…"   6 weeks ago         Up 26 minutes       3306/tcp, 33060/tcp   hostels3_db

I reinstalled my Kubuntu 18 since I used this app under docker and in /etc/fstab I have :

/dev/sdb8 /mnt/_work_sdb8  ntfs-3g  defaults  0  0 
/dev/sda8 /mnt/Media_sda8 ntfs-3g  defaults  0  0  
/dev/sda6 /mnt/Work_sda6  ntfs-3g  defaults  0  0 

and I created link to my directory with command :

ln  -s   /mnt/_work_sdb8/   /_work

That is why in error /_work/wwwroot/lar/hostels3 is root path of the app ...

Dockerfile.yml :

FROM php:7.3-apache

RUN apt-get update && \
    apt-get install -y \
    python \
    libfreetype6-dev \
    libwebp-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    libzip-dev \
    nano \
    mc \
    git-core \

#    libmagickwand-dev --no-install-recommends && \
#    pecl install imagick && imagick && \
#    docker-php-ext-enable imagick && \

    curl \
    build-essential \
    openssl \
    libssl-dev \
    libgmp-dev \
    libldap2-dev \
    netcat \
    locate \
    # composer \
    && git clone https://github.com/nodejs/node.git && \
  cd node  \
  && git checkout v12.0.0 \
  && ./configure \
  && make \
  && make install

  RUN npm install cross-env

  RUN npm install -g yarn

  RUN  docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/  --with-jpeg-dir=/usr/include/


  # Install Composer
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

  RUN  docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif  \
&& a2enmod rewrite

  # RUN install-php-extensions imagick

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

Why this error and how it can be fixed?

Nov
12
2 months ago
Activity icon

Replied to I Search Lib Similar Vue-notifications For Vuejs3.

I got a hint :

need to store the Vue app as a variable: const app = createApp(App) and then use this instance to register the plugin: app.use(DKToast)

In file src/main.js I have such var:

const app = createApp(App)
app.use(store)
app.config.globalProperties.$store = store

app.use(router)
app.config.globalProperties.$router = router

const rootInstance = app.mount('#app')

But how can I import this var in src/views/test.vue file?

Nov
11
2 months ago
Activity icon

Replied to I Search Lib Similar Vue-notifications For Vuejs3.

I created a small file src/views/test.vue :

<template>
  <div>
  
    stringVar:{{ stringVar}}
  
  </div>
</template>

<script>
  import app from './../App.vue'
  import { ref, onMounted } from 'vue'
  import DKToast from 'vue-dk-toast'
  console.log('app::')
  console.log(app)
  
  app.use(DKToast)

  export default {
    name: 'testPage',
    components: {},

    setup () {
      let stringVar = ref('Init value')
      const testInit = async () => {
        console.log('testInit emitter::')
        // this.$toast('Simple!')
        this.$toast('Simple!', {
          duration: 1000,
          // Position not yet supported
          styles: {
            borderRadius: '25px'
          },
          // Any valid HTML, intended for icons
          slotLeft: '<i class="fa fa-user"></i>', // Add icon to left
          slotRight: '<i class="fa fa-thumbs-up"></i>' // Add icon to right
        })
      }

      onMounted(testInit)

      return {
        stringVar
      }
    } // setup () {

  }
</script>

and got error in console : https://imgur.com/a/IzV4Igo I suppose that I got invalid app, I show in in a printscreen above. ?

Activity icon

Replied to I Search Lib Similar Vue-notifications For Vuejs3.

Is it https://github.com/euvl/vue-notification ?Please, point where ompatible with vuejs3 is mentioned ? I read

:icecream: Vue.js 2 library for showing notifications

only...

Activity icon

Replied to I Search Lib Similar Vue-notifications For Vuejs3.

Thanks! Not in any of them I could found compatible with vuejs3. vue-toast-notification was modified several days ago but not compatible with vuejs3 mentioned

Activity icon

Started a new Conversation I Search Lib Similar Vue-notifications For Vuejs3.

Hello, I used https://github.com/se-panfilov/vue-notifications in vuejs 2 apps, and now search similar lib for vuejs3. Are there something similar, as looks vue-notifications vuejs3 is not compatible with vuejs3 ?

Thanks!

Nov
06
2 months ago
Activity icon

Replied to Install Vee-validate Under Vuejs3 I Got Error

Does it support old syntax? Or all must be rewritten , if I want to move my app from vuejs2 to 3?

Nov
05
2 months ago
Activity icon

Started a new Conversation Install Vee-validate Under Vuejs3 I Got Error

under vuejs3 I instaled vee-validate with adding line :

 "vee-validate": "^3.1.0" 

in package.json file and running command

 yarn

and

 yarn run serve

I got error in browser's console:

vee-validate.esm.js?7bb1:867 Uncaught TypeError: vue__WEBPACK_IMPORTED_MODULE_0__.default is not a constructor
    at eval (vee-validate.esm.js?7bb1:867)
    at Module../node_modules/vee-validate/dist/vee-validate.esm.js (chunk-vendors.js:3389)
    at __webpack_require__ (app.js:849)
    at fn (app.js:151)
    at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/components/auth/Login.vue?vue&type=script&lang=js:10)
    at Module../node_modules/cache-

looks like vee-validate 3 and vuejs 3 are not compatible? Which validation tools for vuejs 3 would you advice?

Thanks!

Oct
27
2 months ago
Activity icon

Started a new Conversation How To Revert Laravel App To State Before Pull?

Hello, In Laravel 6 application with git on bitbucket I have several branches and having current branchA I had to switch to branchB and make pull from the git and I run command

git pull  origin  feature/branchB

but seems I missed firstly to run command

git checkout feature/branchB

Now my app raise strange errors

Which is valid way to check current status of branchA with pulling from git and revert to prior state?

Thanks!

Oct
23
2 months ago
Activity icon

Replied to Create Vue Cli App I Got Error That File Or Directory 'config' Bot Found

I run with output :

$ yarn config get registry
https://registry.yarnpkg.com

It did not help. The same error. Also I see that to run command for creation a new app I have to run command again:

export PATH="$(yarn global bin):$PATH"

Looks like PATH are not saved after OS restart. Can this be issue?

Activity icon

Started a new Conversation Create Vue Cli App I Got Error That File Or Directory 'config' Bot Found

Hello, Trying to create vuejs app I got error that file or directory 'config' bot found:

$ npm -version
6.14.8
$ nodejs --version
v14.12.0

and setting PATH
$ export PATH="$(yarn global bin):$PATH"

$ yarn global add @vue/cli
yarn global v1.22.5

But creating new app with options selected :

❯ Default (Vue 3 Preview) ([Vue 3] babel, eslint) 
> Yarn :

I got error in th console :

Vue CLI v4.5.8
Failed to check for updates
✨  Creating project in /mnt/_work_sdb8/wwwroot/lar/VApps/v3y.
🗃  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

00h00m00s 0/0: :  ERROR  Error: Command failed: yarn config get npmRegistryServer
ERROR: [Errno 2] No such file or directory: 'config'


Error: Command failed: yarn config get npmRegistryServer
ERROR: [Errno 2] No such file or directory: 'config'


    at makeError (/home/serge/.config/yarn/global/node_modules/execa/index.js:174:9)
    at /home/serge/.config/yarn/global/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async PackageManager.getRegistry (/home/serge/.config/yarn/global/node_modules/@vue/cli/lib/util/ProjectPackageManager.js:194:21)
    at async PackageManager.setRegistryEnvs (/home/serge/.config/yarn/global/node_modules/@vue/cli/lib/util/ProjectPackageManager.js:235:22)
    at async PackageManager.runCommand (/home/serge/.config/yarn/global/node_modules/@vue/cli/lib/util/ProjectPackageManager.js:336:5)
    at async PackageManager.install (/home/serge/.config/yarn/global/node_modules/@vue/cli/lib/util/ProjectPackageManager.js:381:12)
    at async Creator.create (/home/serge/.config/yarn/global/node_modules/@vue/cli/lib/Creator.js:216:7)
    at async create (/home/serge/.config/yarn/global/node_modules/@vue/cli/lib/create.js:72:3)

Some wrong config in my Kubuntu 18? I reinstalled it about a month ago and could miss some options...

Thanks!

Oct
15
3 months ago
Activity icon

Started a new Conversation How In Adminer To Increase Current Session On Login?

Hi, Using adminer-4.7.7 with plugin login-password-less.php I found a way how to enter adminer without credentials entered. But entering adminer I would like to keep the current session as far as possible(including current db and table opened), even after browse closed/opened next day... Has adminer session time parameter/tools? That is for my home laptop ( kununtu18, apache 2, php 7.4), so security breaks are ignored... apache config decisions also possible.

How can I do it ?

Thanks!

Oct
08
3 months ago
Activity icon

Started a new Conversation How With Http-tests Make Tests On Ajax Event With Form Opened?

Hello, In laravel 6 / bootstrap 4 / jquery: 3.3.1 app I make http-tests with methods in https://laravel.com/docs/6.x/http-tests I need to make test on editor open event, which is triggered when operator clicks on button :

$.ajax({
    type: "GET",
    url: '/items/'+rowId+'/edit',
    data: {},
    success: function (data) {
        $("#h3_items_title_new").css("display", "none")
        $("#h3_items_title_edit").css("display", "block")
        $("#btn_item_cancel").css("display", "inline")

        $("#subject").val(data.item.subject)

        $("#created_at").val(data.item.created_at)
        $("#created_at").prop("readonly", true)
        $("#updated_at").val(data.item.updated_at)
        $("#updated_at").prop("readonly", true)

        $("#item_view_form").css("display", "none")
        $("#item_edit_form").css("display", "block")
            ...
    }
});

and item_edit_form block must be shown and item_view_form hidden. Can I make checks inside if item_edit_form block , say inputs are filled with valid values of the item? If yes, which methods have I to use ?

Thanks!

Oct
06
3 months ago
Activity icon

Started a new Conversation What For Are Your Numbers In Nexmo

Hello, Following Jeffrey lesson “Laravel From Scratch: Send SMS Notifications in 5 Minutes” ( https://laracasts.com/series/laravel-6-from-scratch/episodes/48 ) I created account at nexmo and entered Test Number. That is clear what is for : in dev mode that is enough to send sms to my own phone. But next it was proposed to open and fill “Your Numbers” : https://prnt.sc/utx273 I did not catch what is it for ? How thsese phones can be used in dev and in live mode?

Thanks!

Sep
27
3 months ago
Activity icon

Started a new Conversation How To Create Testing Database Under Docker?

Hello, In Kubuntu 18 I create docker for laravel 6 app with mysql defined :

  mysql:
    container_name: "vanilla-crm-db"
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: "MYSQL_ROOT_PASSWORD"
      MYSQL_DATABASE: "vanilla-crm-dev"
      MYSQL_USER: "MYSQL_USER"
      MYSQL_PASSWORD: "MYSQL_PASSWORD"
    ports:
      - "3330:3306"
    volumes:
      - "./docker/mysql/data:/var/lib/mysql"

and it works for me.

Next I make http tests and I need to create new database for this and load dump of my database in it. Name of this database is writen in config/database.php under 'mysql_testing' block

  1. I enter the bash with command :
docker-compose exec mysql bash

[email protected]:/# uname -a 
Linux f216ef80c104 4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020 x86_64 GNU/Linux

Where mysql is container_name in docker-compose.yml

Usually I enter mysql console with command:

mysql -u root -h localhost -p

But which must be format of this command in the docker console? I tried several ways and failed...

  1. I use DBeaver and logged into my database and tried to create new database for testing. I got error: https://prnt.sc/uol0z7

How to fix it ? Have I to add some more right my mysql container definitions?

Thanks!