Lalit

Lalit

Member Since 2 Years Ago

Laravel Devolper at Rexweb

Experience Points 1,280
Experience Level 1

3,720 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 4
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.

13 Mar
1 year ago

Lalit started a new conversation Hi Everyone

I need a help to show Weekly , monthly and Yearly data of sale to display in a chart or between two date , how should i display ?

Thanks

27 Oct
1 year ago

Lalit left a reply on Image Uploading Getting Error , I Have A Two Days Not Understand How To Solve This , I Try Everything But Not Working, For Help Thanks In Advance

$request->hasFile('fileToUpload') here was getting the error

Call to a member function hasFile() on string

Lalit left a reply on Image Uploading Getting Error , I Have A Two Days Not Understand How To Solve This , I Try Everything But Not Working, For Help Thanks In Advance

View <?php echo Form::open(array('url' => '/admin.employment_main','files'=>'true')); echo 'Select the file to upload.'; echo Form::file('fileToUpload');

     echo Form::submit('Upload File');
     echo Form::close();
  ?>  

Controller

public function uploadfile(Request $request) {

     $contract = EmployeeContract::create(request()->except(['_method', '_token']));


       
       if ($request->hasFile('fileToUpload')) 
       {

        echo "string";

         } else {
             
             echo "no";

         }

die();

    if (request()->hasFile('fileToUpload')) {
        $document->addMediaFromRequest('fileToUpload')->withCustomProperties(['is_default' => true])->employment_enrolment('documents');
    }

    // alert()->success('Document saved')->autoclose();   

}

Lalit started a new conversation Image Uploading Getting Error , I Have A Two Days Not Understand How To Solve This , I Try Everything But Not Working, For Help Thanks In Advance

Call to a member function getClientOriginalExtension() on string

$test = $request->file('fileToUpload')->getClientOriginalExtension();

     echo $test; die('test');
17 Oct
1 year ago

Lalit started a new conversation Disable Past Month Or Date In Vue.js Date Picker

var d_start_date=moment(this.form.starts_at,'DD/MM/YYYY');

10 Oct
1 year ago

Lalit left a reply on Getting Error When Run A Command

this is the line 275

