Robstar

Robstar

Developer at F9 Web Ltd.

Member Since 6 Years Ago

Experience Points
155,880
Total
Experience

4,120 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
1347
Lessons
Completed
Best Reply Awards
29
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

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

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 32
155,880 XP
Jun
02
2 days ago
Activity icon

Commented on What We're Building

Looking forwards to this series.

May
22
1 week ago
Activity icon

Replied to Meta Tags

I wrote a small package to make adding meta tags easy using a fluent style API - https://github.com/f9webltd/laravel-meta

Apr
14
1 month ago
Activity icon

Replied to Stop Adding Poor Quality Laravel Addons

On Spatie, I agree with you there. I really like their support policy and how they respond to PRs/issues on Github. They have a great outlook on package development and always aim to keep packages focused on doing a specific task well.

Apr
13
1 month ago
Activity icon

Commented on Clean Up

Whilst that's not covered in this series, it has been covered multiple times in the past on Laracasts.

Apr
07
1 month ago
Activity icon

Replied to DB Design For Attributes With Multiple Values + Variants

I'm in no way recommending you use Opencart as it's awful software.

However, have a look at their database schema as they support attribute variations.

Apr
06
1 month ago
Activity icon

Replied to DB Design For Attributes With Multiple Values + Variants

You're at the start of EAV hell - https://devdocs.magento.com/guides/v2.3/extension-dev-guide/attributes.html may help.

By "variation" are you referring to an "attribute combination" or SKU i.e. a red t-shirt, size small?

Activity icon

Replied to Micro Services With Laravel

Lumen is a good start for Microservices.

Mar
30
2 months ago
Activity icon

Commented on Expanding The Timeline

I'd personally limit that further and exclude inactive users I'm following. However, each to their own :)

Activity icon

Commented on Build A Following

Yep same herre. Hoping this turns into a full project like ther forum series.

Activity icon

Commented on Make The Timeline Dynamic

I'm sure he's getting the foundations down. Ultimately I have a no doubt users will upload their own avatars that will be resized dynamically.

Feb
07
3 months ago
Activity icon

Replied to Laravel 6+ Pagination On Page And CRUD Problems

Actually, if you just want previous and next links, with the actual page numbers, use simplePaginate() instead of paginate().

Activity icon

Replied to Laravel 6+ Pagination On Page And CRUD Problems

It's explained the laravel documentation, which I would advise you read, see https://laravel.com/docs/5.8/pagination#displaying-pagination-results

So in your view add:

{{ $vehmodel->links() }}
Activity icon

Replied to Redis/Horizon : MaxAttemptsExceededException. How To Debug?

With the failed method, see https://laravel.com/docs/6.x/queues#cleaning-up-after-failed-jobs, you have the full exception available to process however you wish.

I'd personally try experimenting with the timeout and rety after values within your configuration.

There could also be issues on Google end. For instance, are they rate limiting you?

Finally, you could try creating multiple jobs over the night, as to avoid dispating 12k jobs at once. i.e. say split the records into three and process 4k at once.

You could achieve the latter by adding a timestamp column titled something like processed_at that is updated when the record is processed. Your job would then select the desired number of records where the priocessed_at column is null. You may need further logic for the latter i.e. a job ran to reset all processed_at columns for the following day.

Activity icon

Replied to Eloquent Search Construct

I'm not really here to evaulate your business logic, I suggested using whereHas, which I can see you ultimately did. I guess you could change the first line to:

$transactions = Transaction::with('order')

i.e. eager loading any relationship you require within the closure

Activity icon

Replied to Is Faceted Navigation With Javascript Is Good For SEO?

Render it in Blade and use Turbolinks.

Activity icon

Replied to Calling A Route And Show The Response In A Modal.

Yes, it sounds like you need to make an API request when the modal is clicked. The api request when loads time slots for the employee in question. Laravel can definitly do this. The implementation for your frontend code will vary on the modal library you're using.

Activity icon

Replied to Redis/Horizon : MaxAttemptsExceededException. How To Debug?

