kshitizmittal

kshitizmittal

Member Since 1 Year Ago

Experience Points
4,270
Total
Experience

730 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

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

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
4,270 XP
Oct
02
1 month ago
Activity icon

Started a new Conversation Test

Test

Sep
24
1 month ago
Activity icon

Started a new Conversation Old Value In Edit Form

<input type="text" class="form-control" placeholder="First Name" name="first_name" id="first_name" 
                            value="{{ old('first_name', $employeedetail->first_name) }}">

Want to achieve the same thing, when I am using laravelcollective html :- Sample text input :-

{!! Form::text($name, $value, []) !!}
Sep
13
1 month ago
Activity icon

Started a new Conversation Routing

What happen when I mix api and web routes with each other.

Working will be same or not?

Sep
10
2 months ago
Activity icon

Replied to Convert Email To Json Object

Expected Output :-

{
    "email" : "The email has already been taken."
}
Activity icon

Started a new Conversation Convert Email To Json Object

Output in postman :-

{
    "email": [
        "The email has already been taken."
    ]
}

Code in Controller :-

$validator = Validator::make($request->all(), [
            'name'     => 'required|string|max:255',
            'email'    => 'required|string|email|max:255|unique:users',
            'password' => 'required|string|min:6|confirmed',
        ]);

        if ($validator->fails()) {
            return response()->json($validator->errors());
        }

Expected Response:-

{
    "email" : "The email has already been taken."
}

I want to conver email as JSON object

Sep
06
2 months ago
Activity icon

Replied to Holiday Calendar Package

After enabling calendar api. I got this 404.

file_get_contents(https://content.googleapis.com/calendar/v3/calendars/en.us%23holiday%40group.v.calendar.google.com/events?singleEvents=false&amp;timeMax=2020-01-01T00:00:00-00:00&amp;timeMin=2019-09-06T00:00:00-00:00&amp;key=App-Key): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
Activity icon

Replied to Holiday Calendar Package

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Project 1067463875990 is not found and cannot be used for API calls. If it is recently created, enable Calendar API by visiting https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=1067463875990 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "extendedHelp": "https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=1067463875990"
   }
  ],
  "code": 403,
  "message": "Project 1067463875990 is not found and cannot be used for API calls. If it is recently created, enable Calendar API by visiting https://console.developers.google.com/apis/api/calendar-json.googleapis.com/overview?project=1067463875990 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
 }
}
Activity icon

Replied to Holiday Calendar Package

What exactly I need to do? I have changed my key.

Still I am facing same issue.

Activity icon

Started a new Conversation Holiday Calendar Package

$instance = new \Google\Holidays();
$holidays = $instance->withApiKey('App-Key')
                     ->inCountry('US')
                     ->withMinimalOutput()
                     ->list();
dd($holidays);

Package Link :- https://github.com/stephenlake/php-google-holidays

Error :-

