devionti

devionti

Member Since 1 Year Ago

Experience Points
7,750
Total
Experience

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

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

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

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 2
7,750 XP
Sep
12
6 days ago
Activity icon

Replied to Laravel Excel Import Update Existing

yea I created a command called UpdateUser

       $models = DB::table('temp')
        //->join('users','temp.username','=','users.username')
        ->get();

        foreach ($models as $model)
        {
            DB::table('users')->where('username', '=', $model->username)->update(
['email' => $model->email],
...
);
,,,
Activity icon

Replied to Laravel Excel Import Update Existing

I tried collection as well I was hoping that it would insert where the ID would match so if the csv file has id = 2. Then it would insert into that row. It creates a new entry and ignores id.

I think I might try to make a temporary table to dump into it and then update from the temp to the Users. Though I think there is a better way.

namespace App\Imports;

use App\User;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;

class UsersImport implements ToCollection
{
    public function collection(Collection $rows)
    {
        foreach ($rows as $row) 
        {
            User::create([
            'id' => $row['id'],
         //'id' => $this->transformNameToId($row['Name']),
            'name' => $row['Name of Employee'],
            'nationality' => $row['Nationality'],
            'position' => $row['Position'],
            ]);
        }
    }
}

https://docs.laravel-excel.com/3.1/imports/collection.html

Activity icon

Started a new Conversation Laravel Excel Import Update Existing

I read through the documentation and I am unsure on how to update existing instead of creating new entries

class ImportUsers extends Command
{
    protected $signature = 'import:users';

    protected $description = 'Laravel Excel importer';

    public function handle()
    {
        $this->output->title('Starting import Users');
         (new UsersImport)->withOutput($this->output)->import('Imports/users.xlsx'); 
    }
}
class UsersImport implements ToModel, WithBatchInserts, WithChunkReading, WithHeadingRow, WithProgressBar
{
    use Importable;

    public function model(array $row)
    {
        return new User ([
            'id' => $this->transformNameToId($row['Name']),
            'name' => $row['Name of Employee'],
            'nationality' => $row['Nationality'],
            'position' => $row['Position'],
	]);
}
}

    public function transformNameToId($value) {
        $user = User::where('name', $value)->first();
    
        if(! $user){
            return null;
        }
    
        return $user->id;
    }

https://docs.laravel-excel.com/3.1/imports/

Sep
03
2 weeks ago
Activity icon

Replied to Chartjs Doesn't Output Results In Production

Note this works fine on localhost when I use valet secure. Its just when I use a server like cloudways I get this error. For the cards I am using a vendor

https://coroo.github.io/nova-chartjs/#/

vendor\coroowicaksono\routes\api.php

<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Card API Routes
|--------------------------------------------------------------------------
|
| Here is where you may register API routes for your card. These routes
| are loaded by the ServiceProvider of your card. You're free to add
| as many additional routes to this file as your card may require.
|
*/
Route::get('/endpoint', \Coroowicaksono\ChartJsIntegration\Api\TotalRecordsController::class . '@handle');
Route::get('/circle-endpoint', \Coroowicaksono\ChartJsIntegration\Api\TotalCircleController::class . '@handle');

vendor\coroowicaksono\resources\chart-js-integration.js

import StackedChart from './components/StackedChart'
import BarChart from './components/BarChart'
import LineChart from './components/StripeChart'
import DoughnutChart from './components/DoughnutChart'
import PieChart from './components/PieChart'
import PolarAreaChart from './components/PolarAreaChart'
import ScatterChart from './components/ScatterChart'

Nova.booting((Vue, router, store) => {
    Vue.component('stacked-chart', StackedChart);
    Vue.component('bar-chart', BarChart);
    Vue.component('stripe-chart', LineChart);
    Vue.component('doughnut-chart', DoughnutChart);
    Vue.component('pie-chart', PieChart);
    Vue.component('polar-area-chart', PolarAreaChart);
    Vue.component('scatter-chart', ScatterChart);
})

vendor\coroowicaksono\resources\StackedChart.vue

<template>
    <card class="p-10">
      <div class="stay-right">
        <a @click="fillData()" class="btn-refresh" v-show="buttonRefresh">
          <i class="fas fa-sync"></i>
        </a>
        <a @click="reloadPage()" class="btn-refresh" v-show="buttonReload">
          <i class="fas fa-sync"></i>
        </a>
        <a :href="externalLink" :target="externalLinkIn" class="btn-external" v-show="btnExtLink">
          <i class="fas fa-external-link-alt"></i>
        </a>
        <select @change="fillData()" v-model="advanceFilterSelected" v-show="showAdvanceFilter" class="select-box-sm ml-auto min-w-24 h-6 text-xs appearance-none bg-40 pl-2 pr-6 active:outline-none active:shadow-outline focus:outline-none focus:shadow-outline">
          <option v-for="filter in advanceFilter" v-bind:value="filter.value" :key="filter.key">
            {{ filter.text }}
          </option>
        </select>
      </div>
      <h4 class="chart-js-dashboard-title">{{ checkTitle }}</h4>
      <line-chart :chart-data="datacollection" :options="options"></line-chart>
    </card>
</template>

<style>
  @import '../../css/main.css';
</style>

<script>
  import LineChart from '../bar-chart.js';
  import ChartDataLabels from 'chartjs-plugin-datalabels';
  Chart.plugins.unregister(ChartDataLabels);

  export default {
    components: {
      LineChart
    },
    data () {
      this.card.options = this.card.options != undefined ? this.card.options : false;

      // setup btn filter list
      const btnFilterList = this.card.options.btnFilterList;
      let filledAdvancedList = [];
      let i = 0;

      for ( var index in btnFilterList ) {
        filledAdvancedList[i] = {value: index, text: btnFilterList[index]};
        i++;
      }
      
      return {
        datacollection: {},
        options: {},
        buttonRefresh: this.card.options.btnRefresh,
        buttonReload: this.card.options.btnReload,
        btnExtLink: this.card.options.extLink != undefined ? true : false,
        externalLink: this.card.options.extLink,
        externalLinkIn: this.card.options.extLinkIn != undefined ? this.card.options.extLinkIn : '_self',
        chartTooltips: this.card.options.tooltips != undefined ? this.card.options.tooltips : undefined,
        sweetAlert: this.card.options.sweetAlert2 != undefined ? this.card.options.sweetAlert2 : undefined,
        chartPlugins: this.card.options.plugins != undefined ? this.card.options.plugins : false,
        chartLayout: this.card.options.layout != undefined ? this.card.options.layout :
          {
            padding: {
              left: 20,
              right: 20,
              top: 0,
              bottom: 10
            }
          },
        chartLegend: this.card.options.legend != undefined ? this.card.options.legend :
          {
            display: true,
            position: 'left',
            labels: {
              fontColor: '#7c858e',
              fontFamily: "'Nunito'"
            }
          },
        showAdvanceFilter: this.card.model == 'custom' || this.card.model == undefined ? false : this.card.options.btnFilter == true ? true : false ,
        advanceFilterSelected: this.card.options.btnFilterDefault != undefined ? this.card.options.btnFilterDefault : 'QTD',
        advanceFilter: this.card.options.btnFilterList != undefined ? filledAdvancedList : [
          { text: 'Year to Date', value: 'YTD' },
          { text: 'Quarter to Date', value: 'QTD' },
          { text: 'Month to Date', value: 'MTD' },
          { text: '30 Days', value: 30 },
          { text: '60 Days', value: 60 },
          { text: '365 Days', value: 365 },
        ],
      }
    },
    computed: {
      checkTitle() {
        return this.card.title !== undefined ? this.card.title : 'Chart JS Integration';
      }
    },
    props: [
        'card'
    ],
    mounted () {
      this.fillData();
    },
    methods: {
      reloadPage(){
        window.location.reload()
      },
      fillData () {
        this.options = {
          layout: this.chartLayout,
          legend: this.chartLegend,
          scales: {
            yAxes: [{
              stacked: true,
              ticks: {
                maxTicksLimit: 5,
                fontSize: 10,
                callback: function(num, index, values) {
                  if (num >= 1000000000) {
                    return (num / 1000000000).toFixed(1).replace(/\.0$/, '') + 'G';
                  }
                  if (num >= 1000000) {
                    return (num / 1000000).toFixed(1).replace(/\.0$/, '') + 'M';
                  }
                  if (num >= 1000) {
                    return (num / 1000).toFixed(1).replace(/\.0$/, '') + 'K';
                  }
                  return num;
                }
              }
            }],
            xAxes: [ {
              stacked: true,
              ticks: {
                lineHeight: 0.8,
                fontSize: 10,
              }
            }]
          },
          responsive: true,
          maintainAspectRatio: false,
          plugins: this.chartPlugins,
        };

        if(this.chartTooltips !== undefined){
          this.options.tooltips = this.chartTooltips;
          const tooltiplist = ["custom", "itemSort", "filter"];
          var z;
          for (z = 0; z < tooltiplist.length; z++) {
            if(this.options.tooltips[tooltiplist[z]] != undefined){
              if(this.options.tooltips[tooltiplist[z]].search("function") != -1){
                eval("this.options.tooltips." + tooltiplist[z] + " = " + this.options.tooltips[tooltiplist[z]]);
              }
            }
          }

          if(this.chartTooltips.callbacks !== undefined){
            const callbacklist = ["beforeTitle", "title", "afterTitle", "beforeBody", "beforeLabel", "label", "labelColor", "labelTextColor", "afterLabel", "afterBody", "beforeFooter", "footer", "afterFooter"];
            var i;
            for (i = 0; i < callbacklist.length; i++) {
              if(this.options.tooltips.callbacks[callbacklist[i]] != undefined){
                if(this.options.tooltips.callbacks[callbacklist[i]].search("function") != -1){
                  eval("this.options.tooltips.callbacks." + callbacklist[i] + " = " + this.options.tooltips.callbacks[callbacklist[i]]);
                }
              }
            }
          }
        }

        if(this.card.model == 'custom' || this.card.model == undefined){
        // Custom Data
          this.title = this.card.title,
          this.datacollection = {
            labels: this.card.options.xaxis.categories,
            datasets: this.card.series,
          }

          // START == SETUP POPUP
          const sweetAlertWithLink = this.sweetAlert;
          if(sweetAlertWithLink != undefined) {
            this.options.onClick = function (event) {
              let element = this.getElementAtEvent(event);
              if (element.length > 0) {
              var series= element[0]._model.datasetLabel;
              var label = element[0]._model.label;
              var value = this.data.datasets[element[0]._datasetIndex].data[element[0]._index];

              const toLink = sweetAlertWithLink.linkTo != undefined ? sweetAlertWithLink.linkTo : "https://coroo.github.io/nova-chartjs/";
              const { linkTo, ...sweetAlert } = sweetAlertWithLink;

              const Swal = require('sweetalert2')
              Swal.fire({
                title: sweetAlert.title != undefined ? sweetAlert.title : '<strong>'+value+'</strong>',
                icon: sweetAlert.icon != undefined ? sweetAlert.icon : 'info',
                html: sweetAlert.html != undefined ? sweetAlert.html : series == undefined ? 'You can see detail by click below button:' : '<b>' + series + '</b> in '+label+'<br/> ',
                showCloseButton: sweetAlert.showCloseButton != undefined ? sweetAlert.showCloseButton : true,
                showCancelButton: sweetAlert.showCancelButton != undefined ? sweetAlert.showCancelButton : true,
                focusConfirm: sweetAlert.focusConfirm != undefined ? sweetAlert.focusConfirm : false,
                confirmButtonText: sweetAlert.confirmButtonText != undefined ? sweetAlert.confirmButtonText : '<i class="fas fa-external-link-alt"></i> See Detail',
                confirmButtonAriaLabel: sweetAlert.confirmButtonAriaLabel != undefined ? sweetAlert.confirmButtonAriaLabel : 'See Detail',
                cancelButtonAriaLabel: sweetAlert.cancelButtonAriaLabel != undefined ? sweetAlert.cancelButtonAriaLabel : 'Cancel',
                footer: sweetAlert.footer != undefined ? sweetAlert.footer : '<a href="https://coroo.github.io/nova-chartjs/" target="_blank" style="text-decoration:none; color:#777; font-size:14px">Nova Chart JS © ' + new Date().getFullYear() + '</a>',
                ...sweetAlert
              }).then((result) => {
                if (result.value) {
                  window.location = toLink;
                }
              })}
            };
          };
          // END == SETUP POPUP

        } else {
          if(this.showAdvanceFilter == true) this.card.options.advanceFilterSelected = this.advanceFilterSelected != undefined ? this.advanceFilterSelected : false;

          // Use Model
          Nova.request().get("/coroowicaksono/check-data/endpoint/", {
            params: {
                model: this.card.model,
                series: this.card.series,
                options: this.card.options,
                join: this.card.join,
                expires: 0,
            },
          })
          .then(({ data }) => {
            this.datacollection = {
              labels: data.dataset.xAxis,
              datasets: data.dataset.yAxis,
            };

            // START == SETUP POPUP
            const sweetAlertWithLink = this.sweetAlert;
            if(sweetAlertWithLink != undefined) {
              this.options.onClick = function (event) {
                let element = this.getElementAtEvent(event);
                if (element.length > 0) {
                var series= element[0]._model.datasetLabel;
                var label = element[0]._model.label;
                var value = this.data.datasets[element[0]._datasetIndex].data[element[0]._index];

                const toLink = sweetAlertWithLink.linkTo != undefined ? sweetAlertWithLink.linkTo : "https://coroo.github.io/nova-chartjs/";
                const { linkTo, ...sweetAlert } = sweetAlertWithLink;

                const Swal = require('sweetalert2')
                Swal.fire({
                  title: sweetAlert.title != undefined ? sweetAlert.title : '<strong>'+value+'</strong>',
                  icon: sweetAlert.icon != undefined ? sweetAlert.icon : 'info',
                  html: sweetAlert.html != undefined ? sweetAlert.html : series == undefined ? 'You can see detail by click below button:' : '<b>' + series + '</b> in '+label+'<br/> ',
                  showCloseButton: sweetAlert.showCloseButton != undefined ? sweetAlert.showCloseButton : true,
                  showCancelButton: sweetAlert.showCancelButton != undefined ? sweetAlert.showCancelButton : true,
                  focusConfirm: sweetAlert.focusConfirm != undefined ? sweetAlert.focusConfirm : false,
                  confirmButtonText: sweetAlert.confirmButtonText != undefined ? sweetAlert.confirmButtonText : '<i class="fas fa-external-link-alt"></i> See Detail',
                  confirmButtonAriaLabel: sweetAlert.confirmButtonAriaLabel != undefined ? sweetAlert.confirmButtonAriaLabel : 'See Detail',
                  cancelButtonAriaLabel: sweetAlert.cancelButtonAriaLabel != undefined ? sweetAlert.cancelButtonAriaLabel : 'Cancel',
                  footer: sweetAlert.footer != undefined ? sweetAlert.footer : '<a href="https://coroo.github.io/nova-chartjs/" target="_blank" style="text-decoration:none; color:#777; font-size:14px">Nova Chart JS © ' + new Date().getFullYear() + '</a>',
                  ...sweetAlert
                }).then((result) => {
                  if (result.value) {
                    window.location = toLink;
                  }
                })}
              };
            };
            // END == SETUP POPUP

          })
          .catch(({ response }) => {
            this.$set(this, "errors", response.data.errors)
          })
        }
      },
    },
  }
</script>

This is the error when I load from server

Mixed Content: The page at 'https://mywebsite.com/nova/dashboards/main' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://mywebsite.com/coroowicaksono/check-data/circle-endpoint?model=%5CApp%5CUser&series[]=%7B%22label%22:%22users%22,%22filter%22:%7B%22key%22:%22id%22,%22value%22:%221%22%7D%7D&options=%7B%22count%22:%22id%22%7D&expires=0'. This request has been blocked; the content must be served over HTTPS.
Activity icon

Replied to Chartjs Won't Load Over HTTPS

I just installed a fresh installation of nova and added the chart to count how many users that's it,

the issue is

Mixed Content: The page at 'https://mywebsite.com/nova/resources/users' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://mywebsite.com/coroowicaksono/check-data/circle-endpoint?model=%5CApp%5CUser&series[]=%7B%22label%22:%22users%22,%22filter%22:%7B%22key%22:%22id%22,%22value%22:%221%22%7D%7D&options=%7B%22count%22:%22id%22%7D&expires=0'. This request has been blocked; the content must be served over HTTPS.

This is the vendor/coroowikasono/route/api.php

<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Card API Routes
|--------------------------------------------------------------------------
|
| Here is where you may register API routes for your card. These routes
| are loaded by the ServiceProvider of your card. You're free to add
| as many additional routes to this file as your card may require.
|
*/
Route::get('/endpoint', \Coroowicaksono\ChartJsIntegration\Api\TotalRecordsController::class . '@handle');
Route::get('/circle-endpoint', \Coroowicaksono\ChartJsIntegration\Api\TotalCircleController::class . '@handle');

The developer says it should work fine and I did test it locally using valet secure and it worked fine. So I am currently talking to cloudways to see if they can figure out the issue on their end.

Sep
02
2 weeks ago
Activity icon

Started a new Conversation Chartjs Won't Load Over HTTPS

How can I force chartjs to work over HTTPS So Chartjs loads fine when I am using a model if I use HTTP, if I use HTTPS I get this error This request has been blocked; the content must be served over HTTPS. This is the code I am using that only works on HTTP but not HTTPS

(new StackedChart())
            ->title('Totalbeds')
            ->model('\App\Model\Hotel\Room') // Use Your Model Here
            ->series(array([
                'label' => 'Location 1',
                'filter' => [
                    'key' => 'id', // State Column for Count Calculation Here
                    'value' => '1'
            ],
            ]
            ))
            ->options([
                'sum' => 'totalbeds' // Add the column you want to calculate
            ])
            ->width('2/3'),

I am unsure how can I force chartjs to use HTTPS, forceSchema won't work because chartjs is not available in routes since I am using NOVA.

if (env('APP_ENV') === 'production') {
    URL::forceSchema('https');
}

https://coroo.github.io/nova-chartjs/#/

Activity icon

Replied to Repeating Code Based On Permissions - Nova

user has a morphtomany relationship with roles and permissions So when a user logs in the person is already assigned a role where the person is able to see resources, navigation options and different fields and permissions(view, create, update, delete). This is the method that I use and it works fine if($request->user->hasrole('manager')){return[Text::make('Note'),];} Basically inside the if statement it only works if I put a return inside return[];

So if the return is outside the if statement, why is it confused about the logged in user

Activity icon

Replied to Repeating Code Based On Permissions - Nova

returns an error says

call to a member function hasrosle() on null

I think its because it is expecting a return statement inside I think this method only works on arrays but not fields.

Activity icon

Started a new Conversation Chartjs Doesn't Output Results In Production

chartjs

 (new StackedChart())
    ->title('Totalbeds')
    ->model('\App\Model\Hotel\Room') // Use Your Model Here
    ->series(array([
        'label' => 'Location 1',
        'filter' => [
            'key' => 'id', // State Column for Count Calculation Here
            'value' => '1'
    ],
    ]
    ))
    ->options([
        'sum' => 'totalbeds' // Add the column you want to calculate
    ])
    ->width('2/3'),
Sep
01
2 weeks ago
Activity icon

Replied to Counting And Updating From A Joined Table

Thank you,

I figured out that the issue is that I should have made a second where clause because the room had many occupants who checked-out. These records are left for reports. So the count overall occupants that lived in that room.

Here is what I did to get the accurate information I needed

    public function handle()
    {
        $models = DB::table('occupants')
        ->leftjoin('room','occupants.room_id','=','room.id')
        ->whereNotNull('occupants.checkin')
        ->get();

        foreach ($models as $model)
        {
            $count = DB::table('occupants')
            ->join('room','occupants.room_id','=','room.id')
            ->whereNotNull('occupants.checkin')
            ->whereNull('occupants.checkout')
            ->where('room.id', '=', $model->room_id)
            ->count();
                     DB::table('room')->update(['current_status' => $count]);
                }
         }
Activity icon

Replied to Counting And Updating From A Joined Table

It still counts for the overall occupants instead of for each room. Imagine there are 2 rooms and each room has occupants(room 1 has 2, and room2 has 3). These occupants are inside an occupants table but their room_id is exactly the same id in room table. It's a hasMany relationship.

The issue is the output is $room1->current_status = 5; & $room2->current_status = 5; When it should be $room1->current_status = 2; & $room2->current_status = 3;

Activity icon

Started a new Conversation Counting And Updating From A Joined Table

This is a background command, All I want is to count all occupants in a room. So basically count occupants where occupants.room_id == room.id then room.current_status = $count room can also be like room.current_status = current_status+1, //only if checkin is not null

public function handle()
    {
        $models = DB::table('occupants')
        ->join('room','occupants.room_id','=','room.id')
        ->where(
           [ 'occupants.room_id', '=', 'room.id'],
         //  ['occupants.checkin', '<>', null],
            )
        ->get();

        $count = DB::table('occupants')
        ->join('room','occupants.room_id','=','room.id')
        ->where([
           [ 'occupants.room_id', '=', 'room.id'],
           ['occupants.checkin', '<>', null],
        ])
        ->count();

        foreach ($models as $model)
        { 
            DB::table('Room')->where('id', '=', $model->room_id)->update(['current_status' => $count]);
        }
    }

I am getting

SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause'

Also when I count it produces the overall count but not for every room. Basically if there are 6 occupants where checkin != null, so current_status should = 6.

Aug
31
2 weeks ago
Activity icon

Started a new Conversation Inserting Id Where Import Value Match Username

So I have this excel sheet that only has username of users and I am going to import this data to another table called import

This is the import, I am using laravel excel User_id is a foreign key that references id in users

 return new Occupants([
  'user_id' => $this->transformUsernameToUserid($row[3]),
        ]);

This function is supposed to compare the value in the excel sheet row with username in users table and then grab that id and it is the value of user_id

   public function transformUsernameToUserid($value)
   {
    $query = DB::table('users')
    ->where('username', '=', $value)
    ->select('id')
   // ->toArray()
    ->get();
if($value == null){
    return null;
}
else{
    return $query;
}

I get no error but it returns null

Aug
30
2 weeks ago
Activity icon

Started a new Conversation Nova Value Metric Outputs 0

This metric was working fine this morning but all of a sudden it stopped. What I mean by stopped is that it outputs 0. Even though the actual value is above zero. I have both native Laravel Nova value metric and chartjs getting the sum of the same column. Yet nova value metric outputs 0, while chartjs outputs the correct value

    public function calculate(NovaRequest $request)
    {
        return $this->sum($request, \App\Model\Hotel\Room::class, 'totalbeds');
    }

chartjs

 (new StackedChart())
    ->title('Totalbeds')
    ->model('\App\Model\Hotel\Room') // Use Your Model Here
    ->series(array([
        'label' => 'Location 1',
        'filter' => [
            'key' => 'id', // State Column for Count Calculation Here
            'value' => '1'
    ],
    ]
    ))
    ->options([
        'sum' => 'totalbeds' // Add the column you want to calculate
    ])
    ->width('2/3'),
Activity icon

Started a new Conversation BelongsToMany Filtering - Nova

I have three tables, well 5 if you count the pivot. tables:Helpdesk, users, subject pivot tables:users_subject, users_helpdesk All I want is that helpdesk has sub_id, now I want when I select the dropdown list for users in the belnogstomany it would only show up users that have the same sub_id. In Nova there is a belongsToMany field. The issue is I am unsure how to filter the users in the attach users.

  BelongsToMany::make('Users','users', \App\Nova\User::class),
    public function users()
    {
        return $this->belongsToMany('App\User', 'users_helpdesk', 'helpdesk_id', 'user_id')->withPivot('user_id', 'helpdesk_id')->withTimestamps();
    }

    public function getUsers()
    {
        return $query = DB::table('users_subject')
        ->join('users', 'users.id', '=', 'users_subject.user_id')
        ->select(  'users.name')
        ->get();
    }

If I made users as a BelongsTo then its easier to make a dependent dropdown list.

Activity icon

Replied to Syntax Issues With Resource Navigation Link - Nova

I changed it to class instead of make I still wonder why it doesn't work. Can't see anything.

  public function cards(Request $request)
    {
        return [
            ResourceNavigationLink::make([
                'Department' => App\Nova\Structure\Department::class,
                'Location' => App\Nova\Structure\Location::class,

            ])
        ];
    }
Activity icon

Started a new Conversation Syntax Issues With Resource Navigation Link - Nova

So I tested this repository on a new nova installation and I get

syntax error, unexpected ')'

https://github.com/dcasia/resource-navigation-link

I used the example in the documentation it and that is how I got the error.

  public function cards(Request $request)
    {
        return [
            ResourceNavigationLink::make([
                'Department' => App\Nova\Structure\Department::make(),
                'Location' => App\Nova\Structure\Location::make(),

            ])
        ];
    }

example

 public function cards(Request $request)
    {
        return [
            ResourceNavigationLink::make([
                'Resource 1' => NovaResource::make(...),
                'Resource 2' => LensResource::make(...),
                'Resource 3' => InternalLink::make(...),
                'Resource 4' => ExternalLink::make(...),
                'Resource 5' => RawResource::make(...),
            ])
        ];
    }

They are exactly similar, I just do not see what is missing, all commas are exactly the same. Unless the code of the repository itself is not correct. If you have nova you can install this repository and test it yourself to see if you can reproduce the same error.

Aug
29
2 weeks ago
Activity icon

Replied to Syntax Error Unexpected ')' - Nova

no it isn't it was unrelated. The issue is in the line above before the comment the error is here

'Vacancies' => Vacancies::make(...),

so way before

 ]); // add a comma here