Can't you use the built in failed()method within the job class? Could also try increasing the retry_after config value.

remember you can set job specific settings like timeouts.

Activity icon

Replied to I Have Getting Issue When Login With Different Roles. I Want To Use Login Functionality Same As Gmail.

Can you please be more clear, you question is phrased very badly. For example, what is the "same functionality as gmail"?

Whilst I'm basically guessing what you want here as you haven;t explained yourself very well, I think you want to pass a guard name, see https://laravel.com/docs/6.x/authentication

Activity icon

Replied to Undefined Index: Code_insert

As you've named your array fields, it's a bit of a pian. You'll need to do something like:

foreach ($request->get('position') as $index => $data) {
    $postition = $data;
        $codeTool = $request->get('code_tool')[$index];
        $codeInsert = $request->get('code_insert')[$index];
       // etc.
}

I usually find it easier to name array inputs using an id i.e. users[123][name], users[123][email] etc.

Activity icon

Replied to Voyager BREAD Add Post

I'd assume the voyager forum would be the place to go as it's a separate and none official project. However, a quick Google threw up https://github.com/the-control-group/voyager/issues/2777

Activity icon

Replied to How To Pass Variables In 'h:X-Mailgun-Variables'

I do this within my mailable, within the build() method:

 $this->withSwiftMessage(function ($message) {
                $headers = $message->getHeaders();

                $headers->addTextHeader('X-Mailgun-Variables', json_encode([
                    '_invoice' => 1234,
                ]));
            });
Activity icon

Replied to Calculation Of Minimum Booking Price

Just create a small isolated service I'd personally do something like:

$price = resolve(BookingPrice::class)
    ->onDay(1)
    ->onWeek(2)
    ->forMonth(12)
    ->calculate();

The onDay, onWeek methods simply set data within your class.

This way you can perform your calculations within your class as you would with an PHP class.

As the service is a simple PHP class it can easily unit tested.

Activity icon

Replied to Array Index In Config/sitevars.php Not Performing As It Should?

Could make that into a one line:

public function getYearGroupAttribute()
{
    return $this->year ? config('sitevars.years')[$this->year] : 0;
}
Activity icon

Replied to Laravel Mail: Attach File If Not Null

You can make this slightly more readable and avoid the need for a temporary variable using the tap helper, in my case I optionally pass an $order object to the mailable and if present attach files from the order, to the mailable:

public function build()
{
    $mailer = $this->subject('Order #123')->markdown('emails/invoice');

    return tap($mailer, function ($mailer) {

       $this->order->items->flatMap(function ($item) {
                return $item->attachments->map->getPath();
            })->each(function ($file) use ($mailer) {
                /** @var PurchaseOrder $mailer */
                $mailer->attachFromStorageDisk('s3-uploads', $file, basename($file), [
                    'mime' => 'application/pdf',
                ]);
          });
      
    });
}



Dec
20
5 months ago
Activity icon

Replied to Vue Porps Not Working.

I'm out of ideas then, as that's worked here on a sample component.

Activity icon

Awarded Best Reply on Follow/unfollow Button Working But Switching To Follow After Clicking

What is the value and datatype of the $follows variable?

Activity icon

Replied to Vue Porps Not Working.

Try renaming the prop name to follow the convention. i.e.

<studentindex :data-xm="34"></studentindex>

Does the value print in your component now when accessed using this.dataXm?

If that doesn;t work try prefixing with something other than 'data'.

Activity icon

Replied to ProductInventory

You've literally linked to the answer, "the old function retrieves an old input value flashed into the session"

Activity icon

Replied to Follow/unfollow Button Working But Switching To Follow After Clicking

What is the value and datatype of the $follows variable?

Activity icon

Replied to How Do I Add Search To My Vuejs Contact List

Are you wanting to search client or server side?

Activity icon

Replied to Eloquent Search Construct

You could use whereHas:

