DDSameera

Member Since 3 Months Ago

Kiribathgoda

Experience Points
6,970
Total
Experience

3,030 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
1
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 2
6,970 XP
Feb
28
1 day ago
Activity icon

Replied to Loop Row In Bootstrap Every 3 Columns

@chaudigv Good question. It 's TIP only

Feb
26
3 days ago
Activity icon

Started a new Conversation UTC Time Convert To Local One In Laravel 8

How can i convert following time into Sri Lanka time.

"recording_start" => "2021-02-26T03:49:20Z"
  "recording_end" => "2021-02-26T03:49:26Z"

I tried. this one not works

     $recordingStart = \Carbon\Carbon::parse($recordingStart)->toDateTimeString();
  $recordingStart = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $recordingStart, 'Asia/Colombo');
dd($recordingStart);
Feb
24
5 days ago
Activity icon

Replied to Unable To Locate A Class Or View For Component [jet-label].

No @guybrush_threepwood , i removed liveware ones. then i got this error

Activity icon

Started a new Conversation Unable To Locate A Class Or View For Component [jet-label].

When i try to run this code. php artisan view:cache , then i got following error. please help me to fix it.

C:\wamp64\www\lms>php artisan view:cache
Compiled views cleared!

   InvalidArgumentException 

  Unable to locate a class or view for component [jet-label].

  at C:\wamp64\www\lms\vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:275
    271▕         if ($viewFactory->exists($view = $this->guessViewName($component))) {
    272▕             return $view;
    273▕         }
    274▕
  ➜ 275▕         throw new InvalidArgumentException(
    276▕             "Unable to locate a class or view for component [{$component}]."
    277▕         );
    278▕     }
    279▕

  1   C:\wamp64\www\lms\vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:211
      Illuminate\View\Compilers\ComponentTagCompiler::componentClass("jet-label")

  2   C:\wamp64\www\lms\vendor\laravel\framework\src\Illuminate\View\Compilers\ComponentTagCompiler.php:196
      Illuminate\View\Compilers\ComponentTagCompiler::componentString("jet-label", ["'name'", "''.e(__('Token Name')).''"])



Activity icon

Started a new Conversation What Is Best Practice For Table Deleting ? OnDelete('restrict') Or OnDelete('null') Or OnDelete('cascade')

What is best practice for Table Deleting ? onDelete('restrict') or onDelete('null') or onDelete('cascade')

Please let me know your answer

Eg:


  Schema::connection($dbConnection)->create('course_user', function (Blueprint $table) {
            $table->id();

            $table->bigInteger('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('restrict')->onUpdate('restrict');

            $table->bigInteger('course_id')->unsigned()->index();
            $table->foreign('course_id')->references('id')->on('courses')->onDelete('restrict')->onUpdate('restrict');

            $table->timestamps();
        });
Feb
21
1 week ago
Activity icon

Started a new Conversation Loop Row In Bootstrap Every 3 Columns

Here is the way to create Bootstrap rows & columns using PHP language

Preview : https://snipboard.io/B23vxI.jpg

1st Method

 @for($i=1;$i<=12;$i++)

                    <!--Row Start-->
                        @if($colNo%3==0)
                            @php echo "<div class='row'>"; @endphp
                        @endif
                    <!--Row Start-->

                    <!--div Column Start-->
                        @php echo "<div class='col-4'>"; @endphp
                        @php echo $i; @endphp
                        @php echo "</div>"; @endphp
                    <!--div Column End-->

                    @php $colNo++;  @endphp

                    <!--Row End-->
                    @if($colNo%3==0)
                        @php echo "</div>"; @endphp
                    @endif
                    <!--Row End-->
                @endfor


2nd Method


                @foreach($backupFiles as $i=>$bf)


                        @if($colNo%3==0)
                            @php echo "<div class='row'>"; @endphp
                        @endif

                        @php echo "<div class='col-4'>"; @endphp
                        @php echo $i; @endphp
                        @php echo "</div>"; @endphp

                    @php $colNo++;  @endphp


                    @if($colNo%3==0)
                        @php echo "</div>"; @endphp
                    @endif
                  
                @endforeach

Activity icon

Started a new Conversation How To Customize Laravel Spatie Backup Notification Email ?

if there is any successful backup , i can get this email. https://snipboard.io/9XBl8A.jpg

I want to customize it . please help me !

https://spatie.be/docs/laravel-backup/v7/introduction

Activity icon

Awarded Best Reply on Address In Mailbox Given [] Does Not Comply With RFC 2822, 3.6.2.

Fixed it. Here is the solution.

I defined following values in .env file

[email protected]
MAIL_FROM_NAME="${APP_NAME}"
Activity icon

Replied to Address In Mailbox Given [] Does Not Comply With RFC 2822, 3.6.2.

Fixed it. Here is the solution.

I defined following values in .env file

[email protected]
MAIL_FROM_NAME="${APP_NAME}"
Activity icon

Started a new Conversation Address In Mailbox Given [] Does Not Comply With RFC 2822, 3.6.2.

This is regarding Laravel backup plugin of spatie https://spatie.be/docs/laravel-backup/v6/installation-and-setup

if backup fail, system should send email to user.

Please note: I test this in localhost environment. also i m using WAMP server for this .

When i run php artisan backup:run command , it gives the following error



Starting backup...
Backup failed because: Cannot create a dumper for db driver `mainDBB`. Use `mysql`, `pgsql`, `mongodb` or `sqlite`..

   Swift_RfcComplianceException 

  Address in mailbox given [] does not comply with RFC 2822, 3.6.2.

  at C:\wamp64\www\lms\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php:355
    351▕      */
    352▕     private function assertValidAddress($address)
    353▕     {
    354▕         if (!$this->emailValidator->isValid($address, new RFCValidation())) {
  ➜ 355▕             throw new Swift_RfcComplianceException('Address in mailbox given ['.$address.'] does not comply with RFC 2822, 3.6.2.');
    356▕         }
    357▕     }
    358▕ }
    359▕

  1   C:\wamp64\www\lms\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php:272
      Swift_Mime_Headers_MailboxHeader::assertValidAddress("")

  2   C:\wamp64\www\lms\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\Headers\MailboxHeader.php:117
      Swift_Mime_Headers_MailboxHeader::normalizeMailboxes(["LMS"])