Activity icon

Replied to Syntax Error Unexpected ')' - Nova

the issue is actually here at the end

'Vacancies' => Vacancies::make(...),

Adding a comma there won't solve the issue, since it is not related.

Activity icon

Started a new Conversation Syntax Error Unexpected ')' - Nova

So I wanted to combine resources navigation to be tabbed for related resources. So I found a repository and there was not enough documentation to describe what is missing.

https://github.com/dcasia/resource-navigation-link

public function cards(Request $request)
    {
        return [
            ResourceNavigationLink::make([
                'Resource 1' => NovaResource::make(...),
                'Resource 2' => LensResource::make(...),
                'Resource 3' => InternalLink::make(...),
                'Resource 4' => ExternalLink::make(...),
                'Resource 5' => RawResource::make(...),
            ])
        ];
    }
<?php

namespace DigitalCreative\ResourceNavigationLink;

use Laravel\Nova\Card;

class ResourceNavigationLink extends Card
{
    /**
     * The width of the card (1/3, 1/2, or full).
     *
     * @var string
     */
    public $width = '1/2';

    /**
     * ResourceNavigationCard constructor.
     *
     * @param array $resources
     */
    public function __construct(array $resources)
    {
        $this->withMeta([ 'resources' => $resources ]);
    }

    /**
     * Get the component name for the element.
     *
     * @return string
     */
    public function component()
    {
        return 'resource-navigation-link';
    }
}