$transactions = Transaction::with('order', 'transaction', 'extended_details')
    ->when($this->search !== '', function ($query) {
        return $query->whereHas('transaction', function($q){
            $q->where('reference', 'like', $this->search.'%');
        });
    })
    ->latest()
    ->paginate(25);
Activity icon

Replied to Vue Porps Not Working.

Try accessing the props later on in the created() function and have a read of https://alligator.io/vuejs/component-lifecycle/

Activity icon

Replied to WhereNotIn In Eloquent Not Working

Well I was going to add a reply, but that's a pretty rude reply to @nakov who is trying to help.

Activity icon

Replied to Auto Serial Number

Sure. You basically just need to initialise the loop variable. In an old project I did something as follows in an old project (it allowed the user to select the number of records per page and defaults to 50 records per page). I don;t have the code to hand, but is was something as follows:

$page = (int) $request->get('page', 1);

$baseLoop = $page > 1 ? ($page * (int) $request->get('perPage', 50)) - (int) $request->get('perPage', 50) + 1 : 1

So the following values would be generated:

Page 1 - base loop = 1 - values 1 - 50 Page 2 - base loop 51 - values 51 - 100 Page 3 - base loop 101 - values 101 -150 etc.

$baseLoop is passed yo your view.

Within the view I rather crudly did something like the following (would probably refactor this now to avoid using the php directive within a template):

@foreach ($records as $record)
   <tr>
      <th scope="row">#{{ $baseLoop }}</th>
   </tr>
   @php $baseLoop++ @endphp
@endforeach
Dec
19
5 months ago
Activity icon

Replied to Update Query In Bulk Using Single Query Instead Of Using Loop

For that many records you may want to investigate generators and possibly lazy collections (if using Laravel 6).

I assume $srcProductOnhand is a huge array of ids?

Activity icon

Replied to Having Trouble Creating A Like System For Comments

For the little additional effort required, I would jave personally made this into a likeable polymorphic relationships.

This way you can easily apply likes to any model going forwards.

Activity icon

Replied to Lumen Data Validation Fails

I guess the next obvious questions are:

  • is the request object you're injecting a custom request, or the default Laravel request instance
  • what are the ontents of the guzzlePost method?
  • what data is actually arriving at your endpoint? Posts the contents here
Activity icon

Replied to Roles

What on earth is a "Multi level System"?

Without knowing what it is, making a controller for each role sounds incorrect.

Activity icon

Replied to Laravel Task Scheduler `schedule:run` Not Working?

To rule out the obvious, have you let miore than a minute lapse? If there are no tasks due the scheduler won;t run.

When you run the schedule command what is the outpout?

Activity icon

Replied to How To Replace A Specific String (any String Coming From DB)

A few options:

Activity icon

Replied to Lumen Data Validation Fails

userId in first post snippet should be user_id

Activity icon

Replied to Auto Serial Number

If pagination is ever implemented the loop variable won;t work. You'd need to account for the page number and number of records per page.

If you're only going to ever have a single page of results the current implementation is fine.

Dec
18
5 months ago
Activity icon

Awarded Best Reply on How To Deal With The Back Button In Vue?

Aren't you relieved it doen't work? :)

Imagine how many sites would abuse such functionality.

You're best warning people beforeahdn. Something as follows should work:

window.onbeforeunload = function() { return "Your work will be lost."; };

Activity icon

Replied to Trying To Get Property 'email' Of Non-object

Don't use the env helper within your code. Reference config values via the config helper. See https://github.com/laravel/framework/issues/21727

Activity icon

Replied to Checking For Values In Two Rows For Existence

Can't you create a kind of virtual column with the numbers ordered i.e.

1       | 1003 | 1,1003
1003 | 1 | 1,1003

Then you can filter out the duplciates.

You could do this using a standard Laravel collection too.

Activity icon

Replied to How To Deal With The Back Button In Vue?

Aren't you relieved it doen't work? :)

Imagine how many sites would abuse such functionality.

You're best warning people beforeahdn. Something as follows should work:

window.onbeforeunload = function() { return "Your work will be lost."; };