dilfdo

dilfdo

Member Since 3 Years Ago

Experience Points 5,290
Experience Level 2

4,710 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 Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

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

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

07 Nov
1 year ago

dilfdo started a new conversation Dropzone Loop Through Dropped Files Before Uploading

I want to check the file extensions of the files and if its matching for certain values popup a message before uploading. They way I currently used works only one time and applies for all others on queue. pls advice

Dropzone.options.getDropzone = { url: "/upload/", paramName: "file", maxFiles: 5, maxFilesize: 50, // MB parallelUploads: 1, createImageThumbnails: false, accept: function(file, done) { var ext = file.name.split('.').pop().toLowerCase(); if ($.inArray(ext, ['mov', 'wav']) !== -1) { swal({ html: "+ '' + 'checkone' + '' + '' + 'checktwo' + '', showCancelButton: false, showConfirmButton: false }).catch(swal.noop); $(document).on('click', '#checkone', function() { alert("checkone done"); swal.clickConfirm(); done(); });

        $(document).on('click', '#rchecktwo', function() {
          alert("checktwodone");
            swal.clickConfirm();
            done();
        });
    }
    else {
        done();
    }
},

};

currently the alerts which I put is runs only onece even though I added multiple files with that extension. I want to show the alert for each files. pls advice

09 Dec
2 years ago

dilfdo started a new conversation Find An Email Address From The Link On Email Body

I want to pass an url to list of recipients and when each person clicked on the link i want to get there email address to the page which url links. Is this possible ? Please advice me

30 Jun
2 years ago

dilfdo started a new conversation Laravel 4 Firebase Update Reocrd Issue

Im using "j42/" library for firbase, when i try to update child record on firebase db, the default orders changed... but the required child has updated.

how can i overcome this... update record without changing the childs order

$firebase = Firebase::update('/Message/' . $firebase_token . '/' . $message_id, ['status' => 1])

17 Jun
3 years ago

dilfdo started a new conversation How To Get Specific Dates Using Carbon Object Laravel 5.2

I'm doing application for school. when adding classes i want to assign term end dates based on term duration

1st term (spring semester) : jan 2st week monday - may 2nd week friday 2nd term (summer semeseter) : monday may 3rd week - 1st week friday in August 3rd term - monday 3rd week of august - december 2nd week friday

How can i get those specific days using Carbon ? Please advice

dilfdo started a new conversation How To Automatically Logout User When Account Is Inactive

i want to logut user when he/she away from browser and when closing tab/browser .

is this allow on Laravel 5.2 ? Please advice

config/session.php

*/

'lifetime' => 15,

'expire_on_close' => true,

this is my current config. but even i edit this .nothing happend ,

07 Apr
3 years ago

dilfdo started a new conversation Laravel 5 Download Csv With Leading Zeros

up vote

0

down vote

favorite

1