This is my attempt from what I understood from the repository.

use DigitalCreative\ResourceNavigationLink\ResourceNavigationLink;

public function cards(Request $request)
    {
        return [
                ResourceNavigationLink::make([
                    'Vacancies' => Vacancies::make(...),
 		    'Applicants' => Applicants::make(...),
                ])
	];
}

I got this error

syntax error unexpected ')'
Aug
28
3 weeks ago
Activity icon

Awarded Best Reply on Git Push Causes Duplication Of App Folder

I solved the issue just now. Even though I read many do not recommend this it seems like it was the only method that made it work

git config core.ignorecase false

if I leave it as true then even if and I did try. So if I rename App to app2 then app2 to app, in Git if I commit with case ignore as true it will be committed with App as a directory. If git ignore case is false then when I commit app will be committed and not App.

git mv app app2
git mv app2 app
git commit -m "rename directory"

Forgot to mention my local machine OS is MACOS

Activity icon

Replied to Git Push Causes Duplication Of App Folder

I solved the issue just now. Even though I read many do not recommend this it seems like it was the only method that made it work

git config core.ignorecase false

if I leave it as true then even if and I did try. So if I rename App to app2 then app2 to app, in Git if I commit with case ignore as true it will be committed with App as a directory. If git ignore case is false then when I commit app will be committed and not App.