Feb
02
3 weeks ago
Activity icon

Replied to Livewire Error - Composer Update

@jlrdw I removed liveware. from my project. i didn't use it . is that default package ?

Activity icon

Started a new Conversation Livewire Error - Composer Update

when i run composer update in Production Server , then it will gives following error.

https://snipboard.io/t56Y9I.jpg

Actually i never use this kind of laravel service.

here is my composer.json

How can i resolve this ?

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.4.1",
        "fideloper/proxy": "^4.2",
        "firebase/php-jwt": "^5.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^8.0",
        "laravel/sanctum": "^2.6",
        "laravel/tinker": "^2.0",
        "laravel/ui": "^3.1",
        "livewire/livewire": "^2.0",
        "spatie/laravel-activitylog": "^3.16",
        "spatie/laravel-csp": "^2.6",
        "spatie/laravel-permission": "^3.17",
        "yajra/laravel-datatables-oracle": "^9.13"
    },
    "require-dev": {
        "barryvdh/laravel-ide-helper": "^2.9",
        "facade/ignition": "^2.3.6",
        "fzaninotto/faker": "^1.9.1",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "^5.0",
        "phpunit/phpunit": "^9.3"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}


Jan
29
1 month ago
Activity icon

Replied to Set CSS Script For Specific Laravel Page

@xuuto , i want to handle extra styles in one location , without adding view tempates. is that possible to do that ?

Activity icon

Replied to Set CSS Script For Specific Laravel Page

@tykus . can't it manage inside of the layout ?

think if we have 100 view pages, then one by one adding is difficult.

can't we manage all specific css scripts in one location . ?

I read this solution. are there any good one than this ? https://stackoverflow.com/questions/41374816/different-stylesheet-for-different-pages-in-laravel

Normally i did it in this way

layout > inc > header.php