when I generate my csv file , some of the special charactors and front zero of cell values are not getting . pls advice how to fix this ``` public function csv() { // $table = Festivals::all(); $headers = [ 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0' , 'Content-type' => 'text/csv' , 'Content-Disposition' => 'attachment; filename=sss.csv' , 'Expires' => '0' , 'Pragma' => 'public' ];

          $list = Festivals::select('ref_no','artist_name','postal_address','payment','payment_fee','bank_details','bank_name','bank_address','account_name','account_number','sort_code','reg_vat','vat_reg_number'

,'foreign_artise','name_desg','email','mobile','name_address','vehicle_size','backline','additional_backline','name','date')->get()->toArray();

    # add headers for each column in the CSV download
    array_unshift($list, array_keys($list[0]));

    $callback = function () use ($list) {
        $FH = fopen('php://output', 'w');
        foreach ($list as $row) {
            fputcsv($FH, $row);
        }
        fclose($FH);
    };

    return Response::stream($callback, 200, $headers);
}
24 Mar
3 years ago

dilfdo left a reply on Create Thumbnail From Image

@premsaurav

     Image::make('/images/logo/logo.png ',array(
            'width' => 50,
            'height' => 50,
            'grayscale' => true
        ))->save('/images/logo/thumb.png ');


i change it 

now img getting this error 

InvalidArgumentException in Image.php line 536: Saving image in "png " format is not supported, please use one of the following extensions: "gif", "jpeg", "png", "wbmp", "xbm"

dilfdo started a new conversation Create Thumbnail From Image

i want to create a thumbnial image and save it. i used "folklore/image": "0.3.* plugin , but im getting errors

pls advice

        $imagePath = $request->imagePath;
                $file = url('images/logo'). '/' . "edit.jpg";   /*Your Original Source Image */
                $pathToSave = url('images/logo1'). '/' ."edit1.jpg"; /*Your Destination Folder */

        
        Image::make($file,array(
            'width' => 300,
            'height' => 300,
            'grayscale' => true
        ))->save($pathToSave);
20 Mar
3 years ago

dilfdo started a new conversation How To Generate PDF From Blade Laravel 5.1

i want to generate pdf file when user clicking id of the each row of my index view

index.blade.php

 <td style="">{{$user->id}}</td>
      <td><a href="{{url('user') . '/' . $user->id . '/view'}}"><i class="glyphicon glyphicon-th-large"></i></a></td>



and my user view function in controller

public function customerView($id) {
    $user = Festivals::where('id',$id)->first();

return view('user.view',['user'=>$user,'type'=>'Customer - View User Details']);

}

i want to add generate pdf option when user click on index page id and in specific view page both.

please advice me

i tried using dompdf , but it didnt work

    public function pdf($id)
{
      $user = Festivals::where('id',$id)->first();
       $pdf = PDF::loadView('user.view', $user);
return $pdf->download('invoice.pdf');
}
18 Mar
3 years ago

dilfdo started a new conversation How To Create Subarrays From Filtering Main Array Results

im getting below data set from my laravel mysql query resutls.

`` { "id": 13, "name": "grapefruit", "lactose": "None", "fructose": "None", "polyols": "None", "fructan": "Moderate", "lactose_level": 1, "fructose_level": 1, "polyols_level": 1, "fructan_level": 2 }, { "id": 33, "name": "pomegranate", "lactose": "None", "fructose": "None", "polyols": "None", "fructan": "Moderate", "lactose_level": 1, "fructose_level": 1, "polyols_level": 1, "fructan_level": 2 }, { "id": 40, "name": "artichokes", "lactose": "None", "fructose": "None", "polyols": "None", "fructan": "High", "lactose_level": 1, "fructose_level": 1, "polyols_level": 1, "fructan_level": 3 }, { "id": 45, "name": "beetroot", "lactose": "None", "fructose": "None", "polyols": "None", "fructan": "Moderate", "lactose_level": 1, "fructose_level": 1, "polyols_level": 1, "fructan_level": 2 },

and from below code im retrivng all the categroy types with values which contains above results set

foreach ($fod as $key => $val) { $new_arr1[] = $val['polyols']; $new_arr2[] = $val['lactose']; $new_arr3[] = $val['fructose']; $new_arr4[] = $val['fructan']; }

    $uniq_arr1 = array_unique($new_arr1);
    $uniq_arr2 = array_unique($new_arr2);
    $uniq_arr3 = array_unique($new_arr3);
    $uniq_arr4 = array_unique($new_arr4);


    $levels = ['polyols' => $uniq_arr1, 'lactose' => $uniq_arr2, 'fructose' => $uniq_arr3, 'fructan' => $uniq_arr4];

    return $levels;

{ "polyols": [ "None" ], "lactose": [ "None" ], "fructose": [ "None" ], "fructan": { "0": "Moderate", "2": "High" } }

17 Mar
3 years ago

dilfdo started a new conversation Getting Opposite Results From Laravel Sql Resutls

I want to get the opposite results of my current querey. which means to get the results which not coming under current query. how can i proceed this ?

my current querry is

    $fod = FodMap::select('*')
        ->where('fructose_level', $fructose == 1 ? '=' : '>=', $fructose)
        ->where('lactose_level', $lactose == 1 ? '=' : '>=', $lactose)
        ->where('polyols_level', $polyols == 1 ? '=' : '>=', $polyols)
        ->where('fructan_level', $fructan == 1 ? '=' : '>=', $fructan)
        ->get();

how to get everything that doesn't fall under the above query. pls advice

16 Mar
3 years ago

dilfdo started a new conversation Laravel Where Clause Help

i wnat to perform search function with laravel for following scenario,

user can select 4 types , each type can contain value 1,2,3

if user select '1' as value for any type , On sql where clause i want to put "==", all the other values i want to put where clause with ">="

ex:
if user enters valuse $type1 = 2 , $type2 = 1 , $type3 = 1, $type4 = 3

$type1 = $request->type1;
$type2 = $request->type2;
$type3 = $request->type3;
$type4 = $request->type4;


$min = '=';
$max = '>=';

how can i make my sql query in following way according to the values enter... pls advice $fod = FodMap::select('*') ->where('type1',$max,$type1) ->where('type2',$min,$type2) ->where('type3',$min,$type3) ->where('type4',$max,$type4) ->get();

10 Mar
3 years ago

dilfdo started a new conversation Laravel Eloquent With Multiple Where And OrWhere Clauses

below is my search query i want to search data to followinig critieria

cusine or mealname = $cusine and country = $country and block_seller = 0 but currently it doesnt check the where clauses after orWhere, which means country and block_seller where clauses are not working.

please advice `` $meals = Meals::select('*') ->selectRaw("( 6371 * acos( cos( radians($latitude) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($longitude) ) + sin( radians($latitude) ) * sin( radians( latitude ) ) ) ) AS distance")

                ->where('cuisine', 'LIKE', "%$cuisine%")
                ->orWhere('meal_name', 'LIKE', "%$cuisine%")
                ->where('country', "$country")
                ->where('blocked_seller', 0)
                ->with('Meals_images')
                ->orderBy('distance', 'ASC')
                ->get();
24 Feb
3 years ago

dilfdo started a new conversation Add Email Addresses To Mailchimp

When the user register with the app, i want to add the email/username to mailchimp . how can i proceed . please advice

10 Feb
3 years ago

dilfdo started a new conversation Laravel 5.1 Schedule Run Not Working

i have tried run schedule run command in my Crazydomain server, im getting following error

[ErrorException] Invalid argument supplied for foreach()

my code php -q /home8/gprabook/public_html/GPRA/artisan schedule:run

please advice

09 Feb
3 years ago

dilfdo started a new conversation Laravel 5.2 Routes Issue

Laravel 5.2 route issue..

I'm using laravel 5.2 and my routes.php file have route

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

this is what I get with new installation. but I want to load login page with this route . when I change it ti

Route::get('/', function () { return view('auth.login'); });

it gives me following error

ErrorException in 3939fba00053c6941e222b4a600a7ee46cf9b2a6.php line 12: Undefined variable: errors (View: D:\xamp\htdocs\project\resources\views\auth\login.blade.php)

please advice me how to fix

20 Jan
3 years ago
19 Jan
3 years ago

dilfdo started a new conversation How To Change Rember_token Column Name

i have changed the rember_token column name as "token" in my user table. now when im loggin out im getting following error

`` SQLSTATE[42S22]: Column not found: 1054 Unknown column 'remember_token' in 'field list' (SQL: update users set updated_at = 2016-01-20 04:55:36, remember_token =

how to fix this without changing vendor files

dilfdo left a reply on How To Get The Current Week Using Carbon With Laravel

@Prullenbak : im maintaining Thursdays of the year in a table . so all the thursday dates are in that table. in my application i want to load the current week thursday with next 9 weeks thursdays inside dropdown box.

P.s: my application consider as Week start from Thursday..

so i want to get that from database. ex: today is 19/01/2016 so the thursday belongs to today is 14/01/2-16. so i want to load that thursday with next 9 weeks thursday. hope this clear

dilfdo started a new conversation How To Get The Current Week Using Carbon With Laravel

I have db with all the Thursdays dates of the current year. i want to get only the current week and upto 9 weeks every time when retrieve data pls advice me how ti proceed

weeks table contain

id week_starting_date

week_starting_date store like this

2016-01-07 2016-01-14 2016-01-21

25 Nov
3 years ago

dilfdo started a new conversation Keep Drop Down Values After Form Submission

I want to keep my drop down selected values after submit the form . pls advice

 
  <form class="form-inline"  action="{{ action('TimesheetsController@store') }}" method="POST" >
                                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                                    <div class="section-one">
                                <div class="form-group driver-drop">
                                    <div class="input-group">
                                        <select class="form-control" id="user_id" name="user_id" required="required">
                                            <option disabled selected>Select Driver:</option>
                                            @foreach($Role_user as $Roles)
                                                        <option value="{{ $Roles->id }}">{{ $Roles->username }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="input-group">
                                        <select class="form-control" id="week_starting_date" name="week_starting_date" required="required">
                                            <option disabled selected>Select Week:</option>
                                            @foreach($weeks as $weeks)
                                                <option value="{{ $weeks->id }}">{{ $weeks->week_starting_date }}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                    </div>

          <div class="form-group">
                                            <div class="form-group">
                                            <div class="input-group">
                                        <button  style="width:160px;" type="submit" class="btn btn-default  btn-bottom-margin">Add Shift</button>
                                    </div></div>


                                        <div class="form-group">
                                            <div class="input-group">
                                                <button  style="width:160px;" type="reset" class="btn btn-default  btn-bottom-margin">Clear</button>
                                            </div>
                                        </div>

                                    </div>

                            </form>
19 Nov
3 years ago

dilfdo left a reply on Calculating Total Hours From Times Laravel Sql

@devtraining : im getting following error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT time(sum(TIMEDIFF( shift_end_time, shift_start_time ))) from `shifts` whe' at line 1 (SQL: select SELECT time(sum(TIMEDIFF( shift_end_time, shift_start_time ))) from `shifts` where `time_sheet_id` = 29)


                $no_of_hours = DB::Table('shifts')
                    ->where('time_sheet_id','=', $timesheet_id->id)
                     ->selectRaw('SELECT time(sum(TIMEDIFF( shift_end_time, shift_start_time )))')
                    ->get();

dilfdo left a reply on Calculating Total Hours From Times Laravel Sql

@devtraining : this give result as string if sum value is 10 hours and 30minutes it shows as 103000 pls advice

dilfdo left a reply on Calculating Total Hours From Times Laravel Sql

@spyworld how can i get the sum for specific timesheet_id using this?

dilfdo started a new conversation Calculating Total Hours From Times Laravel Sql

how to calculate total hours from number of rows using laravel

time_sheet_id     shift_start_time     shift_end_time

35                  08:00:00            10:00:00

35                  10:00:00            13:00:00

35                  13:00:00            15:00:00

36                  13:00:00            15:00:00

36                  13:00:00            15:00:00


36                  13:00:00            15:00:00


i want to calculate no of hours for each timesheet_id . pls advice

18 Nov
3 years ago

dilfdo started a new conversation Laravel Time Overlap Checking Issue With Query Builder...

please help me to fi this. i want to check shift time overlapping when user adding or editing shit time

here is example of table where current shifts times

1 )shift:1 start_time 04:00 end_time 05:00
2)shift 2  start_time 09:00 end_time 11:00


when i update shit 2 to start_time 04:20 end_time 04:30   it should give error since its overlapping with shift 1

im checking whether shift overlapped by below query

$shiftData = Shifts::where('time_sheet_id', '=', $timesheet_id->id) ->where('user_id', '=', $driver_id->id) ->where('role_id', '=', 1) ->whereBetween('shift_start_time', array($shift_start , $shift_end)) ->whereBetween('shift_end_time' , array($shift_start , $shift_end)) ->count();

but with this query i still can add start_time 04:20 end_time 04:30 value even it overlapp ? how to change my query to check inbetween values as well ? pls advice

17 Nov
3 years ago

dilfdo started a new conversation Creating Custom Laravel Array

please advice me how to make an array like that using following 3 queries.


     $shiftsids = Shifts::select('id','shift_no', 'bus_no', 'shift_start_time', 'shift_end_time', 'run_type')
                        ->where('user_id', '=', $driver_id->id)
                        ->where('week_id', '=', $week_id->id)
                        ->where('time_sheet_id', '=', $timesheet_id->id)
                        ->get();
    
    
                    $preCheck = DB::table('driver_pre_departure_items')
                        ->join('shifts', 'shifts.id', '=', 'driver_pre_departure_items.shift_id')
                        ->select('shift_id','item','value')
                        ->where('driver_pre_departure_items.shift_id', '=', $shiftsid->id)
                        ->get();
    
                    $postCheck = DB::table('driver_shift_end_items')
                            ->join('shifts', 'shifts.id', '=', 'driver_shift_end_items.shift_id')
                            ->select('shift_id','item','value')
                            ->where('driver_shift_end_items.shift_id', '=', $shiftsid->id)
                            ->get();

this is how i want to out out the results.
i want to display preCheck and postCheck for each shift_id like below.
how can i proceed this

{
  "data": [
    {
      "shift_no": 1,
      "bus_no": "",
      "shift_start_time": "08:00:00",
      "shift_end_time": "10:00:00",
      "run_type": "S",
      "driver_pre_departure_items": [
        {
          "pre_departure_type": 1,
          "item_name": "Check all running lights & indicators",
          "value": 0
        },
        {
          "pre_departure_type": 2,
          "item_name": "Look for tyres that are flat or partly flat- check wheel nuts",
          "value": 0
        }
      ],
      "driver_shift_end_items": [
        {
          "shift_end_type": 1,
          "item_name": "Record any problems in defect book",
          "value": 0
        },
        {
          "shift_end_type": 2,
          "item_name": "Tell management or mechanic if there are any problems that require attention",
          "value": 0
        }
      ]
    },
16 Nov
3 years ago

dilfdo started a new conversation Change Default Date Format In Laravel Raw Sql Query

I want to return date as DD/MM/YYY format in following query. I tries something but didn't work please advice

  $getTimesheets = DB::table('time_sheets')
                ->join('users', 'users.id', '=', 'time_sheets.user_id')
                ->join('role_users', 'role_users.user_id', '=', 'users.id')
                ->join('roles', 'role_users.role_id', '=', 'roles.id')
                ->select('time_sheets.progress',DATE_FORMAT('time_sheets.date', "%d/%l/%Y") ,'role_users.role_id','roles.role_name')
                ->where('role_users.user_id', '=' ,$findUser->id)
                ->get();

10 Nov
3 years ago

dilfdo left a reply on Converting Mysql Query To Laravel

@Crudal can you helo me to cinvert that mysql query to whereRaw

SELECT * FROM shifts WHERE time_sheet_id = 11 AND ( "04:00" BETWEEN shift_start_time AND shift_end_time OR "05:00" BETWEEN shift_start_time AND shift_end_time OR "04:00" >= shift_start_time AND "05:00" <= shift_end_time

)

this is what i tried

        $shiftData=   DB::table(DB::raw('shifts'))
            ->whereRaw('time_sheet_id = $getTimesheet1->time_sheet_id AND user_id = $user_id->user_id')
            ->whereRaw('Input::get('shift_start_time') BETWEEN shift_start_time AND shift_end_time OR
    Input::get('shift_end_time') BETWEEN shift_start_time AND shift_end_time OR
    Input::get('shift_start_time') >= shift_start_time AND Input::get('shift_end_time') <= shift_end_time')
            ->count();

dilfdo left a reply on Converting Mysql Query To Laravel

@Curdal its not working for following sceneario

if there is a shift already exist 09:00 to 12:00 and when im trying to add 10:00 to 11:00 its adding instead of giving error

dilfdo started a new conversation Converting Mysql Query To Laravel

Please advice how to convert below query to laravel

`` SELECT * FROM shifts WHERE time_sheet_id = 11 AND ( "04:00" BETWEEN shift_start_time AND shift_end_time OR "05:00" BETWEEN shift_start_time AND shift_end_time OR "04:00" >= shift_start_time AND "05:00" <= shift_end_time

)

this is what i tried , but it gives errors

`` $shiftData = Shifts::where('time_sheet_id', '=', $getTimesheet1->time_sheet_id) ->where('user_id', '=', $user_id->user_id) ->where('role_id', '=', 1) ->whereBetween(Input::get('shift_start_time'), array('shift_start_time ' , 'shift_end_time ')) ->whereBetween(Input::get('shift_end_time') , array('shift_start_time ' , 'shift_end_time ')) ->where( Input::get('shift_end_time'), '>=', 'shift_start_time ') ->where(Input::get('shift_end_time'), '<=', 'shift_end_time ') ->get();

error ``SQLSTATE[42S22]: Column not found: 1054 Unknown column '18:00:00' in 'where clause' (SQL: select * from shifts where time_sheet_id = 12 and user_id = 2 and role_id = 1 and 18:00:00 between shift_start_time and shift_end_time and 20:00:00 between shift_start_time and shift_end_time and 20:00:00 >= shift_start_time and 20:00:00 <= shift_end_time )

03 Nov
3 years ago

dilfdo left a reply on Get Mondays Of A Current Month Laravel Carbon

@coder and @jekinney

this is my kernel

    public function handle()
    {
        $getMonday = Carbon::parse('monday of current month')->toDateString();

        $Weeks = new Week();
        $Weeks->week_starting_date   = $getMonday;
        $Weeks->save();

        return $Weeks;
    }

dilfdo left a reply on Get Mondays Of A Current Month Laravel Carbon

@coder : What i exactly want is schedule a task for storing mondays of every month in my "weeks" table. will i be able to get all the mondays of current week through carbon command ? pls advice

02 Nov
3 years ago

dilfdo started a new conversation Get Mondays Of A Current Month Laravel Carbon

How to get the mondays of current month and save it on DB .pls advice

dilfdo left a reply on Write A Cron Command For Saving Values On DB

Inspire.php

public function saveWeek()
    {
        $hello1 = Carbon::parse('this thursday')->toDateString();

        $Weeks = new Week();
        $Weeks->week_starting_date   = $hello1;
        $Weeks->role_id = 1;
        $Weeks->user_id=2;
        $Weeks->save();

        return $hello1;
    }


Kernel.php

protected function schedule(Schedule $schedule) { $schedule->command('inspire') ->everyMinute(); }

and i run this commnad to check php artisan schedule:run

dilfdo started a new conversation Write A Cron Command For Saving Values On DB

How to write a cron command for generate thursday of every week and save it on db whenver admin logs to system . please advice

14 Oct
3 years ago

dilfdo started a new conversation How To Save Multii Dimentional Array In Db Rows

im getting following data through service url and i want to store it in my db

`` value = 1:1,2:0,3:1,4:0,5:1,6:1,7:0,8:0,9:1,10:0

i manage to make it in this way to get values seperate

`` $result = array(); foreach (explode(',',$value) as $sub) { $subAry = explode(':',$sub); $result[$subAry[0]] = $subAry[1];

            }
            return $result;

return : { "1": "a", "2": "b", "3": "c", "4": "d", "5": "v", "6": "h, "7": "0", "8": "0", "9": "l", "10": "0" }

i want to store those in rows two separetd columns.

my controller

`` $DriverPreDepartureItems = new DriverPreDepartureItems(); $DriverPreDepartureItems->user_id = $driver_id->id;

                $DriverPreDepartureItems->shift_id = $find_shift->id;
                $DriverPreDepartureItems->type = ;
                $DriverPreDepartureItems->value = ;

                $DriverPreDepartureItems->save();

below two are the columns whic values need to store. pls advice
$DriverPreDepartureItems->type = ; $DriverPreDepartureItems->value = ;

13 Oct
3 years ago

dilfdo left a reply on At RouteCollection->methodNotAllowed(array('DELETE')) In RouteCollection.php Line 206

@veve286

thanks it works.

btw can you please advice me how to add confirm delete alert, to this

`` "";

this is what i tried , but it doesnt work

12 Oct
3 years ago

dilfdo started a new conversation At RouteCollection->methodNotAllowed(array('DELETE')) In RouteCollection.php Line 206

im getting error when deleting

 success: function(data) {
                    var json_obj = $.parseJSON(data);//parse JSON

                    var output="<tr>";
                    for (var i in json_obj)
                    {
                        var url = "{{url('edit-shift')}}/"  + json_obj[i].id;
                        var del_url = "{{url('destroy-shift')}}/"  + json_obj[i].id;
                      
//                        $('#val2').val(shiftid);
                        output+=
                                "<td>" +  json_obj[i].id + "</td>"+
                                "<td>" +  json_obj[i].bus_no + "</td>"+
                                "<td>" +  json_obj[i].shift_no + "</td>"+
                               "<td>" +  json_obj[i].shift_start_time + "</td>"+
                               "<td>" +  json_obj[i].shift_end_time + "</td>"+
                               "<td>" +  json_obj[i].run_type + "</td>"+
                                "<td><a data-toggle='modal'  data-target='#myModal3' href='" + url +"' >EDIT</a><a href='" + del_url +"' >DEL</a></td>";


                        output+="</tr>";

                    }


                    $('#span').html(output);



routes


Route::delete('destroy-shift/{id}', ['as' => 'destroy-shift', 'uses' => 'TimesheetsController@destroy']);

controller

``

public function destroy($id)
{
    $shift = Shifts::findOrFail($id);

    $shift->delete();

    return "done";
}

dilfdo started a new conversation Edit Form With Jquery Modal And Ajax

I'm loading data to a table using ajax call and from that each row I want to edit using jquery modal box.

I'm struggling with passing id as hidden value to edit form every time it pass only last id instead of correct id. pls advice me to fix this

``

    <!-- page title-->
    <div class="col-xs-12">
        <div class="row">
            <div class="col-xs-12">
                <div class="row top-padding"></div>
                <div class="container-fluid">
                    <div class="row">
                        <form class="form-inline" action="{{ action('TimeSheetsController@store') }}" method="POST">
                            <input type="hidden" name="_token" value="{{ csrf_token() }}">

                            <div class="form-group">
                                <label for="">Select Driver</label>

                                <div class="input-group">

                                    <select class="form-control" id="user_id"  name="user_id">
                                        <option  disabled selected>Select Driver:</option>
                                        @foreach($Role_user as $Roles)

                                            @if($getUsers = $Roles->user()->get())
                                                @foreach( $getUsers as $getUser)
                                                    <option value="{{ $getUser->id }}">{{ $getUser->username }}</option>
                                                @endforeach
                                            @endif

                                        @endforeach
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="">From:</label>

                                <div class="input-group">
                                    <select class="form-control" id="week_starting_date" name="week_starting_date">
                                        <option  disabled selected>Select Week:</option>
                                        @foreach($weeks as $weeks)

                                            <option value="{{ $weeks->id }}">{{ $weeks->week_starting_date }}</option>

                                        @endforeach
                                    </select>
                             <span class="input-group-btn">
                                    <button type="button" class="btn btn-default">
                                        <i class="fa fa-calendar"></i>
                                    </button>
                             </span>
                                </div>
                            </div>

                            </br></br>

                            <div class="form-group">
                                <label for="">Run Type</label>

                                <div class="input-group">

                                    <select class="form-control" name="run_type">
                                        <option value="S">S</option>
                                        <option value="G">G</option>
                                        <option value="R">R</option>
                                    </select>
                                </div>
                            </div>

                            <div class="input-group">
                                <input type="text" id="date" name="date" class="form-control datepicker"
                                       value="{{old('date')}}">
                                <label class="input-group-addon btn" for="date">
                                    <i class="fa fa-calendar"></i>
                                </label>
                            </div>


                            </br>
                            </br>


                            <div class="form-group">
                                <label for="">Shift Start:</label>

                                <div class='input-group date' id='datetimepicker3'>
                                    <input type='text' name="shift_start" class="form-control" id='datetimepicker3'
                                           value="{{old('shift_start')}}"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-time"></span>
                </span>

                                </div>


                                <div class="form-group">
                                    <label for="">Shift End:</label>

                                    <div class='input-group date' id='datetimepicker5'>
                                        <input type='text' name="shift_end" class="form-control"
                                               value="{{old('shift_end')}}"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-time"></span>
                </span>

                                    </div>
                                </div>
                                <br><br>

                                Shift <input type="text" class="form-control" name="shift_no"
                                             value="{{old('shift_no')}}"/>


                                <div class="input-group">
                                    <button type="submit" class="btn btn-success  btn-bottom-margin">Add Shift
                                    </button>
                                </div>

                        </form>
                    </div>
                    <!-- row-->


                    <!-- container-->
                    <br>

                    <div class="panel panel-default">
                        <div class="panel-body">
                            <p class="bg-danger cus_padding1 text-center" ng-show="!driverDetails">You need to
                                select a driver & add a date to proceed.</p>
                            <table class="table table-hover">
                                <tr class="table-header">
                                    <th>Day</th>
                                    <th>Date</th>
                                    <th>Start</th>
                                    <th>End</th>
                                    <th>Total
                                        <br/> Hours
                                    </th>
                                    <th>Run
                                        <br/> Type
                                    </th>
                                    <th>Edit
                                        <br/> / Delete
                                    </th>
                                </tr>
                               <tbody id="span">



                               </tbody>


                            </table>
                            <p class="bg-primary cus_padding1 text-right" ng-show="showTotalHours">Total Hours for
                                the week (hh:mm) = ss</p>
                        </div>
                    </div>
                    <!-- panel-->
                </div>
            </div>
        </div>
        <!-- page data-->
EDIT Shift--> id }}" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
                       <div class="span2"></div>
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title" id="">Edit Shift</h4>
                        </div>
                        <!-- modal-header-->
                        <div class="modal-body">
                            <div class="popup-container">


                                <div class="form-group">
                                    <label for="" class="col-sm-3 control-label">Run Type</label>

                                    <div class="col-sm-9">
                                        <select class="form-control" id="run_type" name="run_type">
                                            <option value="S">S</option>
                                            <option value="G">G</option>
                                            <option value="R">R</option>
                                        </select>
                                        <input autocomplete="off" id="run_type"  type="text" class="form-control" name="run_type" value="">
                                    </div>
                                </div>
                                <!-- form-group-->
                                <div class="form-group">
                                    <label for="" class="col-sm-3 control-label lbl-padding">Start Time </label>

                                    <div class="col-sm-9">
                                        <div class='input-group date' id='datetimepicker6'>

                                            <input type='text' class="form-control"/>

                                            <span class="input-group-addon">
                                                <span class="glyphicon glyphicon-time"></span>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                                <!-- form-group-->
                                <div class="form-group">
                                    <label for="" class="col-sm-3 control-label lbl-padding"> End Time</label>

                                    <div class="col-sm-9">
                                        <div class='input-group date' id='datetimepicker7'>
                                            <input type='text' class="form-control"/>
                <span class="input-group-addon">
                    <span class="glyphicon glyphicon-time"></span>
                </span>
                                        </div>
                                    </div>
                                </div>
                                <!-- form-group-->

                            </div>
                            <!-- container-->
                        </div>
                        <!-- modal-body-->
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary">Save Changes</button>
                        </div>
                        <!-- model footer-->
                    </form>
                </div>
                <!-- MODEL CONTENT-->
            </div>
            <!-- modal-dialog-->
        </div>
        <!-- end of model-->

    
<script>


    $(document).ready(function() {
        $("#week_starting_date, #user_id").change(function(){

            var week_starting_date = $('#week_starting_date option:selected').val();
            var user_id = $('#user_id option:selected').val();
            if(week_starting_date && user_id) {
                $.ajax({
                    url: "{{url ('getdriver')}}",
                    type: "GET",
                    dataType: "HTML",
                    async: false,
                    data:{week_starting_date:week_starting_date,user_id:user_id},
            success: function(data) {
                var json_obj = $.parseJSON(data);//parse JSON

                var output="<tr>";
                for (var i in json_obj)
                {
                    var url = "{{url('edit-shift')}}/"  + json_obj[i].id;
                    var del_url = "{{url('destroy')}}/"  + json_obj[i].id;
                    var shiftid =  json_obj[i].id;

// $('#val2').val(shiftid); output+= "" + json_obj[i].id + ""+ "" + json_obj[i].bus_no + ""+ "" + json_obj[i].shift_no + ""+ "" + json_obj[i].shift_start_time + ""+ "" + json_obj[i].shift_end_time + ""+ "" + json_obj[i].run_type + ""+ "EDIT DELETE";

                    output+="</tr>";

                }


                $('#span').html(output);
                $('.span2').html('<input value='+json_obj[i].id +'>');

            }
        });




    }

    });
    });


</script>

@endsection

routes


Route::get('edit-shift/{id}', ['as' => 'edit-shift', 'uses' => 'TimesheetsController@edit']);
Route::get('edit-shift/{id}', ['as' => 'edit-shift', 'uses' => 'TimesheetsController@update']);



please advice how to load data for edit form 


06 Oct
3 years ago

dilfdo started a new conversation How To Create Schdule Task For Generate Weeks For Next 10 Weeks

i want to write a schedule for generate all weeks and storing the thursday date of each week in my Weeks table. how can i proceed this

05 Oct
3 years ago

dilfdo left a reply on Load Data In Foreach Loop With A Jquery Modal

@bobbybouwmann :

Each shift has check list where I loading through predepartureChecklist.. what I want is when clicking on "CHECK" on each shift to display the checklist on popup box . which is currently displaying as ex: this should display for shift 1 `` list item A::1/20
list item B::1/20
list item C::1/20

dilfdo left a reply on Load Data In Foreach Loop With A Jquery Modal

not sure whether its because I'm trying to load dive with tags.. I didn't get the data inside popup box and.. separate rows are creating on my page with close button

dilfdo left a reply on Load Data In Foreach Loop With A Jquery Modal

@bobbybouwmann : getting below two arrays from controller

   $Timesheets =  Timesheets::where('date','=',$get_today)->get();
            $PreDepartureCheckList = PreDepartureCheckList::get();
            return view('driver/timesheet_driver', compact('Timesheets', 'PreDepartureCheckList'));

dilfdo left a reply on Load Data In Foreach Loop With A Jquery Modal

@bobbybouwmann : thanks a lot :) . will it work same if I try to load a table inside modal as well?

I need to do the same thing for displaying checklist in . apply the same as you mentioned. but seems like not works for that..

  <tr>
                                          
                                            <td>Pre Departure Checked
                                                <button type="button" class="btn-infos" data-toggle="modal" data-target="#preCheck-{{ $shifts->id }}">
                                                 CHECK
                                                </button></td>
                                            <td>End of Shift Checked</td>
                                            <td></td>
                                            <td>

                                            </td>
                                        </tr>
                                       

                                        <!-- Modal -->
                                        <div class="modal" id="preCheck-{{ $shifts->id }}" tabindex="" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                            <div class="modal-dialog">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                        <h4 class="modal-title" id="myModalLabel">preDepartureCheckList</h4>
                                                    </div>
                                                    <div class="modal-body container">
                                        <!-- Check List items START -->
                                        @foreach( $PreDepartureCheckList as $preDepartureCheckList)
                                            @if($ee = $preDepartureCheckList->DriverDepartureItems()->get())

                                                @foreach( $ee as $getUser)

                                                        @if($shifts->id == $getUser->shift_id )
                                                                   
                                                        <tr style="border:1px solid #555;display:none;  ">
                                                            <td>{{ $preDepartureCheckList->list_items }}</td>

                                                    @if(!$getUser->value)
                                                                <td><span class="glyphicon glyphicon-remove"></span></td>
                                                    @else
                                                                <td><span class="glyphicon glyphicon-ok"></span></td>
                                                            @endif

                                                        </tr>

                                                        @endif
                                                @endforeach
                                            @endif
                                        @endforeach


                                 <!-- Check List items START -->

                                                    </div>
                                                    <div class="modal-footer">
                                                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                    </div>
                                                </div>
                                                <!-- /.modal-content -->
                                            </div>
                                            <!-- /.modal-dialog -->
                                        </div>
                                        <!-- /.modal -->



dilfdo started a new conversation Load Data In Foreach Loop With A Jquery Modal

i want to load my data inside a pop up box but every it only load first data instead of correct values . please advice