git mv app app2
git mv app2 app
git commit -m "rename directory"

Forgot to mention my local machine OS is MACOS

Activity icon

Replied to Git Push Causes Duplication Of App Folder

Locally I commit in my local machine app is small a. When I commit in GitHub desktop I notice that the directory is App/... When I click reveal in finder it sends me to app because my machine is not case sensitive when it comes to caps. In the repository I see two folders App and app. For some reason some files when pushed they are committed with app directory. Though majority are committed with App directory.

Activity icon

Replied to Git Push Causes Duplication Of App Folder

yea in git when I commit the location is App/... I tried to find a way to rename folders inside the git repository but I don't know any way to do it. When I searched it seems like its not available anymore.

Activity icon

Replied to Git Push Causes Duplication Of App Folder

I ssh into the server and I deleted app and renamed App to app. That is the workaround but for every pull I have to do this.

Activity icon

Started a new Conversation Git Push Causes Duplication Of App Folder

In Laravel folder app is with a small a. Though in the namespace its App. In my local installation the system ignores capital or small. Though when I notice in Git I see that the location is with a capital App.

So in my server it pushes two folders app and App. I guess maybe its because of the namespace.

I can change all my namespace to a small app. Though I wonder if there are any vendors that would only work with a Capital App.

Aug
27
3 weeks ago
Activity icon