@php
    $currentUrl = Request()->getBaseUrl();
    $controllerWithAction = request()->route()->getAction();
    $controllerWithAction = $controllerWithAction['controller'];
    $controllerWithAction = str_replace('App\Http\Controllers\','',$controllerWithAction);

@endphp

......
@if ( $controllerWithAction === "[email protected]" )
    <!--Select2-->
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet"/>
        <!--Select2-->
@endif
Activity icon

Started a new Conversation Telescope Security Headers Errors

I installed SPATIE CSP Plugin .when i disable that , telescope is working fine. how could i resolve it .

https://snipboard.io/3CtxNo.jpg https://github.com/spatie/laravel-csp

policy.php

<?php

namespace App\Http\Policies;

use PhpParser\Node\Scalar\MagicConst\Dir;
use Spatie\Csp\Directive;
use Spatie\Csp\Keyword;
use Spatie\Csp\Policies\Basic;

class Extended extends Basic
{
    public function configure()
    {
        parent::configure();


        //Styles
        $this->addDirective(Directive::STYLE, [
            'cdnjs.cloudflare.com',
            'fonts.googleapis.com',
            'cdn.datatables.net',
            'cdn.jsdelivr.net',
            'fonts.googleapis.com',
            'maxcdn.bootstrapcdn.com',
            'stackpath.bootstrapcdn.com',
            '127.0.0.1',
            Keyword::SELF
        ]);

        //Fonts
        $this->addDirective(Directive::FONT, [
            'fonts.gstatic.com',
            'cdnjs.cloudflare.com',
            'fonts.googleapis.com',
            'maxcdn.bootstrapcdn.com',
            '127.0.0.1',
            Keyword::SELF

        ]);

        //Script
        $this->addDirective(Directive::SCRIPT, [
            'cdn.datatables.net',
            'cdn.jsdelivr.net',
            'cdnjs.cloudflare.com',
            'connect.facebook.net',
            'www.google.com',
            'www.gstatic.com',
            'unpkg.com',
            'googleads.g.doubleclick.net',
            'fonts.googleapis.com',
            'code.jquery.com',
            'maxcdn.bootstrapcdn.com',
            '127.0.0.1',

            keyword::UNSAFE_EVAL,
            Keyword::SELF

        ]);

        //Image
        $this->addDirective(Directive::IMG, [
            'cdn.datatables.net',
            'zoom.us',
            '*.zoom.us',
            Keyword::SELF,
            '127.0.0.1',
            'data:'

        ]);

        //iFrame
        $this->addDirective(Directive::FRAME, [
            'go.crisp.chat',
            'www.google.com',
            '*.zoom.us',
            '*.youtube.com',
            '127.0.0.1',
            '*.youtube-nocookie.com'

        ]);

        //Inline Styles,Script
        $this->addNonceForDirective(Directive::SCRIPT);
        $this->addNonceForDirective(Directive::STYLE);


    }
}


Activity icon

Replied to How To Save All DB Exceptions In Custom Error Log Of Laravel

Great ! @frankielee , thanks ,

Also i want to obeserve, client access paths.. eg: view dashboard, view messages. ,edit settings. like that

how to keep those entries

Activity icon

Started a new Conversation How To Save All DB Exceptions In Custom Error Log Of Laravel

I want to save all DB Exception errors in one custom error log .

Because i want to know the exact error messages in production environment.

how to do that ? please advise me .

Jan
28
1 month ago
Activity icon

Started a new Conversation How To Add "active" Class To Menu Item Via On Laravel Layout

I want to add "active" class to correct menu item, then menu will highlight correctly.

Like this https://snipboard.io/zLPgJQ.jpg

Could you please help me to give your idea ?

layout > sidebarlayout.blade.php

@hasanyrole('superadmin|admin|lecturer')
<div class="sidebar-heading">Subjects</div>
@endhasanyrole

@hasanyrole('student')
<div class="sidebar-heading">Student Functions</div>
@endhasanyrole

<div class="sidebar-block p-0">
    <ul class="sidebar-menu mt-0">

        @hasanyrole('superadmin|admin|lecturer|student')

        <li class="sidebar-menu-item">

            <a id="mainCategory" class="sidebar-menu-button" href="{{url('maincat/create')}}">
                                            <span class="sidebar-menu-icon sidebar-menu-icon--left">
                                                <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
                                                     xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 40 40"
                                                     width="22" height="22">
                                                    <g transform="matrix(1.6666666666666667,0,0,1.6666666666666667,0,0)">
                                                        <path
                                                            d="M23,14.5H1c-0.552,0-1,0.448-1,1V16c0,0.684,0.462,1.282,1.125,1.453C1.346,17.51,1.5,17.709,1.5,17.937V23 c0,0.552,0.448,1,1,1s1-0.448,1-1v-1c0-0.276,0.224-0.5,0.5-0.5h16c0.276,0,0.5,0.224,0.5,0.5v1c0,0.552,0.448,1,1,1s1-0.448,1-1 v-5.063c0-0.228,0.154-0.427,0.375-0.484C23.538,17.282,24,16.684,24,16v-0.5C24,14.948,23.552,14.5,23,14.5z M20.5,19 c0,0.276-0.224,0.5-0.5,0.5H4c-0.276,0-0.5-0.224-0.5-0.5v-1c0-0.276,0.224-0.5,0.5-0.5h16c0.276,0,0.5,0.224,0.5,0.5V19z M7.522,5.717l0.75,0.385c0.143,0.073,0.313,0.073,0.456,0l0.75-0.385C9.645,5.631,9.75,5.46,9.75,5.272V4.334 c0-0.189-0.107-0.362-0.276-0.447l-0.75-0.375c-0.141-0.071-0.307-0.071-0.448,0l-0.75,0.375C7.357,3.972,7.25,4.145,7.25,4.334 v0.938C7.25,5.46,7.355,5.631,7.522,5.717z M14.522,9.217l0.75,0.385c0.143,0.073,0.313,0.073,0.456,0l0.75-0.385 c0.167-0.086,0.272-0.257,0.272-0.445V7.834c0-0.189-0.107-0.362-0.276-0.447l-0.75-0.375c-0.141-0.071-0.307-0.071-0.448,0 l-0.75,0.375c-0.169,0.085-0.276,0.258-0.276,0.447v0.938C14.25,8.96,14.355,9.131,14.522,9.217z M2.5,13h19 c0.276,0,0.5-0.224,0.5-0.5v-11C22,0.672,21.328,0,20.5,0h-17C2.672,0,2,0.672,2,1.5v11C2,12.776,2.224,13,2.5,13z M5.75,3.871 C5.749,3.397,6.017,2.964,6.441,2.753L7.941,2c0.352-0.175,0.766-0.175,1.118,0l1.5,0.75c0.424,0.211,0.692,0.644,0.691,1.118v1.4 c0,0.188,0.106,0.36,0.273,0.445l1.275,0.649c0.162,0.082,0.355,0.07,0.505-0.031c0.107-0.071,0.118-0.068,1.171-0.6 c0.169-0.085,0.276-0.258,0.276-0.447V3.5c0-0.414,0.336-0.75,0.75-0.75c0.414,0,0.75,0.336,0.75,0.75v1.79 c0,0.189,0.107,0.362,0.276,0.447l1.033,0.516c0.424,0.211,0.692,0.644,0.691,1.118V9.23c0.001,0.469-0.262,0.899-0.68,1.112 l-1.5,0.77c-0.358,0.184-0.784,0.184-1.142,0l-1.5-0.77c-0.417-0.213-0.68-0.643-0.678-1.112v-0.9c0-0.188-0.106-0.36-0.273-0.445 l-1.748-0.889c-0.143-0.073-0.312-0.073-0.455,0L9.522,7.383C9.355,7.468,9.25,7.64,9.25,7.827v2.237c0,0.414-0.336,0.75-0.75,0.75 s-0.75-0.336-0.75-0.75V7.825c0-0.187-0.105-0.359-0.272-0.444L6.429,6.842C6.011,6.629,5.749,6.199,5.75,5.73V3.871z"
                                                            stroke="none" fill="currentColor" stroke-width="0"
                                                            stroke-linecap="round" stroke-linejoin="round"></path>
                                                    </g>
                                                </svg>
                                            </span>
                <span class="sidebar-menu-text">Main Categories </span>

            </a>
        </li>


        @endhasanyrole

        @hasanyrole('superadmin|admin|lecturer|student')
        <li class="sidebar-menu-item">
            <a class="sidebar-menu-button" href="{{url('subcat/create')}}">
                <i class="sidebar-menu-icon sidebar-menu-icon--left material-icons">tab</i>
                <span class="sidebar-menu-text">Sub Categories</span>
            </a>
        </li>

        @endhasanyrole


        @hasanyrole('superadmin|admin')
    </ul>
    <ul class="sidebar-menu mt-0">
        <div class="sidebar-heading">Users</div>
        <li class="sidebar-menu-item">
            <a class="sidebar-menu-button" href="{{url('user/create')}}">
                                            <span class="sidebar-menu-icon sidebar-menu-icon--left material-icons">
                                                <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
                                                     xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 40 40"
                                                     width="22" height="22">
                                                    <g transform="matrix(1.6666666666666667,0,0,1.6666666666666667,0,0)">
                                                        <path
                                                            d="M0.5,13.985h3c0.276,0,0.5-0.224,0.5-0.5C3.95,11.87,3.532,10.289,2.778,8.86C2.76,8.825,2.75,8.786,2.75,8.746V5.205 c0-0.414-0.336-0.75-0.75-0.75s-0.75,0.336-0.75,0.75v3.541c0,0.04-0.009,0.079-0.027,0.114C0.468,10.288,0.05,11.87,0,13.485 C0,13.761,0.224,13.985,0.5,13.985z M21.187,20.271l-0.017-0.006l-4.97-1.647c-0.175-0.057-0.367-0.013-0.5,0.114l-3.357,3.231 c-0.193,0.185-0.498,0.185-0.691,0l-3.4-3.218c-0.133-0.126-0.325-0.169-0.5-0.112l-4.938,1.638 c-1.381,0.511-2.426,1.663-2.8,3.087c-0.07,0.267,0.09,0.54,0.357,0.611c0.041,0.011,0.084,0.016,0.126,0.016h23 c0.276,0,0.5-0.225,0.499-0.501c0-0.042-0.005-0.084-0.016-0.125C23.608,21.936,22.566,20.783,21.187,20.271z M23.586,1.993 L12.429,0.052c-0.284-0.049-0.574-0.049-0.858,0L0.414,1.993C0.142,2.041-0.04,2.3,0.008,2.572c0.036,0.207,0.199,0.37,0.406,0.406 l11.157,1.94c0.284,0.051,0.574,0.051,0.858,0l11.157-1.94c0.272-0.048,0.454-0.307,0.406-0.579 C23.956,2.192,23.793,2.029,23.586,1.993z M18.458,5.393l-6.115,1.063c-0.227,0.039-0.458,0.039-0.685,0L5.543,5.393 C5.407,5.369,5.277,5.46,5.254,5.596C5.251,5.61,5.25,5.625,5.25,5.639V10c0,0.061-0.022,0.12-0.063,0.166 c-0.336,0.408-0.506,0.927-0.476,1.455C4.7,12.634,5.252,13.57,6.144,14.05l0.151,0.192c0.51,3.047,4.02,4.99,5.686,4.99 s5.175-1.943,5.685-4.989l0.151-0.192c0.891-0.482,1.443-1.417,1.433-2.43c0.026-0.507-0.131-1.006-0.442-1.407 c-0.037-0.045-0.058-0.101-0.058-0.159V5.639c0-0.138-0.111-0.249-0.248-0.25C18.487,5.389,18.472,5.39,18.458,5.393z M17.192,12.693c-0.53,0.242-0.904,0.732-1,1.306c-0.377,2.249-3.174,3.739-4.207,3.739S8.15,16.246,7.773,14 c-0.096-0.574-0.471-1.063-1-1.306C6.41,12.45,6.198,12.037,6.21,11.6c-0.02-0.152,0.016-0.305,0.1-0.433 c0.266-0.121,0.437-0.386,0.438-0.678V8.548c0-0.079,0.037-0.153,0.1-0.2c0.061-0.047,0.141-0.063,0.216-0.044 C8.675,8.73,10.334,8.948,12,8.952c1.667-0.003,3.326-0.22,4.937-0.646c0.134-0.035,0.27,0.045,0.305,0.179 c0.005,0.021,0.008,0.042,0.008,0.063v1.821c-0.055,0.321,0.105,0.639,0.395,0.787c0.089,0.128,0.126,0.285,0.105,0.44 c0.014,0.436-0.197,0.85-0.558,1.095V12.693z M12.939,14.306c-0.076,0.041-0.155,0.074-0.237,0.1 c-0.187,0.055-0.38,0.082-0.575,0.081l0,0c-0.196,0.001-0.392-0.026-0.58-0.082c-0.082-0.026-0.162-0.059-0.238-0.1 c-0.365-0.196-0.82-0.06-1.016,0.305c-0.196,0.365-0.06,0.82,0.305,1.016l0,0c0.162,0.087,0.333,0.157,0.51,0.21 c0.33,0.099,0.673,0.15,1.017,0.149h0.007c0.343,0.002,0.685-0.048,1.014-0.147c0.177-0.054,0.348-0.125,0.511-0.212 c0.367-0.192,0.509-0.645,0.317-1.012s-0.645-0.509-1.012-0.317c-0.006,0.003-0.012,0.007-0.019,0.01L12.939,14.306z M11.189,12 c0.277-0.308,0.253-0.782-0.055-1.059c-0.769-0.62-1.867-0.62-2.636,0c-0.293,0.293-0.292,0.768,0.001,1.061 c0.271,0.27,0.701,0.294,0.999,0.054c0.195-0.111,0.433-0.111,0.628,0c0.307,0.278,0.781,0.255,1.059-0.052 C11.187,12.003,11.188,12.001,11.189,12z M13.064,10.945c-0.293,0.293-0.292,0.768,0.001,1.061c0.271,0.27,0.701,0.294,0.999,0.054 c0.195-0.111,0.433-0.111,0.628,0c0.293,0.293,0.768,0.293,1.061,0.001c0.293-0.293,0.293-0.768,0.001-1.061 c-0.019-0.019-0.04-0.038-0.061-0.055C14.924,10.329,13.832,10.329,13.064,10.945z"
                                                            stroke="none" fill="currentColor" stroke-width="0"
                                                            stroke-linecap="round" stroke-linejoin="round"></path>
                                                    </g>
                                                </svg>
                                            </span>
                <span class="sidebar-menu-text">Users</span>
            </a>
        </li>
        @endhasanyrole


        @hasanyrole('superadmin|admin')
        <li class="sidebar-menu-item">
            <a class="sidebar-menu-button" href="{{url('previlage/create')}}">
                <i class="sidebar-menu-icon sidebar-menu-icon--left material-icons">control_point</i>

                <span class="sidebar-menu-text">

                Assign Role
                </span>

            </a>
        </li>

        @endhasanyrole


        @hasanyrole('admin|superadmin')
        <li class="sidebar-menu-item">
            <a class="sidebar-menu-button" href="{{url('permission?roleid=1')}}">
                <i class="sidebar-menu-icon sidebar-menu-icon--left material-icons">vpn_key</i>

                <span class="sidebar-menu-text">

                Permissions
                </span>

            </a>
        </li>
        @endhasanyrole
    </ul>
</div>

<div class="sidebar-heading">Meetings</div>

<div class="sidebar-block p-0">
    <ul class="sidebar-menu mt-0">
        @php
            $isZoomLicensedUser = (config('app.zoom_settings.license_type')=== "pro");
        @endphp
        @if($isZoomLicensedUser)
            @hasanyrole('superadmin|admin')
            <li class="sidebar-menu-item ">


                <a class="sidebar-menu-button" href="{{url('userenrollment/create')}}">
                <span class="sidebar-menu-icon sidebar-menu-icon--left">
                                                <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
                                                     xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 40 40"
                                                     width="22" height="22">
                                                    <g transform="matrix(1.6666666666666667,0,0,1.6666666666666667,0,0)">
                                                        <path
                                                            d="M12.631,11.158c0.109-0.084,0.13-0.241,0.046-0.351c-0.028-0.037-0.066-0.065-0.11-0.081 c-0.339-0.128-0.694-0.26-1.069-0.4l-0.628-0.23c-0.075-0.088-0.123-0.196-0.138-0.311c-0.092-0.431-0.072-0.879,0.058-1.3 c1.076-1.166,1.609-2.733,1.466-4.314C12.256,1.756,10.677,0,8.5,0S4.744,1.756,4.744,4.174C4.602,5.748,5.131,7.308,6.2,8.471 C6.344,8.895,6.369,9.35,6.273,9.787c-0.015,0.114-0.062,0.221-0.135,0.309l-0.631,0.232c-2.447,0.9-4.215,1.55-4.754,2.626 C0.269,14.074,0.013,15.28,0,16.5C0,16.776,0.224,17,0.5,17h8.794c0.129,0,0.237-0.099,0.249-0.227 C9.745,14.553,10.864,12.518,12.631,11.158z M17.5,11c-3.59,0-6.5,2.91-6.5,6.5s2.91,6.5,6.5,6.5s6.5-2.91,6.5-6.5 C23.996,13.912,21.088,11.004,17.5,11z M22,17.5c0,0.552-0.448,1-1,1h-2c-0.276,0-0.5,0.224-0.5,0.5v2c0,0.552-0.448,1-1,1 s-1-0.448-1-1v-2c0-0.276-0.224-0.5-0.5-0.5h-2c-0.552,0-1-0.448-1-1s0.448-1,1-1h2c0.276,0,0.5-0.224,0.5-0.5v-2 c0-0.552,0.448-1,1-1s1,0.448,1,1v2c0,0.276,0.224,0.5,0.5,0.5h2C21.552,16.5,22,16.948,22,17.5z"
                                                            stroke="none" fill="currentColor" stroke-width="0"
                                                            stroke-linecap="round" stroke-linejoin="round"></path>
                                                    </g>
                                                </svg>
                                            </span>
                    <span class="sidebar-menu-text">User Enrollment</span>

                </a>
            </li>
            @endhasanyrole
        @endif

        @hasanyrole('superadmin|admin|lecturer|student')
        <li class="sidebar-menu-item ">
            <a class="sidebar-menu-button" href="{{url('meeting/create')}}">
                                            <span class="sidebar-menu-icon sidebar-menu-icon--left">
                                                <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
                                                     xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 40 40"
                                                     width="22" height="22">
                                                    <g transform="matrix(1.6666666666666667,0,0,1.6666666666666667,0,0)">
                                                        <path
                                                            d="M12.619,8.412c-0.001-0.41-0.333-0.742-0.743-0.742H5.938c-0.41,0.015-0.73,0.36-0.715,0.77 c0.014,0.389,0.326,0.701,0.715,0.715h5.938C12.286,9.155,12.619,8.822,12.619,8.412L12.619,8.412z M9.586,19 c-0.02-0.115-0.119-0.199-0.236-0.2H3.464c-0.276,0-0.5-0.224-0.5-0.5V5.443c0.003-0.274,0.226-0.495,0.5-0.495h10.887 c0.272,0.003,0.491,0.223,0.494,0.495v4.039c-0.002,0.135,0.106,0.245,0.241,0.247c0.018,0,0.037-0.002,0.054-0.005 c0.807-0.152,1.623-0.249,2.443-0.29c0.131-0.007,0.232-0.116,0.231-0.247V3.464c0.001-0.82-0.663-1.484-1.483-1.485 c0,0-0.001,0-0.001,0h-3.957c-0.085,0-0.163-0.046-0.205-0.119C11.103,0.059,8.78-0.537,6.979,0.528 C6.43,0.853,5.972,1.311,5.647,1.86c-0.042,0.073-0.12,0.118-0.205,0.119H1.485C0.665,1.979,0,2.644,0,3.464c0,0,0,0,0,0v16.825 c0.001,0.82,0.665,1.484,1.485,1.484h8.847c0.135,0,0.244-0.109,0.244-0.244c0-0.046-0.013-0.092-0.038-0.131 C10.091,20.657,9.769,19.846,9.586,19z M11.035,12.523c0.286-0.376,0.604-0.726,0.951-1.046c0.085-0.079,0.028-0.343-0.11-0.343 H5.938c-0.41,0.015-0.73,0.36-0.715,0.77c0.014,0.389,0.326,0.701,0.715,0.715h4.907C10.92,12.619,10.99,12.583,11.035,12.523z M5.938,14.6c-0.41,0-0.742,0.331-0.743,0.741c0,0.41,0.331,0.742,0.741,0.743c0,0,0.001,0,0.001,0h3.37 c0.117,0,0.216-0.085,0.235-0.2c0.061-0.337,0.145-0.669,0.251-0.995c0.032-0.1,0.055-0.29-0.129-0.29L5.938,14.6z M17.32,10.639 c-3.69-0.001-6.681,2.99-6.682,6.68s2.99,6.681,6.68,6.682c3.69,0.001,6.681-2.99,6.682-6.68c0,0,0-0.001,0-0.001 C23.996,13.632,21.008,10.643,17.32,10.639z M17.32,22.021c-2.596,0-4.7-2.104-4.7-4.7s2.104-4.7,4.7-4.7s4.7,2.104,4.7,4.7 C22.017,19.915,19.914,22.018,17.32,22.021z M19.3,16.33h-0.742c-0.137,0-0.248-0.111-0.248-0.248v-1.237 c-0.017-0.546-0.474-0.975-1.021-0.958c-0.522,0.017-0.941,0.436-0.958,0.958v2.475c0,0.546,0.443,0.989,0.989,0.989 c0,0,0.001,0,0.001,0H19.3c0.546,0.017,1.004-0.412,1.021-0.958s-0.412-1.004-0.958-1.021C19.342,16.329,19.321,16.329,19.3,16.33z"
                                                            stroke="none" fill="currentColor" stroke-width="0"
                                                            stroke-linecap="round" stroke-linejoin="round"></path>
                                                    </g>
                                                </svg>
                                            </span>
                <span class="sidebar-menu-text">Meetings</span>
            </a>

        </li>
        @endhasanyrole


    </ul>
</div>
<div class="sidebar-heading">Courses</div>
<div class="sidebar-block p-0">
    <ul class="sidebar-menu mt-0">
        @hasanyrole('superadmin|admin|lecturer')
        <li class="sidebar-menu-item ">

            <a class="sidebar-menu-button" href="{{url('course/create')}}">
                                            <span class="sidebar-menu-icon sidebar-menu-icon--left">
                                                <svg xmlns="http://www.w3.org/2000/svg" version="1.1"
                                                     xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 40 40"
                                                     width="22" height="22">
                                                    <g transform="matrix(1.6666666666666667,0,0,1.6666666666666667,0,0)">
                                                        <path
                                                            d="M2.5,16C2.224,16,2,15.776,2,15.5v-11C2,4.224,2.224,4,2.5,4h14.625c0.276,0,0.5,0.224,0.5,0.5V8c0,0.552,0.448,1,1,1 s1-0.448,1-1V4c0-1.105-0.895-2-2-2H2C0.895,2,0,2.895,0,4v12c0,1.105,0.895,2,2,2h5.375c0.138,0,0.25,0.112,0.25,0.25v1.5 c0,0.138-0.112,0.25-0.25,0.25H5c-0.552,0-1,0.448-1,1s0.448,1,1,1h7.625c0.552,0,1-0.448,1-1s-0.448-1-1-1h-2.75 c-0.138,0-0.25-0.112-0.25-0.25v-1.524c0-0.119,0.084-0.221,0.2-0.245c0.541-0.11,0.891-0.638,0.781-1.179 c-0.095-0.466-0.505-0.801-0.981-0.801L2.5,16z M3.47,9.971c-0.303,0.282-0.32,0.757-0.037,1.06c0.282,0.303,0.757,0.32,1.06,0.037 c0.013-0.012,0.025-0.025,0.037-0.037l2-2c0.293-0.292,0.293-0.767,0.001-1.059c0,0-0.001-0.001-0.001-0.001l-2-2 c-0.282-0.303-0.757-0.32-1.06-0.037s-0.32,0.757-0.037,1.06C3.445,7.006,3.457,7.019,3.47,7.031l1.293,1.293 c0.097,0.098,0.097,0.256,0,0.354L3.47,9.971z M7,11.751h2.125c0.414,0,0.75-0.336,0.75-0.75s-0.336-0.75-0.75-0.75H7 c-0.414,0-0.75,0.336-0.75,0.75S6.586,11.751,7,11.751z M18.25,16.5c0,0.276-0.224,0.5-0.5,0.5s-0.5-0.224-0.5-0.5v-5.226 c0-0.174-0.091-0.335-0.239-0.426c-1.282-0.702-2.716-1.08-4.177-1.1c-0.662-0.029-1.223,0.484-1.252,1.146 c-0.001,0.018-0.001,0.036-0.001,0.054v7.279c0,0.646,0.511,1.176,1.156,1.2c1.647-0.011,3.246,0.552,4.523,1.593 c0.14,0.14,0.33,0.219,0.528,0.218c0.198,0.001,0.388-0.076,0.529-0.215c1.277-1.044,2.878-1.61,4.527-1.6 c0.641-0.023,1.15-0.547,1.156-1.188v-7.279c-0.001-0.327-0.134-0.64-0.369-0.867c-0.236-0.231-0.557-0.353-0.886-0.337 c-1.496,0.016-2.963,0.411-4.265,1.148c-0.143,0.092-0.23,0.251-0.23,0.421V16.5z"
                                                            stroke="none" fill="currentColor" stroke-width="0"
                                                            stroke-linecap="round" stroke-linejoin="round"></path>
                                                    </g>
                                                </svg>
                                            </span>
                <span class="sidebar-menu-text">Courses</span>
            </a>


        </li>

        @endhasanyrole

    </ul>
</div>
@hasanyrole('superadmin|admin')
<div class="sidebar-heading">Payments</div>
<div class="sidebar-block p-0">
    <ul class="sidebar-menu mt-0">
        @php
            $invoiceStatus = request()->get('status');
        @endphp
        <li class="sidebar-menu-item ">
            <a class="sidebar-menu-button" href="{{url('invoice?status=all')}}">
                 <span class="sidebar-menu-icon sidebar-menu-icon--left">
                      <i class="fa fa-file-invoice" aria-hidden="true"></i>
                 </span>
                <span class="sidebar-menu-text">Invoices</span>
            </a>

        </li>

    </ul>
</div>
@endhasanyrole


@hasanyrole('superadmin|admin')
<div class="sidebar-heading">Settings</div>
<div class="sidebar-block p-0">
    <ul class="sidebar-menu mt-0">
        <li class="sidebar-menu-item">
            <a class="sidebar-menu-button" href="{{url('settings')}}">
                 <span class="sidebar-menu-icon sidebar-menu-icon--left">
                      <i class="fa fa-wrench" aria-hidden="true"></i>
                 </span>
                <span class="sidebar-menu-text">Global Settings</span>
            </a>

        </li>
    </ul>
    <ul class="sidebar-menu mt-0">
        <li class="sidebar-menu-item">
            <a class="sidebar-menu-button" href="{{url('log')}}">
                 <span class="sidebar-menu-icon sidebar-menu-icon--left">
                      <i class="fa fa-history" aria-hidden="true"></i>
                 </span>
                <span class="sidebar-menu-text">System Logs</span>
            </a>

        </li>
    </ul>
</div>
@endhasanyrole

@hasanyrole('superadmin|admin|lecturer|student')
<div class="sidebar-heading">Help & Troubleshoot</div>
<ul class="sidebar-menu mt-0">
    <li class="sidebar-menu-item ">
        <a class="sidebar-menu-button" href="{{url('support')}}">
                 <span class="sidebar-menu-icon sidebar-menu-icon--left">
                      <i class="fa fa-comment-alt" aria-hidden="true"></i>
                 </span>
            <span class="sidebar-menu-text">Live Chat &nbsp;<span class="badge badge-success">Staff</span></span>
        </a>

    </li>

</ul>


@endhasanyrole



Activity icon

Replied to Set CSS Script For Specific Laravel Page

Eg: There is new view called "resources/view/user.blade.php" so i want to apply one CSS script (css/style-user.css) for that through the layout file. how can i do that

Activity icon

Replied to Set CSS Script For Specific Laravel Page

@tykus ,how could we control this using condition ?

Eg : i want to load style-user.css for user page only . how can i do that ?

Activity icon

Replied to Auth:user() Returns NULL In 404 Page

@tykus , when i run this code ., it gives this error message on 404 page , it works fine with other pages


            $controllerWithAction = request()->route()->getActionName();

Error

Error
Call to a member function getActionName() on null (View: C:\wamp64\www\lms\resources\views\layouts\inc\sidebar.blade.php)
Activity icon

Started a new Conversation Set CSS Script For Specific Laravel Page

I want to add PAGE SPECIFIC custom CSS and JS to the page.

It means, that JS,CSS only for that specific resource views.

Here is my solution .but its really lengthy code. please suggest me good way.



@if(!empty(request()->route()))


    @php

        $currentUrl = Request()->getBaseUrl();
        $controllerWithAction = request()->route()->getAction();
        $controllerWithAction = $controllerWithAction['controller'];
        $controllerWithAction = str_replace('App\Http\Controllers\','',$controllerWithAction);


    @endphp

    @if ( $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]"  )
        <!--Select2-->
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet"/>
        <!--Select2-->
    @endif

    @if ( $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction === "[email protected]" || $controllerWithAction==="[email protected]")
        <!--Flatpickr-->
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">

        <!--FullCalender-->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.css"/>
    @endif
@endif

Activity icon

Replied to Datatable Plugin 1000 Records Slow.

Thanks @jlrdw . appreciate your support !!!!

Activity icon

Started a new Conversation Auth:user() Returns NULL In 404 Page

Auth User return NULL in 404 page

  $user = Auth::user();
dd($user);

kernal.php

<?php

namespace App\Http;


use App\Http\Middleware\CheckUserStatus;
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\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
            \Spatie\Csp\AddCspHeaders::class

        ],

        'api' => [
            'throttle:api',
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
    ];


    protected $routeMiddleware = [
        '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,
        'checkLecturer' => \App\Http\Middleware\CheckLecturer::class,
        'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
        'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
        'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
        'check_default_password_change' => \App\Http\Middleware\CheckDefaultPasswordChange::class,
        'check_zoom_license_type' => \App\Http\Middleware\CheckZoomLicenseType::class,
        'check_system_status' => \App\Http\Middleware\CheckSystemStatus::class

    ];
}

