absolute

absolute

Member Since 9 Months Ago

Experience Points 150
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

16 Feb
9 months ago

absolute left a reply on Scope Method Not Found

Just checking this isn't a simple typo - did you copy the scopeFiscal definition from you code to post it here? If so, there is an opening bracket missing from the function definition.

public function scopeFiscal$query, $model_table) {

should be

public function scopeFiscal($query, $model_table) {

Obviously this may just be a typo on this site only. In which case, forgive me asking.

absolute left a reply on Validation Error Using Datepicker

Change your JS formatting to be the 4 digit year:

$( ".input-group.date" ).datepicker({
    format: 'dd/mm/yyyy'
});

absolute left a reply on Validation Error Using Datepicker

Can I just check the date you are entering into the input field through the datepicker? Is it in the format 16/02/2018?

absolute left a reply on Validation Error Using Datepicker

Update your validation rule to reflect the format of the date you want to receive.


$this->validate($request, [
    'date' => 'required|date_format:d/m/Y',
]);

You should use either the date or date_format methods, so be sure to remove the original date method.

absolute started a new conversation Pagination Of GROUPED Query Results Within Laravel 4.2

I have a query which currently returns in the region of 25k records, with this likely to exceed 100k by the end of year. Obviously this is paginated for readability.....

Having delved into the code for pagination, it appears that the standard Laravel 4.2 code returns the entire dataset in order to get the TOTAL count, and then slices the resulting collection in order to return the paginated result.

My question is, can anyone highlight any reasons or circumstances under which the following would not be more efficient or indeed cause issues?

\Illuminate\Database\Eloquent\Builder.php Lines 259 -

protected function groupedPaginate($paginator, $perPage, $columns)
{
    $total_records = \DB::select('select count(*) as total from ('.$this->toSql().') as records', $this->getBindings())[0];
    $total = $total_records->total;

    $page = $paginator->getCurrentPage($total);

    $this->query->forPage($page, $perPage);

    return $paginator->make($this->get($columns)->all(), $total, $perPage);

The purpose here is to nest the original GROUPED SQL query within a single select, and retrieve a single row with the total record count. Once you have this total, then retrieve a limited set of results, as you would with the standard pagination process.

Like I said, any advice as to why this wouldn't be more efficient or indeed fail, would be great!

And again for clarity, this is running on Laravel 4.2.

absolute left a reply on Route Has Only One Parameter

You just need to update your Route definition so that both variables are defined within the Route structure.

Route::get('files/{files}/{filename}', ['uses' => '[email protected]', 'as' => 'files.show'])

This definition would need to go before the Route Resource defined above, or I believe it would be ignored.

You can nest this query within other Route Groups which handle the "files" and "{files}" prefixes if you wish, but update the Route definition as appropriate.