Started a new Conversation Repeating Code Based On Permissions - Nova

I don't know how to phrase the question in a single sentence. I want to find a better way to hide specific fields under specific roles or permissions instead of copying all the fields to all roles but hide the ones not included.

When using nova under field this is what I do while using spatie laravel permissions and vyuldashev Nova-permission

use Spatie\Permission\Traits\HasRoles;

Inside a resource under fields I do this

  public function fields(Request $request)
    {
if($request->user->hasrole('manager')){
return[
//all fields
Text::make('Note'),
DateTime::make('Date'),
];
else{
return[
//Can only see what is available here, So cannot see Date Field
Text::make('Note'),
];
}

basically if I have different roles I would have to copy all the fields to every inside the return statements. I tried this way

if($request->user->hasrole('manager')){
return[
DateTime::make('Date'),
];
if($request->user->can('view-date')){ //permission
return [Text::make('note'),];
}

unfortunately that won't work. cause after the end of the return that's it you cannot write another if statement. Unfortunately all the fields can only be viewed in a return statement.

there was a work around which is introducing panels and well basically inside those panels you have less fields so less duplication of code.

I just want to a better way.

Activity icon

Awarded Best Reply on Telescope Returns 404 Path Issues

I solved the issue. I just reinstalled telescope

In Config telescope.php I just commented Authorize

    'middleware' => [
        'web',
        //Authorize::class,
    ],
Aug
26
3 weeks ago
Activity icon

Awarded Best Reply on Scheduling Doesn't Work

I solved the issue,

the reason for all these is that there are two app folders one is capital and the other is small

App
app

So I just copied the schedule to app. I will try to delete and check routing. The server is case sensitive in case of letters being capital or small.

In Telescope now I see all of them running.

Activity icon

Replied to Scheduling Doesn't Work

I solved the issue,

the reason for all these is that there are two app folders one is capital and the other is small

App
app

So I just copied the schedule to app. I will try to delete and check routing. The server is case sensitive in case of letters being capital or small.

In Telescope now I see all of them running.

Activity icon

Replied to Telescope Returns 404 Path Issues

I solved the issue. I just reinstalled telescope

In Config telescope.php I just commented Authorize

    'middleware' => [
        'web',
        //Authorize::class,
    ],
Activity icon

Started a new Conversation Telescope Returns 404 Path Issues

So I'm having 404 error when I open telescope I followed this solution because before I could access the page but it was constantly scanning.

https://laracasts.com/discuss/channels/laravel/laravel-telescope-keeps-scanning

After I followed all the steps seems like it just can't find the page.

In layout.blade.php

<script>
    window.Telescope = @json($telescopeScriptVariables);
    window.Telescope.path = '{{ env('MIX_APP_NAME') }}/telescope';
</script>

In Env I put this

MIX_APP_NAME = abcdefghijk/public_html/public/vendor

I still get 404 so I tried this

MIX_APP_NAME = public_html/public/vendor

Still the same issue.

I even used entire route

MIX_APP_NAME = home/master/applications/abcdefghijk/public_html/public/vendor

Same result

Activity icon

Replied to Scheduling Doesn't Work

when I type

php artisan schedule:run

I get this

No scheduled commands are ready to run.

When I type

php artisan queue:work &

I get this

[1] 9164

when I type

 crontab -l

I get this

* * * * * cd /abcdefghijk/public_html/ && php artisan schedule:run
Activity icon

Replied to Scheduling Doesn't Work

The way I understand it is that The server has a git_repo folder. This repo folder copies itself into public_html

if I type ls under the application folder these are folders I have two applications running on the server. One is development and the other is production. The development server includes telescope.

conf  git_repo  logs  private_html  public_html  ssl  tmp

That is how Cloudways is setup, I might ask to move it to private_html I don't remember but maybe I faced an issue when things were in private_html. Will check again

When I type the schedule run I get nothing but I know it is not executing because the columns have not been modified

Activity icon

Replied to BelongsToMany Implementation - Nova

Yea I learned Editing and rephrasing a question is better than writing it in a rephrased matter. Won't happen again.

Activity icon

Replied to Scheduling Doesn't Work

yea I had permission issues with clearing the cache. After running the command I get there is a new mail in

You have new mail in /var/mail/master_qfasdlqwelcv

After that no schedule.

Seems like the command has not been executed.

under crontab -l it shows the cronjob

* * * * * cd /abcdefghijk/public_html/ && php artisan schedule:run

Cron actually works I did try

* * * * * touch ~/text.txt
Aug
24
3 weeks ago
Activity icon

Replied to Scheduling Doesn't Work

oh thanks, yea removed the return statement.

Activity icon

Replied to Scheduling Doesn't Work

When I run the command

php artisan schedule:run

I get No scheduled commands are ready to run

Activity icon

Replied to Scheduling Doesn't Work

I am using cloudways, In Advanced cron job management

* * * * * cd /abcdefghijk/public_html/ && php artisan schedule:run >> /dev/null 2>&1

Activity icon

Started a new Conversation Scheduling Doesn't Work

I have a job and a command they are basically the same thing I just wanted to see what works.

If I run the command manually it works. If I use scheduling I have no idea if its running or not I check timer and nothing changed.

php artisan check:itteam
protected $signature = 'check:itteam';
    public function handle()
    {

        $models = DB::table('itTeams')->where('id', '<>', null)->get();

        foreach ($models as $model)
        {
                if( $model->helpdesk_id != null){
                    return DB::table('helpdesk')->update(['stat_id' => 3]);
                }
         }
}

In Schedule its like this

namespace App\Console;

use App\Jobs\CheckITteam;
use App\Console\CheckITteam;
 protected function schedule(Schedule $schedule)
    {
   $schedule->job(new CheckITteam)->everyMinute();
$schedule->command('check:itteam')->everyMinute();
}
Activity icon

Awarded Best Reply on Command To Compare And Update

I guess a workaround is to spit the command into two parts the helpdesk where the majority of the conditions occur

then the second part where only itTeams.helpdesk_id is required

        $models = DB::table('itTeams')->where('id', '<>', null)->get();

        foreach ($models as $model)
        {
                if( $model->helpdesk_id != null){
                    return DB::table('helpdesk')->update(['stat_id' => 3]);
                }
         }

In Kernal

    $schedule->command('check:helpdesk')->everyMinute();
    $schedule->command('check:team')->everyMinute();
Activity icon

Replied to Command To Compare And Update

I guess a workaround is to spit the command into two parts the helpdesk where the majority of the conditions occur

then the second part where only itTeams.helpdesk_id is required

        $models = DB::table('itTeams')->where('id', '<>', null)->get();

        foreach ($models as $model)
        {
                if( $model->helpdesk_id != null){
                    return DB::table('helpdesk')->update(['stat_id' => 3]);
                }
         }

In Kernal

    $schedule->command('check:helpdesk')->everyMinute();
    $schedule->command('check:team')->everyMinute();
Activity icon

Replied to Command To Compare And Update

This won't work cause only helpdesk has stat_id These are the columns needed

helpdesk.id
helpdesk.stat_id
itTeams.helpdesk_id

Basically the condition is this

if($helpdesk->stat_id == 2 && $helpdesk->id == $itTeams->helpdesk_id){
$helpdesk->stat_id = 3;

Is why I thought of using a join but it didn't work.

Activity icon

Started a new Conversation Command To Compare And Update

goal

The goal is to update the status in helpdesk if someone from itTeams Table selected this helpdesk. I want it to be updated if a team has been assigned to a helpdesk. So in db for itTeams it looks like this

# id, job, user_id, helpdesk_id, depart_id, created_at, updated_at, stat_id, sub_id, usr_sub_id
'1', NULL, '923', '1', '7', '2020-08-23 20:47:54', '2020-08-23 20:47:54', NULL, '1', NULL

helpdesk model

 public function team()
    {
        return $this->hasMany('App\Model\HelpDesk\Team', 'helpdesk_id', 'id');
    }

itTeams Model

 public function helpdesk()
    {
        return $this->belongsTo('App\Model\HelpDesk\HelpDesk', 'helpdesk_id', 'id');
    }

I tried different iterations of this command changing it up but nothing worked

$models = DB::table('helpdesk')
            ->rightJoin('itTeams', 'helpdesk.id', '=', 'itTeams.helpdesk_id')
            ->get();
        foreach ($models as $model)
        {

 elseif($model->stat_id == 2 && $model->helpdesk_id == $model->id ){ 
                    return DB::table('helpdesk')->update(['stat_id' =>3]);
                }
}
//No Error but my guess is this statement is never true

Seems like the condition is never true. Maybe cause it compares itTeams.id instead helpdesk.id

Activity icon

Replied to Issues With Null Dates

When Clicking submit and during two cases if I leave finish_date blank it says data missing

if I check ongoing then finish_date field is disabled the error says Undefined index:finish date.

Activity icon

Started a new Conversation Issues With Null Dates

My Issue is that even though passing finish_date is not required I cannot seem to be able to leave blank. It keeps saying missing data, or Undefined index: finish_date

Basically All I want to do is that the finish date can be null that is all. So clicking the ongoing checkbox will just disable the field.

ApplicationForm.blade.php

<div class="col-md-6 col-sm-12">
                                                <label>Finish Date</label>
                                                <h5>On Going</h5>
                                                <input id="ongoing" type="checkbox" name="educations'[ongoing]" onclick="disableDate()">

                                                <input id="findate" type="text" name="educations[finish_date]" data-date-start-date="0"
                                                       data-date-autoclose="true"
                                                       class="form-control" data-provide="datepicker" placeholder="Finish Date"/>
                                            </div>

*Migration

$table->dateTime('edu_finish_date')->nullable();

Controller

  $rules = [
            'first_name' => 'nullable',
            'last_name'  => 'nullable',
            'email'      => 'nullable',
            'mobile'     => 'nullable',
           'ongoing'     => 'nullable',
           'finish_date'     => 'nullable',
        ];
      if ( ! empty($data['educations'])) {
            if (count($data['educations']) > 0) {
                foreach ($data['educations'] as $key => $education) {
                    $rules = [
                        'educations.'.$key.'.title'       => 'required',
                        'educations.'.$key.'.location'    => 'required',
                        'educations.'.$key.'.start_date'  => 'required',
                        'educations.'.$key.'.ongoing',
                        'educations.'.$key.'.finish_date',
                    ];
    $data['educations'][$key]['start_date']  = Carbon::createFromFormat('d/m/Y',
                        $education['start_date']);
                    $data['educations'][$key]['finish_date'] = Carbon::createFromFormat('d/m/Y',
                        $education['finish_date']);

}
   if(isset($data['educations'])){
            $application->edu_title = $data['educations'][0]['title'];
            $application->edu_start_date = $data['educations'][0]['start_date'];
            $application->edu_finish_date = $data['educations'][0]['finish_date'];
            $application->onging = $data['educations'][0]['ongoing'];
            $application->edu_location = $data['educations'][0]['location'];
            $application->edu_description = $data['educations'][0]['description'];
        }

javasctipt

        function disableDate() {
            if(document.getElementById("ongoing").checked){
                document.getElementById("findate").disabled = true;
            }
        else{
            document.getElementById("findate").disabled = false;
        }
    }

Aug
22
3 weeks ago
Activity icon

Replied to Call To Undefined Method App\User::uriKey()

Thanks

  BelongsToMany::make('Users','users', \App\User::class),

I thought I used the resource, by mistake its the model should be like this

  BelongsToMany::make('Users','users', \App\Nova\User::class),
Activity icon

Replied to Call To Undefined Method App\User::uriKey()

this is my pivot table

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

            $table->bigInteger('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
 
            $table->bigInteger('sub_id')->unsigned()->index();
            $table->foreign('sub_id')->references('subject_id')->on('subject')->onDelete('cascade');
            $table->timestamps();
        });
Activity icon

Replied to Call To Undefined Method App\User::uriKey()

yes I am using nova, the error happens then I use the belongstomany field

            BelongsToMany::make('Users','users', \App\User::class),
#0 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(36): Illuminate\Database\Eloquent\Model::throwBadMethodCallException('uriKey')
#1 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1734): Illuminate\Database\Eloquent\Model->forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), 'uriKey', Array)
#2 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1746): Illuminate\Database\Eloquent\Model->__call('uriKey', Array)
#3 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Fields/BelongsToMany.php(97): Illuminate\Database\Eloquent\Model::__callStatic('uriKey', Array)
#4 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Makeable.php(14): Laravel\Nova\Fields\BelongsToMany->__construct('Users', 'users', 'App\\User')
#5 /Users/devionti/Sites/gcc_portal/app/Nova/HelpDesk/Subject.php(63): Laravel\Nova\Element::make('Users', 'users', 'App\\User')
#6 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/ResolvesFields.php(473): App\Nova\HelpDesk\Subject->fields(Object(Laravel\Nova\Http\Requests\ResourceIndexRequest))
#7 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/ResolvesFields.php(29): Laravel\Nova\Resource->availableFields(Object(Laravel\Nova\Http\Requests\ResourceIndexRequest))
#8 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Resource.php(367): Laravel\Nova\Resource->indexFields(Object(Laravel\Nova\Http\Requests\ResourceIndexRequest))
#9 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php(60): Laravel\Nova\Resource->serializeForIndex(Object(Laravel\Nova\Http\Requests\ResourceIndexRequest))
#10 [internal function]: Illuminate\Support\HigherOrderCollectionProxy->Illuminate\Support\{closure}(Object(App\Nova\HelpDesk\Subject), 0)
#11 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Support/Collection.php(638): array_map(Object(Closure), Array, Array)
#12 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Support/HigherOrderCollectionProxy.php(61): Illuminate\Support\Collection->map(Object(Closure))
#13 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Http/Controllers/ResourceIndexController.php(24): Illuminate\Support\HigherOrderCollectionProxy->__call('serializeForInd...', Array)
#14 [internal function]: Laravel\Nova\Http\Controllers\ResourceIndexController->handle(Object(Laravel\Nova\Http\Requests\ResourceIndexRequest), 'subjects')
#15 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#16 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('handle', Array)
#17 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Route.php(239): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Laravel\Nova\Http\Controllers\ResourceIndexController), 'handle')
#18 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Route.php(196): Illuminate\Routing\Route->runController()
#19 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Router.php(685): Illuminate\Routing\Route->run()
#20 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#21 /Users/devionti/Sites/gcc_portal/vendor/vyuldashev/nova-permission/src/ForgetCachedPermissions.php(22): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Vyuldashev\NovaPermission\ForgetCachedPermissions->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Http/Middleware/Authorize.php(18): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laravel\Nova\Http\Middleware\Authorize->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Http/Middleware/BootTools.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laravel\Nova\Http\Middleware\BootTools->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Http/Middleware/DispatchServingNovaEvent.php(20): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laravel\Nova\Http\Middleware\DispatchServingNovaEvent->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Http/Middleware/Authenticate.php(31): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laravel\Nova\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(77): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
#40 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Router.php(687): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#47 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Router.php(662): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#48 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Router.php(628): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#49 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Routing/Router.php(617): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#50 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#51 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#52 /Users/devionti/Sites/gcc_portal/vendor/laravel/nova/src/Http/Middleware/ServeNova.php(26): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#53 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Laravel\Nova\Http\Middleware\ServeNova->handle(Object(Illuminate\Http\Request), Object(Closure))
#54 /Users/devionti/Sites/gcc_portal/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#55 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 /Users/devionti/Sites/gcc_portal/vendor/fruitcake/laravel-cors/src/HandleCors.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#57 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#58 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#59 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#60 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#61 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#62 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#63 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#64 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(63): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#65 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#66 /Users/devionti/Sites/gcc_portal/vendor/fruitcake/laravel-cors/src/HandleCors.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#67 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#68 /Users/devionti/Sites/gcc_portal/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#69 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#70 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#71 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(140): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#72 /Users/devionti/Sites/gcc_portal/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(109): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#73 /Users/devionti/Sites/gcc_portal/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#74 /Users/devionti/.composer/vendor/laravel/valet/server.php(158): require('/Users/devionti...')
#75 {main}
"} 
Activity icon

Started a new Conversation Call To Undefined Method App\User::uriKey()

need help to figure out what is wrong why is it calling for this method?

[2020-08-22 14:23:13] local.ERROR: Call to undefined method App\User::uriKey() {"userId":1,"exception":"[object] (BadMethodCallException(code: 0): Call to undefined method App\User::uriKey() at /Users/devionti/Sites/Dev/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:50)
    public function subject()
    {
        return $this->belongsToMany('App\Model\HelpDesk\Subject', 'users_subject', 'user_id', 'sub_id')->withTimestamps();
    }
   public function users()
    {
        return $this->belongsToMany('App\User', 'users_subject', 'sub_id', 'user_id')->withTimestamps();
    }