function is public function CreateInvoice(){

$data['details'][] = $details;

Lalit left a reply on Getting Error When Run A Command

namespace App\Models;

use Advmaker\CarbonPeriod; use Alsofronie\Uuid\UuidModelTrait; use App\Models\Child; use Carbon\Carbon; use Exception; use Illuminate\Support\Facades\Log; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Spatie\MediaLibrary\HasMedia\HasMediaTrait; use Spatie\MediaLibrary\HasMedia\Interfaces\HasMedia;

class Invoice extends Model implements HasMedia {

use UuidModelTrait, SoftDeletes, HasMediaTrait;

protected $fillable = [
    'ends_at',
    'starts_at',
    'enrolment_id',
    'value',
    'subsidies',
    
];

protected $dates = [
    'starts_at',
    'ends_at',
];

protected $casts = [
    'data' => 'array',
];

/**
 * @var Collection
 */
protected $deductions;

/* protected static function boot() { parent::boot(); static::saving(function ($invoice) { $enrolment = Enrolment::find($invoice->enrolment_id);

        $enrolmentPeriod = $enrolment
            ->periods()
            ->where('ends_at', '>=', $invoice->starts_at)
            ->orderBy('ends_at', 'ASC')
            ->first();

        if (! $enrolmentPeriod) {
            $enrolmentPeriod = $enrolment
                ->periods()
                ->whereNull('ends_at')
                ->first();
        };

        if (! $enrolmentPeriod) {
            throw new Exception("Error saving invoice. Enrolment period is required.", 1);
        }

        switch ($enrolmentPeriod->payment_frequency) {
            default:
            case 'weekly':
                $invoice->ends_at = $invoice->starts_at->copy()->startOfDay()->addWeeks(1)->subSeconds(1);
                break;
            case 'fortnightly':
                $invoice->ends_at = $invoice->starts_at->copy()->startOfDay()->addWeeks(2)->subSeconds(1);
                break;
            case 'monthly':
                $invoice->ends_at = $invoice->starts_at->copy()->startOfDay()->addMonths(1)->subSeconds(1);
                break;
        }

        $invoice->deductions = new Collection();

        $invoice->days_to_pay     = 0;
        $invoice->days_deducted   = 0;
        $invoice->subsidies         = 0;
        $invoice->discounts        = 0;
        $invoice->total_fee       = 0;
        $invoice->total_deduction = 0;
        $invoice->total           = 0;
        $data                     = [];
        $data['details']          = '';
        $period                   = CarbonPeriod::instance($invoice->starts_at, $invoice->ends_at);

        $period->eachDays(1, function ($day) use ($invoice, $enrolment, &$data) {

            if (! $day->start()->isWeekend()) {
                $enrolmentPeriod = $enrolment
                    ->periods()
                    ->where('starts_at', '<=', $day->end())
                    ->where('ends_at', '>=', $day->start())
                    ->first();
                //if enrolment period exists check
                if($enrolmentPeriod) {

                    $discounts = $enrolmentPeriod
                        ->discounts()
                        ->get();

                    $subsidies = $enrolmentPeriod
                        ->subsidies()->where('status', 'Subsidy Received')
                        ->get();

                    //  Log::info('Current financial year: '. $day->start()->year);

                    // Get the fee of the active enrolment type
                    $year = FinancialYear::where('end_year', $day->start()->year + 1)->first();
                    //Log::info('Current financial year: '. $year->id);

                    $fee = $enrolmentPeriod->enrolmentType->fees()->where('financial_year_id', $year->id)->first();

                    $invoice->total_fee += $fee->value / 5;
                    $invoice->days_to_pay++;

                    $details = [
                        'date' => $day,
                        'daily_fee' => $fee->value / 5,
                        'daily_discounts' => 0,
                        'daily_subsidies' => 0,
                        'total' => 0,
                    ];

                    // Get the active discounts
                    foreach ($discounts as $discount) {
                        $invoice->days_deducted++;
                        $invoice->total_deduction += $discount->value / 5;
                        $details['daily_discounts'] += $discount->value / 5;
                        $invoice->discounts += $discount->value / 5;
                    }
                    // Get the active subsidies
                    foreach ($subsidies as $subsidy) {
                        //$invoice->days_deducted++;
                        //$invoice->total_deduction += $subsidy->value / 5;
                        $details['daily_subsidies'] += $subsidy->value / 5;
                        $invoice->subsidies += $subsidy->value / 5;
                    }
                    $details['total'] = $details['daily_fee'] - $details['daily_discounts'];// - $details['daily_subsidies'];
                    $data['details'][] = $details;
                }
                else
                {
                    Log::debug('[Invoice] - function() :: Enrolment period does not exists',
                        [$enrolment->id,$day->end(),$day->start()]);
                }
                //end enrolment period check;
            }
        });
        $invoice->total = $invoice->total_fee - $invoice->total_deduction;
        $invoice->data = $data['details'];
    });
}
*/
public function CreateInvoice(){
        $invoice=$this;
        $enrolment = Enrolment::find($invoice->enrolment_id);

        $enrolmentPeriod = $enrolment
            ->periods()
            ->where('ends_at', '>=', $invoice->starts_at)
            ->orderBy('ends_at', 'ASC')
            ->first();

        if (! $enrolmentPeriod) {
            $enrolmentPeriod = $enrolment
                ->periods()
                ->whereNull('ends_at')
                ->first();
        };

        if (! $enrolmentPeriod) {
            throw new Exception("Error saving invoice. Enrolment period is required.", 1);
        }

        switch ($enrolmentPeriod->payment_frequency) {
            default:
            case 'weekly':
                $invoice->ends_at = $invoice->starts_at->copy()->startOfDay()->addWeeks(1)->subSeconds(1);
                break;
            case 'fortnightly':
                $invoice->ends_at = $invoice->starts_at->copy()->startOfDay()->addWeeks(2)->subSeconds(1);
                break;
            case 'monthly':
                $invoice->ends_at = $invoice->starts_at->copy()->startOfDay()->addMonths(1)->subSeconds(1);
                break;
        }

        $invoice->deductions = new Collection();

        $invoice->days_to_pay     = 0;
        $invoice->days_deducted   = 0;
        $invoice->subsidies         = 0;
        $invoice->discounts        = 0;
        $invoice->total_fee       = 0;
        $invoice->total_deduction = 0;
        $invoice->total           = 0;
        $data                     = [];
        $data['details']          = '';
        $period                   = CarbonPeriod::instance($invoice->starts_at, $invoice->ends_at);

        $period->eachDays(1, function ($day) use ($invoice, $enrolment, &$data) {

            if (! $day->start()->isWeekend()) {
                $enrolmentPeriod = $enrolment
                    ->periods()
                    ->where('starts_at', '<=', $day->end())
                    ->where('ends_at', '>=', $day->start())
                    ->orderBy('ends_at','DESC')
                    ->first();


                //if enrolment period exists check
                if($enrolmentPeriod) {
                    Log::info('[Generate invoice] - Enrolment Period for child ',[$invoice->enrolment->child->name,$enrolmentPeriod->id]);
                    $discounts = $enrolmentPeriod
                        ->discounts()
                        ->where('starts_at', '<=', $day->end())
                        ->where('ends_at', '>=', $day->start())
                        ->get();

                    $subsidies = $enrolmentPeriod
                        ->subsidies()->where('status', 'Subsidy Received')
                        ->where('starts_at', '<=', $day->end())
                        ->where('ends_at', '>=', $day->start())
                        ->get();


                    Log::info('[Generate invoice] - Enrolment Period for child - enrolment_ id- subsidy_value ',[$invoice->enrolment->child->name,$enrolmentPeriod->id,$enrolmentPeriod
                        ->subsidies()->where('status', 'Subsidy Received')
                        ->sum('value')]);
                    //  Log::info('Current financial year: '. $day->start()->year);

                    // Get the fee of the active enrolment type
                    $year = FinancialYear::where('end_year', $day->start()->year + 1)->first();
                    //Log::info('Current financial year: '. $year->id);

                    $fee = $enrolmentPeriod->enrolmentType->fees()->where('financial_year_id', $year->id)->first();

                    $invoice->total_fee += $fee->value / 5;
                    $invoice->days_to_pay++;

                    $details = [
                        'date' => $day,
                        'daily_fee' => $fee->value / 5,
                        'daily_discounts' => 0,
                        'daily_subsidies' => 0,
                        'total' => 0,
                    ];

                    // Get the active discounts
                    foreach ($discounts as $discount) {
                        $invoice->days_deducted++;
                        $invoice->total_deduction += $discount->value / 5;
                        $details['daily_discounts'] = $discount->value / 5;
                        $invoice->discounts += $discount->value / 5;
                    }
                    // Get the active subsidies
                    foreach ($subsidies as $subsidy) {
                        $invoice->days_deducted++;
                        $invoice->total_deduction += $subsidy->value / 5;
                        $details['daily_subsidies'] = $subsidy->value / 5;
                        $invoice->subsidies += $subsidy->value / 5;
                    }
                    $details['total'] = $details['daily_fee'] - $details['daily_discounts'];// - $details['daily_subsidies'];
                    $data['details'][] = $details;
                }
                else
                {
                    Log::debug('[Invoice] - function() :: Enrolment period does not exists',
                        [$enrolment->id,$day->end(),$day->start()]);
                }
                //end enrolment period check;
            }
        });
        $invoice->total = $invoice->total_fee - $invoice->discounts;
        $invoice->data = $data['details'];

        $invoice->save();

}

#region Scopes
public function scopeOfCustomer(Builder $query, Customer $customer)
{
    return $query
        ->select('invoices.*')
        ->join('enrolments', 'enrolments.id', '=', 'invoices.enrolment_id')
        ->join('children', 'children.id', '=', 'enrolments.child_id')
        ->join('customers', 'customers.id', '=', 'children.customer_id')
        ->where('customers.id', $customer->id)
        ->where('children.deleted_at',NULL)
        ->where('customers.deleted_at',NULL)
        ->orderBy('invoices.ends_at', 'DESC');
}

public function scopeOfChild(Builder $query, Child $child)
{
    return $query->whereHas('enrolment', function($q) use ($child) {
        return $q->where('child_id', $child->id);
    });
}

public function scopeOverdue(Builder $query)
{
    return $query
        ->where('invoices.ends_at', '<', Carbon::now());
}

public function scopeDue(Builder $query)
{
    return $query
        ->where('invoices.ends_at', '>=', Carbon::now())
        ->where('invoices.starts_at', '<', Carbon::now())
        ;
}

public function scopeByCostCentre(Builder $query, CostCentre $cost_centre)
{
    return $query->whereHas('enrolment', function ($q) use ($cost_centre) {
        $q->where('cost_centre_id', $cost_centre->id);
    });
}

public function scopeByArea(Builder $query, Area $area)
{
    return $query->whereHas('enrolment', function ($q) use ($area) {
        $q->whereIn('cost_centre_id', collect($area->costCentres)->pluck('id'));
    });
}

public function scopeByDateCreated(Builder $query, Carbon $date_from, Carbon $date_to)
{
    return $query
        ->where('invoices.created_at', '>=', $date_from->startOfDay())
        ->where('invoices.created_at', '<=', $date_to->endOfDay());
}

public function scopeCurrent(Builder $query)
{
    return $query
        ->where('invoices.starts_at', '<=', Carbon::now())
        ->where('invoices.ends_at', '>=', Carbon::now());
}

public function scopeExceptCurrent(Builder $query)
{
    return $query
        ->where('invoices.ends_at', '<', Carbon::now());
       
}





#endregion

#region Relations
public function enrolment()
{
    return $this->belongsTo('App\Models\Enrolment');
}

public function notes()
{
    return $this->morphMany('App\Models\Note', 'notable');
}
#endregion

#region Accessors
public function getIsUnpaidAttribute()
{
    return $this->payments()->sum('value') < $this->total;
}

public function getIsDueAttribute()
{
    return $this->ends_at >= Carbon::now();
}

public function getPaidAttribute()
{
    return $this->payments()->paid()->sum('value');
}

public function payments()
{
    return $this->enrolment->child->payments();
}

public function currentPayments()
{
    return $this->enrolment->child->payments()->paid()->CurrentByInvoice($this);
}

public function currentWaived()
{
    return $this->enrolment->child->payments()->waived()->CurrentByInvoice($this);
}



public function getCurrentDueAttribute()
{
    if($this->total < $this->enrolment->child->currentpaymentsByInvoice($this)->paid()->sum('value'))
        $currentDue=0;
    else
        $currentDue = $this->total - $this->enrolment->child->currentpaymentsByInvoice($this)->paid()->sum('value');
    
    //$duepaid= $this->id.'----'.$this->total.'------'.$this->enrolment->child->id.'----'.$this->enrolment->child->currentpaymentsByInvoice($this)->paid()->sum('value').'----'.$this->starts_at.'---'.$this->ends_at.'----'.$this->enrolment->id ;
    //- $this->enrolment->child->payments()->paid()->sum('value');
    return $currentDue;
    //$this->enrolment->child->payments()->paid()->sum('value');
}

/* public function getWaivedAttribute() { return $this->payments()->waived()->sum('value'); } */ public function getWaivedAmountAttribute() { return $this->waived; }

 public function getPendingBalanceAttribute()
{
    return $this->balance;
}


public function getOutstandingAttribute()
{
    return $this->total - $this->payments()->sum('value');
}

public function getTotalSubsidiesAttribute()
{
    return collect($this->data)->sum('daily_subsidies');
}

public function getTotalDiscountsAttribute()
{
    return collect($this->data)->sum('daily_discounts');
}

public function getCurrentPaymentAttribute()
{
    return $this->currentPayments->sum('value');
}

public function getCurrentPaymentWaivedAttribute()
{
    return $this->currentWaived->sum('value');
}

public function getCurrentPaymentTotalAttribute()
{
    return $this->currentPayments->sum('value');
}


#endregion

}

Lalit left a reply on Getting Error When Run A Command

When run command getting this

Exception trace: () at /var/www/html/choicekids/app/Models/Invoice.php:275 App\Models\Invoice->App\Models{closure}() at /var/www/html/choicekids/vendor/advmaker/carbon-period/src/CarbonPeriod.php:200 Advmaker\CarbonPeriod->each() at /var/www/html/choicekids/vendor/advmaker/carbon-period/src/CarbonPeriod.php:216 Advmaker\CarbonPeriod->eachDays() at /var/www/html/choicekids/app/Models/Invoice.php:284 App\Models\Invoice->CreateInvoice() at /var/www/html/choicekids/app/Jobs/GenerateInvoice.php:81 App\Jobs\GenerateInvoice->handle() at n/a:n/a call_user_func_array() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Container/Container.php:508 Illuminate\Container\Container->call() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:94 Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151 Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104 Illuminate\Pipeline\Pipeline->then() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:98 Illuminate\Bus\Dispatcher->dispatchNow() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:47 Illuminate\Queue\CallQueuedHandler->call() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:73 Illuminate\Queue\Jobs\Job->fire() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php:42 Illuminate\Queue\SyncQueue->push() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:184 Illuminate\Bus\Dispatcher->pushCommandToQueue() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:159 Illuminate\Bus\Dispatcher->dispatchToQueue() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:73 Illuminate\Bus\Dispatcher->dispatch() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:373 dispatch() at /var/www/html/choicekids/app/Console/Commands/GenerateInvoices.php:56 App\Console\Commands\GenerateInvoices->handle() at n/a:n/a call_user_func_array() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Container/Container.php:508 Illuminate\Container\Container->call() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Console/Command.php:169 Illuminate\Console\Command->execute() at /var/www/html/choicekids/vendor/symfony/console/Command/Command.php:261 Symfony\Component\Console\Command\Command->run() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Console/Command.php:155 Illuminate\Console\Command->run() at /var/www/html/choicekids/vendor/symfony/console/Application.php:817 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/choicekids/vendor/symfony/console/Application.php:185 Symfony\Component\Console\Application->doRun() at /var/www/html/choicekids/vendor/symfony/console/Application.php:116 Symfony\Component\Console\Application->run() at /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:121 Illuminate\Foundation\Console\Kernel->handle() at /var/www/html/choicekids/artisan:35

Lalit left a reply on Getting Error When Run A Command

@

Same result [Symfony\Component\Debug\Exception\FatalThrowableError] [] operator not supported for strings

Lalit left a reply on Getting Error When Run A Command

When i use command then getting

php artisan invoices:generate

agter that getting this error

[Symfony\Component\Debug\Exception\FatalThrowableError] [] operator not supported for strings

Lalit left a reply on Getting Error When Run A Command

@kfirba : Now getting this

[Symfony\Component\Debug\Exception\FatalThrowableError] [] operator not supported for strings

09 Oct
1 year ago

Lalit left a reply on Getting Error When Run A Command

namespace App\Jobs;

use App\Events\InvoiceCreated; use App\Models\Enrolment; use App\Models\Invoice; use App\Models\InvoiceSystem; use App\Models\Subsidy; use Carbon\Carbon; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Database\Eloquent\Collection; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; use PDF; Use Exception;

class GenerateInvoice extends Job implements ShouldQueue { use InteractsWithQueue, SerializesModels; protected $enrolment; protected $withPDFDocument;

public function __construct(Enrolment $enrolment, bool $withPDFDocument = false)
{
    $this->enrolment       = $enrolment;
    $this->withPDFDocument = $withPDFDocument;
    //Log::info('[Generate invoice] - contructor');
    Log::debug('[Generate invoice] - contructor',[$enrolment]);
    Log::debug('[Generate invoice] - with PDF Document',[$withPDFDocument]);
}

public function handle()
{
    ini_set('max_execution_time', 0);

    Log::info('[Generate invoice] - handler');


    if (!$this->enrolment->child) {
        Log::debug('[GenerateInvoice] - handle() :: Skip generating invoice for deleted child--',
            [$this->enrolment->id]);
        return;
    }

    if ($this->enrolment->payment_starts_at > Carbon::now()) {
        Log::debug('[GenerateInvoice] - handle() :: Skip generating invoice for enrolment starting in the future',
            [$this->enrolment->payment_starts_at]);

        return;
    }



    $enrolmentCount=0;
    $enrolmentCount=Enrolment::where('id',"=",$this->enrolment->id)
                            ->whereHas('currentPeriod.subsidies',function($q){
                              $q->where('status','=','Not Lodged')
                                ->orwhere('status','=','Confirmed Lodged');
                     })->count();

    $limit = $this->enrolment->ends_at < Carbon::now() ? $this->enrolment->ends_at : Carbon::now();
    while (Invoice::where('enrolment_id', $this->enrolment->id)->where('ends_at', '>', $limit)->count() < 1 && $enrolmentCount == 0) {

        $last = Invoice::where('enrolment_id', $this->enrolment->id)->orderBy('ends_at','DESC')->first();

        //Invoices start date comes from INVOICE_START_DATE variable defined in .env file

        if(strtotime($this->enrolment->payment_starts_at) < strtotime(env('INVOICE_START_DATE'))) {
            $dt = Carbon::parse(env('INVOICE_START_DATE'));
            $invoice_start_date=$dt->startOfDay();
        }else
            $invoice_start_date = $this->enrolment->payment_starts_at->startOfDay();
      //  Log::debug('[Generate invoice] - invoice start date--',[$invoice_start_date,$this->enrolment->payment_starts_at,env('INVOICE_START_DATE')]);
      //  print_r('---'.$invoice_start_date);die;

        $invoice               = new Invoice();
        $invoice->starts_at    = $last ? $last->ends_at->addDay()->startOfDay() : $invoice_start_date;
        $invoice->enrolment_id = $this->enrolment->id;
        $invoice->createInvoice();
        //$invoice->save();

        //System generated Invoice copy
        $invoice_system               = new InvoiceSystem();
        $invoice_system->starts_at           = $invoice->starts_at;
        $invoice_system->enrolment_id        = $invoice->enrolment_id;
        $invoice_system->save();

        $enrolment_period = $this->enrolment
            ->periods()
            ->where('starts_at', '<=', $invoice->ends_at)
            ->where('ends_at', '>=', $invoice->starts_at)
            ->first();



        if ($this->withPDFDocument) {
            Log::info('[Generate invoice] - PDF document');
            $pdf = PDF
                ::loadView('admin.invoice.pdf', [
                    'invoice'          => $invoice,
                    'enrolment_period' => $enrolment_period,
                ])
                ->setOption('footer-html', view('admin.common.pdf-footer'));

            $pdf->save(storage_path($invoice->id . '.pdf'));
            Log::info('[Generate invoice] - Save document');
            $invoice->addMedia(storage_path($invoice->id . '.pdf'))->toCollectionOnDisk('invoices', 'documents');
        }

        event(
            new InvoiceCreated($invoice)
        );

    }

   
}

public function failed(Exception $exception)
{
    // handle failure
    Log::debug('[Generate Invoice] Failure - ',$exception);
}

}

Lalit left a reply on Getting Error When Run A Command

i paste code here but i thik not display to You

Lalit left a reply on Getting Error When Run A Command

Sir i am not found the probulem on php 7.0 its working but on 7.1 getting this exception

Lalit left a reply on Getting Error When Run A Command

Sir Now getting this error

[Symfony\Component\Debug\Exception\FatalThrowableError] Type error: Argument 2 passed to Illuminate\Log\Writer::debug() must be of the type array, object given, called in /var/www/html/choicekid s/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 237

Lalit started a new conversation Getting Error When Run A Command

Getting error when run a Command

[Symfony\Component\Debug\Exception\FatalThrowableError] Type error: Argument 1 passed to App\Jobs\GenerateInvoice::failed() must be an instance of App\Jobs\Exception, instance of Symfony\Compone nt\Debug\Exception\FatalThrowableError given, called in /var/www/html/choicekids/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedH andler.php on line 84

22 Aug
1 year ago

Lalit started a new conversation Hit URL Getting Error

http://112.196.42.180/projects/canvas/canvas/public/

FatalErrorException in Model.php line 19: Interface 'Illuminate\Contracts\Routing\UrlRoutable' not found

19 Aug
1 year ago

Lalit left a reply on Laravel - Load Common Header And Footer To View

i Have define in code source of header file in other work fine but in header getting error

Lalit left a reply on Laravel - Load Common Header And Footer To View

ErrorException in ff7abd237336be38eb1acbd74dd6da12db02c071.php line 7: Undefined variable: shown (View: /var/www/html/geonback/resources/views/includes/header.blade.php) (View: /var/www/html/geonback/resources/views/includes/header.blade.php) (View: /var/www/html/geonback/resources/views/includes/header.blade.php)

Getting this error Sir

Lalit started a new conversation Laravel - Load Common Header And Footer To View

Laravel - Load common header and footer to view

public function shownotification(Request $request)

{ $userId = Auth::id();

   $shown = DB::table('notification')
  ->join('users', 'users.id', '=', 'notification.sender_id')
  ->where('notification.receiver_id', $userId)->first();

  //echo "<pre>"; print_r($shownotif); die();

  $value = Request::header('Content-Type');


    return view(@include('includes/header'),['shown'=>$shown]));

      

}