file_get_contents(https://content.googleapis.com/calendar/v3/calendars/en.us%23holiday%40group.v.calendar.google.com/events?singleEvents=false&amp;timeMax=2020-01-01T00:00:00-00:00&amp;timeMin=2019-09-06T00:00:00-00:00&amp;key=App-Key): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
Aug
26
2 months ago
Activity icon

Started a new Conversation Change Key Of Collection Array

Original output :-

Collection {#2137 ▼
  #items: array:4 [▼
    0 => MonthlyPerfornamceView {#2136 ▶}
    1 => MonthlyPerfornamceView {#2134 ▶}
    2 => MonthlyPerfornamceView {#2130 ▶}
    3 => MonthlyPerfornamceView {#2132 ▶}
  ]
}

Code :-

$monthly_performance_data = MonthlyPerfornamceView::where(['emp_id' => $id, 'year' => date('Y')])->orderBy('pd_id', 'asc')->get();

dd($monthly_performance_data);

I want output in such a fasion where keys [0,1,2,3] should be changed to [Jan,Feb,Mar,Apr]. PS :- There is 'month' field in each array which should come there as key.

Tried Code :-

$monthly_performance_data = MonthlyPerfornamceView::where(['emp_id' => $id, 'year' => date('Y')])->orderBy('pd_id', 'asc')->get();
        
$monthly_performance_data->map(function($monthly_performance_data) {
            $monthly_performance_data = $monthly_performance_data->keyBy('month');
            return $monthly_performance_data;
        });
dd($monthly_performance_data);

Error :-

Call to undefined method App\MonthlyPerfornamceView::keyBy()
Activity icon

Replied to Change Keys To Collection

When I am trying this, I am getting Call to undefined method App\MonthlyPerfornamceView::keyBy() this error.

Code :-

$monthly_performance_data = MonthlyPerfornamceView::where(['emp_id' => $id, 'year' => date('Y')])->orderBy('pd_id', 'asc')->get();
        
        $monthly_performance_data->map(function($monthly_performance_data) {
            $monthly_performance_data = $monthly_performance_data->keyBy('month');
            return $monthly_performance_data;
        });
        dd($monthly_performance_data);

'month' refers to data in below collection:-

Collection {#2137 ▼
  #items: array:4 [▼
    0 => MonthlyPerfornamceView {#2136 ▼
      #table: "performance_view"
      #connection: "mysql"
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:78 [▶]
      #original: array:78 [▼
        "pd_id" => 3
        "emp_id" => "502109"
        "month" => "Jan"
        "year" => 2019
        "queue" => "Normal"
        "total_present" => "25"
        "abs_leave_holiday_count" => "2"
        "shift_adherence" => "100.00"
        "vintage" => "24+"
        "required_efficiency_hour" => "187:30:00"
        "busy" => "100:33:43"
        "ready" => "66:31:15"
        "total_efficiency_time" => "190:19:58"
        "avg_efficiency" => "07:36:48"
        "lack_of_hours_in_efficiency" => "Surplus Work"
        "acc" => "3279"
        "acc_avg" => "131.16"
        "dde" => "5378"
        "dde_avg" => "215.12"
        "iv_scan" => "0"
        "iv_scan_avg" => "0"
        "aht_1" => "15.428789265019823"
        "aht_2" => "53.73837857939755"
        "iv_aht" => null
        "total_scan_check" => "539"
        "id_scan_check" => "539"
        "iv_scan_check" => "0"
        "qc_percent" => "10.022313127556712"
        "face_match_error" => "0"
        "process_error" => "0"
        "typing_error" => "2"
        "fraud_error" => "1"
        "error" => "3"
        "overall_accuracy" => "99.44341372912801"
        "id_accuracy" => "99.44341372912801"
        "iv_accuracy" => null
        "escalations" => "0"
        "sla_percent" => "94.48"
        "updated_at" => null
        "created_at" => null
        "rd_low_scan" => "2850"
        "rd_low_aht" => "44.96"
        "rd_medium_scan" => "1356"
        "rd_mediun_aht" => "51.92"
        "rd_high_scan" => "1172"
        "rd_high_aht" => "77.18"
        "rd_overall_scan" => "5378"
        "rd_overall_aht" => "53.74"
        "dsd_low_scan" => "293"
        "dsd_low_aht" => "30.18"
        "dsd_medium_scan" => "59"
        "dsd_mediun_aht" => "42.19"
        "dsd_high_scan" => "31"
        "dsd_high_aht" => "37.52"
        "dsd_overall_scan" => "383"
        "dsd_overall_aht" => "32.63"
        "icrd_total_scans_processed_id" => "5378"
        "icrd_approved_verified_id" => "4347"
        "icrd_type_one_id" => "0"
        "icrd_grossed_up_one_id" => "0"
        "icrd_vca_id" => "100"
        "icrd_type_two_id" => "1"
        "icrd_grossed_up_two_id" => "10"
        "icrd_icr_id" => "92.59"
        "icrd_audit_id" => "539"
        "icrd_audit_percent_id" => "10"
        "icrd_denied_fraud_id" => "125"
        "icrd_fm_scan_iv" => "0"
        "icrd_type_one_iv" => "0"
        "icrd_grossed_up_one_iv" => "0"
        "icrd_vca_iv" => ""
        "icrd_type_two_iv" => "0"
        "icrd_grossed_up_two_iv" => "0"
        "icrd_icr_iv" => "100"
        "icrd_fm_audit_iv" => "0"
        "icrd_audit_percent_iv" => ""
        "icrd_not_match_scan_iv" => "0"
        "orm_overall_incentive_rating" => "5"
      ]
      #changes: []
      #casts: []
      #dates: []
      #dateFormat: null
      #appends: []
      #dispatchesEvents: []
      #observables: []
      #relations: []
      #touches: []
      +timestamps: true
      #hidden: []
      #visible: []
      #fillable: []
      #guarded: array:1 [▶]
    }
    1 => MonthlyPerfornamceView {#2134 ▶}
    2 => MonthlyPerfornamceView {#2130 ▶}
    3 => MonthlyPerfornamceView {#2132 ▶}
  ]
}
Aug
05
3 months ago
Activity icon

Started a new Conversation Prevent Changes In Url Route Parameter

URL :-

http://10.20.30.40/jconnectp4/promotion/promotion?id=19

Can we restrict user to change the route parameter?

Activity icon

Started a new Conversation Multiple Queries Handling

$insertPromotionDetails = Promotion::create($input);

$updateArr = ['depssssartment' => $insertPromotionDetails->new_department,'designation' => $insertPromotionDetails->new_designation,'band' => $insertPromotionDetails->new_band,'level' => $insertPromotionDetails->new_level,'reports_to' => $insertPromotionDetails->new_supervisor];

$employeeUpdate = Employeedetail::where(['emp_id'=>$insertPromotionDetails->emp_id])->update($updateArr);

Here I am creating a record in Promotion table and updating a record in Employeedetail table.

I need to implement in such a way that either both the cases should return true or both should return false.

Currently If statement 1 got executed and there is error in statement 2 then record created by statement 1 is already there.

Aug
03
3 months ago
Activity icon

Started a new Conversation Shortcut For (@$value ? @$value : 'N/A')

Is there any shortcut to return same value if exists otherwise 'N/A'.

Aug
02
3 months ago
Activity icon

Started a new Conversation Multiple Fields Belongs To Same Model In One Function

public function employeeDetails(){
        return $this->belongsTo('App\Employeedetail','emp_id','emp_id');
    }
    public function supervisorActionBy(){
        return $this->belongsTo('App\Employeedetail','supervisor_action_by','emp_id');
    }
    public function adminActionBy(){
        return $this->belongsTo('App\Employeedetail','admin_action_by','emp_id');
    }

Here in all 3 functions different fields belongs to one Model only so, Is there any way to incorporate this in one function?

Jul
17
3 months ago
Activity icon

Started a new Conversation Relations With If Condition

Can I put condition while making relations? like this :-

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class MidYearReviewTemplate extends Model
{
    protected $table = 'mid_year_review_template';
    protected $fillable = ['template_name','department','designation','process_type'];

    /* === Department Relation === */
    public function departmentDetails()
    {
        return $this->belongsTo('App\Department','department','deptid');
    }

    /* === Designation Relation === */
    public function designationDetails()
    {
        return $this->belongsTo('App\Designation','designation','degid');
    }

    /* === Goals Relation === */
    public function goals()
    {
        if($this->process_type == 'Non-Operations'){
            return $this->hasMany('App\MidYearReviewTemplateGoal','mid_year_review_template_id','id');
        } else {
            return null;
        }
    }
}

Facing Error when trying to call :-

public function midYearReview(){
        $templates = MidYearReviewTemplate::with('departmentDetails','designationDetails','goals')->get();
        dd($templates);
        return view('performancemanagementlayout.midyearreview');
    }

Error :-

"Call to a member function addEagerConstraints() on null"
Jun
24
4 months ago
Activity icon

Started a new Conversation CRON Job On Production Server

Our application is deployed on a server based in UTC timezone, but the application's native timezone is 'Asia/Kolkata' and in kernel.php i have written a cron job ->cron(0,0,*,*,*) , and on production server a command php artisan schedule:run is scheduled at 5:30 UTC.

Which always shows no scheduled tasks to run.

How can I solve this issue.

May
30
5 months ago
Activity icon

Replied to Chart Js Change Axes Type

@JOHNBRAUN - How do I apply these change in controller ?

May
28
5 months ago
Activity icon

Started a new Conversation Chart Js Change Axes Type

I need to change the y-axis as time in format of hh:mm:ss Below is the controller code in which $avg_efficiency_data->values() is in time format.

$efficiencyChart = new SampleChart;
        $efficiencyChart->labels($avg_efficiency_data->keys());
        $efficiencyChart->dataset('Efficiency Avg', 'line', $avg_efficiency_data->values())->options(['backgroundColor' => '#A569BD', 'fill' => false, 'borderColor' => '#A569BD']);

Package used is :- https://charts.erik.cat/supported_libraries.html#chartjs-2-7-1

Please help.

May
21
5 months ago
Activity icon

Started a new Conversation Memory Error Because Of Telescope Package

When I try to fetch large amount of data on my blade page. following error restricts me to do so.

Path : - C:\inetpub\wwwroot\jconnectproductionserver\vendor\laravel\telescope\src\Watchers\RequestWatcher.php

Error :- "Allowed memory size of 268435456 bytes exhausted (tried to allocate 54530048 bytes)"

I feel this is because of telescope package.

How to remove telescope package?

May
16
5 months ago
Activity icon

Started a new Conversation Fetch Model Attributes In Yajra Datatable

I need to fetch custom model attribute in Yajra datatable, also there are custom attributes in relationship also which I need to fetch in datatable.

I have one attendance_status custom attribute in AttendanceReport.

And one full_name custom attribute in Employeedetail model which I am fetching here in with() function.

This is controller code :-

public function serverSide(){
        $attendacereport = AttendanceReport::whereRaw("emp_id='710102'")->with('employeedetail.departments','employeedetail.designations')->->select(['emp_id','punch_in','punch_out','attendance_status'])get();

        return Datatables::of($attendacereport)->make();
    }

Datatble Script :-

<script>
    $(document).ready(function() {
        $('.datatable').DataTable({
            processing: true,
            serverSide: true,
            pageLength: 100,
            ajax: '{{ url('serverSide') }}',
            initComplete:function( settings, json){
                console.log(json.data);
                // call your function here
            },
            columns: [
                { data: 'emp_id', name: 'emp_id' },
                { data: 'employeedetail.full_name' , name: 'employeedetail.full_name' },
                { data: 'punch_in', name: 'punch_in' },
                { data: 'punch_out', name: 'punch_out' },
                { data: 'attendance_status', name: 'attendance_status' }
                
            ]
        });
    });
</script>

Struggling to get this please help me out.