likvidatorTM

likvidatorTM

Member Since 1 Year Ago

Experience Points 310
Experience Level 1

4,690 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 1
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.

10 Dec
1 year ago

likvidatorTM left a reply on Pagination With Dinamic Data.

Because current page parameter user send with route argument and Paginator dont see it by default. But it doesn't matter since this is not the reason of problem. Route path: xhr/products/page/{page}/{filter?}

09 Dec
1 year ago

likvidatorTM left a reply on Pagination With Dinamic Data.

We can't use this principle because order column ISN'T unique!

likvidatorTM left a reply on Pagination With Dinamic Data.

Migration:

public function up()
{
    Schema::create('products', function (Blueprint $table) {
        $table->engine = 'InnoDB';
        $table->increments('id');
        $table->unsignedInteger('amount');
        $table->string('name', 30)->nullable();
        $table->enum('type', ['full-price', 'cut-price']);
        $table->timestamps();
    });
}

Controller:

public function index(Product $product, int $page = 1, string $filter = NULL)
{
    if ($filter && !in_array($filter, ['full-price', 'cut-price']))
        $filter = NULL;
    $page = (int)$page ?: 1;

    \Illuminate\Pagination\Paginator::currentPageResolver(function () use ($page) {
        return $page;
    });

    $paginator = $product->AvailableByPage($filter);
    $products['data'] = $paginator->items();
    $products['hasMore'] = $paginator->hasMorePages();
    if($page === 1)
        $products['total'] = $product->AvailableCount($filter);

    return $this->defaultResponse([
        'products' => [
            'items' => $products,
        ]]);
}

Model:

public function AvailableByPage(?string $filter)
{
    return Product::Select('*')
        ->if($filter, 'type', '=', $filter)
        ->where('amount', '>', 0)
        ->withSomethingElse()
        ->simplePaginate($this->items_per_page);
}

P/S its just example.

08 Dec
1 year ago

likvidatorTM started a new conversation Pagination With Dinamic Data.

Hi, i recently i used eloquent simple pagination but now i found some critical bug (eloquent method works fine, bug in my solution=)). In query i am use some conditions like if order active, if user can see this order end etc. When user gets next page results can be displaced and he gots incorrect data. For example: user loads first page with 10 orders after when he loads second page 8 of recent orders will set as "disabled" and response data will contains 2 orders that user already loaded. I cant use coursor pagination because order field not unique. I see only 1 way to resolve this problem: send from client orders ids that he loaded and then use its in query where `NOT IN. P/S its a SPA application.

02 Dec
1 year ago

likvidatorTM left a reply on Set Session User From Redis.

Yes, i looked sources and find this method but i thought that this isn't better way

likvidatorTM started a new conversation Set Session User From Redis.

Hi! When user's action must be autorithed laravel does request like this: SELECT * FROMusersWHEREid= LIMIT 1. I want avoid it and cache this request in redis but i not understand how.

16 Sep
1 year ago

likvidatorTM left a reply on Laravel And Vue.

I decided to use only Vue props and do all render on client-side.

likvidatorTM left a reply on Laravel And Vue.

Using Vue Props seems good but not perfect.

            <some-component inline-template
                            :user="{{ json_encode($user)}}">
                <div>
                    <span> {{ $user->name }} </span>
                    <span> {{ $user->last_name}} </span>
                </div>
            </some-component>

How tell Vue that user's name in first span and last name in second? Or how bind this with attributes?

likvidatorTM left a reply on Laravel And Vue.

Using Vue Props seems to be good but not perfect.

            <some-component inline-template
                            :user="{{ json_encode($user)}}">
                <div>
                    <span> {{ $user->name }} </span>
                    <span> {{ $user->last_name}} </span>
                </div>
            </some-component>

How tell Vue that user's name in first and user's last name in second. Or how bind this with some attributes?

13 Sep
1 year ago

likvidatorTM started a new conversation Laravel And Vue.

Hi! I'm don't understand how i can use laravel templates with Vue. Example:

<!--- index.html--->
<div id="app">
    <some-component inline-template>
        <div>
            <button type="button" @click="onButtonClick">
                {{$texts->text}}
            </button>
            <button type="button" @click="onButton2Click">
                {{$texts->text2}}
            </button>
        </div>
    </some-component>
</div>
<!--- some-component.vue--->
<script>
    export default {
        name: 'some-component',
        data() {
            return {
                buttonText: "",
        button2Text: "",
            }
        },
        methods: {
            onButtonClick() {
                this.buttonText = "Example";
            },
            onButton2Click() {
                this.buttonText2 = "Example2";
            }
        },
    }
</script>

And when user get this page he must see laravel-generated texts. Vue components will gets it into data vars. I don't know how do it beautifully. One of the ways I found:

<!--- index.html--->
<div id="app">
    <some-component inline-template>
        <div>
            <button type="button" @click="onButtonClick">
                <span v-html="buttonText">{{$texts->text}}</span>
            </button>
            <button type="button" @click="onButton2Click">
                <span v-html="buttonText2">{{$texts->text2}}</span>
            </button>
        </div>
    </some-component>
</div>

But in this case i must bind component data manually(differently texts will be overwritten).

P.S. Thanks in advance for your answers