28 Jun
2 years ago

Lalit left a reply on Getting Error When Social Login The Parameter App_id Is Required

I am using this package and getting error

Lalit started a new conversation Getting Error When Social Login The Parameter App_id Is Required

I have set the Client ID and secret key but getting , the parameter app_id is required , error when i login with facebook.

12 Jun
2 years ago

Lalit left a reply on Laravel

First you have to Create your related Database.
Then:php artisan cache:clear
Now run php artisan migrate:install
26 Apr
2 years ago

Lalit started a new conversation How To Make A Multiple Array One Array In Larvel

Array
(
    [0] => Array
        (
            [id] => 2
            [optID] => ABC
            [other] => Option
            [optDesc] => fgj
            [optClass] => A1 Preferred Stock A
            [optReserve] => fgj
            [optDate] => 02/28/2017
            [optExpir] => 03/31/2017
            [optVesting] => 03/30/2017
            [optStrike] => 50
            [optFMV] => 
            [created_at] => 2017-05-19 11:57:19
            [updated_at] => 2017-05-19 06:27:19
            [edit_grand] => 
        )
[1] => Array
    (
        [id] => 3
        [optID] => 12
        [other] => Option
        [optDesc] => u
        [optClass] => A1 Preferred Stock A
        [optReserve] => 12
        [optDate] => 05/12/2017
        [optExpir] => 05/02/2017
        [optVesting] => 05/18/2017
        [optStrike] => 252
        [optFMV] => 50
        [created_at] => 2017-05-19 13:25:33
        [updated_at] => 2017-05-19 07:37:51
        [edit_grand] => Array
            (
                [geanT_id] => 2
                [maitnainID] => 3
                [grantHolders] => 66
                [orginalShare] => 20
                [defferredTo] => 22
                [created_at] => 2017-05-19 09:38:39
                [updated_at] => 2017-05-19 09:38:39
                [associate_to_share_holder] => Array
                    (
                        [id] => 66
                        [refName] => reef
                        [name1] => ABC
                        [name2] => 
                        [name3] => 
                        [name4] => dsf
                        [created_at] => 2017-05-03 17:29:07
                        [updated_at] => -0001-11-30 00:00:00
                        [registration] => 
                        [registrationText] => sfd
                        [tinname1] => dsf
                        [in] => 
                        [tinname2] => 
                        [in2] => 
                        [phone] => 0987654321
                        [phone2] => sdf
                        [cellphone] => 
                        [citizenship] => 
                        [email] => 
                        [envelope] => 
                        [letter] => 
                        [address] => 
                        [city] => 
                        [state] => 
                        [zip] => 
                        [deliverPt] => 
                        [address2] => 
                        [city2] => 
                        [state2] => 
                        [zip2] => 
                        [address1] => 
                        [broker] => 
                        [ref] => 
                        [sameAs] => 
                        [preference] => 
                        [from] => 
                        [through] => 
                        [advertising] => 
                        [block] => 
                        [citizenOf] => 
                        [radio2] => 
                    )

            )

    )

)