resources / views /errors/ 404.blade.php

@extends('layouts.admin')

@section('content')


    <div class="row no-gutters">
        <div class="col-lg-12 card-body">
            <div class="text-left">
                <div class="alert alert-warning align-items-center m-0" role="alert">
                    <span class="display-1 d-block">404</span>
                    <div class="mb-4 lead">
                        <i class="fas fa-warning"></i>
                        <strong>{{ (isset($customMessage) ? $customMessage: "") }}</strong>
                    </div>
                </div>
            </div>

        </div>


    </div>




@endsection







App/Exceptions/Handler.php

<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Support\Facades\Auth;
use Throwable;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that are not reported.
     *
     * @var array
     */
    protected $dontReport = [
        //
    ];

    /**
     * A list of the inputs that are never flashed for validation exceptions.
     *
     * @var array
     */
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];

    /**
     * Register the exception handling callbacks for the application.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    public function render($request, Throwable $exception)
    {
        if ($this->isHttpException($exception)) {


            $data = [
                'customMessage' => $exception->getMessage(),
                'user' => Auth::user()
            ];

          var_dump($data);

            if ($exception->getStatusCode() == 404) {
                return response()->view('errors.' . '404', $data, 404);
            }

            if ($exception->getStatusCode() == 419) {
                return response()->view('errors.' . '419', $data, 419);
            }

            if ($exception->getStatusCode() == 403) {
                return response()->view('errors.' . '403', $data, 403);
            }

            return response()->view('errors.' . '404', [], 404);
        }

        return parent::render($request, $exception);
    }
}

Activity icon

Started a new Conversation Many To Many Table Name

I followed all naming convention of laravel. Now i got the problem.

when i run this code , it gives error. Please help me to build up BEST practice well coded environment.

Please note : laravel naming convention shows the "meeting_user" is correct one . https://stackoverflow.com/questions/37403161/laravel-eloquent-relationship-many-to-many-naming-convention

   $meeting = MeetingUser::where("meeting_id", '=', $meetingId)
                ->where("user_id", '=', $userId)
                ->get();
exception: "Illuminate\Database\QueryException"
file: "C:\wamp64\www\lms\vendor\laravel\framework\src\Illuminate\Database\Connection.php"
line: 678
message: "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lms.meeting_users' doesn't exist (SQL: select * from `meeting_users` whe

When i modify my model. then it works. I want to know that , why default one gives me the error.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;

class MeetingUser extends Model
{
   public $table = "meeting_user";
   ......
}

Jan
26
1 month ago
Activity icon

Awarded Best Reply on Datatable Plugin 1000 Records Slow.

I passed full object without using get() method. then problem fixed

IN-CORRECT

 $courses = Course::orderBy('id', 'desc')->get()

CORRECT

 $courses = Course::orderBy('id', 'desc');
Activity icon

Replied to Datatable Plugin 1000 Records Slow.

I passed full object without using get() method. then problem fixed

IN-CORRECT

 $courses = Course::orderBy('id', 'desc')->get()

CORRECT

 $courses = Course::orderBy('id', 'desc');
Activity icon

Replied to Datatable Plugin 1000 Records Slow.

@guybrush_threepwood , good point . thanks

I found main issue. when i click my pagination number, All Data load to the client side. actually i want to load only 10 records per page . if click "page 2" then it sholud be load another 10 data set from server side.

Simply says , "How to limit results per page in Yajra datatables" ? from server side.

This one is correct. but it doesn't load other pagination numbers

  if ($request->ajax()) {
            $limit = request('length');
            $start = request('start');
            $end = $start + $limit;

            $courses = Course::orderBy('id', 'desc')->take($end)->get();


            return DataTables::of($courses)
              ....

                })
              ....
        }

Activity icon

Replied to Datatable Plugin 1000 Records Slow.

@tray2 , there is no dropdown element (COMBO). i run this script in my localhost machine. actually i want to load first 5 records, my question ,is why its slow ? :(

Activity icon

Started a new Conversation Datatable Plugin 1000 Records Slow.

There are 1000 records in data base . i used laravel yagira Datatbale plugin to the RENDER those records. now its really slow. here is my code. how can i speed up this process ? please help me

Screen shot https://snipboard.io/jZ7xdo.jpg

 public function index(Request $request)
    {
        if ($request->ajax()) {
            $courses = Course::orderBy('id', 'desc')->get();
            return DataTables::of($courses)
                ->addColumn('selectRows', function ($row) {
                    return '<input class="selectRow" type="checkbox" name="userenrollments[]"
                value="' . $row->id . '"/>';
                })
                ->addColumn('assignedUsers', function ($row) {
                    $courseId = $row->id;
                    $courseUsers = Course::with('users', 'meeting')
                        ->find($courseId);
                    $zoomMeetingId = $courseUsers->meeting->zoom_meeting_id;
                    $topic = $courseUsers->meeting->topic;
                    $description = $courseUsers->meeting->description;

                    $courseUsers = $courseUsers->users;


                    if (!$courseUsers->isEmpty()) {
                        $userEmails = "";
                        foreach ($courseUsers as $cu) {
                            $userId = $cu->id;
                            $email = $cu->email;
                            $invoiceLink = "/invoice/userinvoice?rootbacklink=userenrollment&userid=$userId&courseid=$courseId";
                            $invoiceLink = url($invoiceLink);

                            $invoiceStatus = $this->getUserInvoiceStatus($userId, $courseId);

                            if ($invoiceStatus === "Unpaid") {
                                $linkClass = "text-danger";
                            } else if ($invoiceStatus === "Paid") {
                                $linkClass = "text-success";
                            } else {
                                $linkClass = "";
                            }

                            $fullUserName = $cu->firstname . ' ' . $cu->lastname;

                            $meetingLink = "https://zoom.us/meeting/$zoomMeetingId";
                            $toolTipHtmlCode = "<em> $email </em>";


                            $userEmails .= "<a class='p-1 text-decoration-none badge badge-light $linkClass'  href='$invoiceLink' data-toggle='tooltip' data-html='true' data-placement='top' title='$toolTipHtmlCode'>$fullUserName</a>";
                            $userEmails .= "<i data-courseId='$courseId' data-userId='$cu->id' class=\"material-icons userEmailBtn btn btn-sm text-danger small'\">cancel</i>";

                        }

                        return "<div class='bg-white badge-panel'>$userEmails</div>";
                    }

                })
                ->addColumn('meetingTitle', function ($row) {
                    $courseId = $row->id;
                    $course = Course::with('meeting')
                        ->find($courseId);
                    $zoomMeetingId = $course->meeting->zoom_meeting_id;
                    $zoomUrl = "https://zoom.us/meeting/$zoomMeetingId";

                    $topic = $course->meeting->topic;

                    if (!empty($course)) {
                        return "<a target='_blank'  href='$zoomUrl'>" . $topic . "</a>";
                    }


                })
                ->addColumn('addMeetingRegistrant', function ($row) {

                    $courseId = $row->id;

                    //Check Course Assigned User Count
                    $courseUser = Course::whereHas('users')->find($courseId);
                    if (!empty($courseUser)) {
                        $courseUserCount = count($courseUser->users);
                        if ($courseUserCount !== 0) {
                            $addToZoomMeeting = '<button class="btn btn-sm btn-success addMeetingRegistrants" data-courseId="' . $courseId . '"><i class="fa fa-sign-in-alt"></i></button>';
                            $removeFromZoomMeeting = '<button class="btn btn-sm btn-danger removeMeetingRegistrants" data-courseId="' . $courseId . '"><i class="fa fa-sign-out-alt"></i></button>';

                            $htmlCode = "<div class='text-center'>";
                            $htmlCode .= $addToZoomMeeting . "&nbsp;" . $removeFromZoomMeeting;
                            $htmlCode .= "</div>";
                            return $htmlCode;
                        }
                    } else {
                        return NULL;
                    }

                })
                ->rawColumns(['selectRows', 'meetingTitle', 'assignedUsers', 'addMeetingRegistrant'])
                ->addIndexColumn()
                ->make(true);
        }
    }


Jan
23
1 month ago
Activity icon

Replied to I Want To Build Up Schedule SMS Service Using Laravel.

I m sorry guys. I want to send SMS or email to my client . on Specific date and time;

Eg : Sample message Dear Student, Your meeting is starting after 15 minutes. please ready on it .

Jan
20
1 month ago
Activity icon

Started a new Conversation User Friendly Exception Handling

Hi , I want to give user friendly error for this exception it means. General user don't know about the technical things. i want to give message

"Sorry. you cannot delete this record. because download items associated with this"

.how could i do that ? https://snipboard.io/3iJomV.jpg

Activity icon

Started a new Conversation Production Server Every Time Asks " Do You Really Wish To Run This Command?"

Always it asks '


[[email protected] public_html]# php artisan db:seed --class=CustomSeeder
**************************************
*     Application In Production!     *
**************************************

 Do you really wish to run this command? (yes/no) [no]:

How can i stop this in PRODUCTION environment. my laravel version is 8

Activity icon

Replied to I Want To Build Up Schedule SMS Service Using Laravel.

@nimrod local provider means .LOCAL SMS SERVICE PROVIDER. pricing are too expensive in there. :)

Activity icon

Replied to I Want To Build Up Schedule SMS Service Using Laravel.

@nimrod , sorry. I want to setup my SMS scheduling feature with local provider. Are there any facility to schedule sms using laravel code ?

Activity icon

Replied to I Want To Build Up Schedule SMS Service Using Laravel.

@nimrod Ideveloped Distance Learning System . so i want to send SMS notification before Zoom meeting start . how could i do that ?

Please i don't like to check date,time for every second. :) are there any pre build facility in laravel .

Activity icon

Started a new Conversation I Want To Build Up Schedule SMS Service Using Laravel.

I want to build up Schedule SMS Service using Laravel. how to build up that ?

Jan
17
1 month ago
Activity icon

Replied to Two DB Connections Migrations In Laravel

FIxed by me

	$dbConnection = "mysql"  //Select your DB Connection
	Schema::connection($dbConnection)->disableForeignKeyConstraints();
        Schema::connection($dbConnection)->dropIfExists('activity_log');
        Schema::connection($dbConnection)->dropIfExists('migrations');
        Schema::connection($dbConnection)->enableForeignKeyConstraints();