17 Mar
2 years ago

Lalit started a new conversation How To Show Data In Table When I Use A Query To Get Specific User Data . When I Save Then Data Is Not Show

I have show data of user on another page id data in database then data show other wise user can add data on this page when user click on save data will be instant show in table . but i am getting error when i save then not showing in table instant. If i remove the id from function which i use to show data then instant data save show in table . if i take i id then it will not

09 Mar
2 years ago

Lalit left a reply on Need Help With Datepicker

Add date picker Js file in public Js folder

03 Mar
2 years ago

Lalit started a new conversation Space

how to give space in laravel . i need space between the gift and G how to give . &nbsp i can not use any other way

01 Mar
2 years ago

Lalit left a reply on Update Check Box

thanks to all of You

Lalit left a reply on Update Check Box

Yes if checked then value insert 1 other wise Insert Null But when i update and not select checkbox then i get defined index error

or

if i use isset condition then i will not getting undefined index error but value is not inserted

Lalit left a reply on Update Check Box

here i need a chekbox value in data base other wise it will be null

Lalit left a reply on Update Check Box

this is my code:

regShowDes this is a checkbox i fill the regShowDes in data base otherwise value null

if($data['regItemID']){

      $id =  $data['regItemID'];
      
       registerTypeModel::where('id', $id)
                     ->update
        (array('regItem' => $data['regItem'],
        'regDescription' => $data['regDescription'],
        
            
        'regShowDes' => $data['regShowDes'], 
        'p1099Div' => $data['p1099Div'],          
        'p1099B'   => $data['p1099B'], 
        'p1099BINT' => $data['p1099BINT'],          

        ));      
        

Lalit started a new conversation Update Check Box

How to update checkbox in controller

24 Jan
2 years ago

Lalit started a new conversation When I Update Checkbox If I Checked That Then Update And If Not Check Then Get Undefine Index Error

when i the update data then checkbox is checked then update data and if not checked then get undefine index error and also checkbox are not checked when i am getting data using Ajax and try to fil value in .each loop

18 Jan
2 years ago

Lalit left a reply on Tell Me In Detail How To Create Custom Login

i know that the Question is too short but i want to use middelware to use login ? Can you please explain me .

Lalit started a new conversation Tell Me In Detail How To Create Custom Login

Tell me in detail that how to create custom login in laravel ?