Sti3bas

Member Since 1 Year Ago

Experience Points
161,480
Total
Experience

3,520 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
1014
Lessons
Completed
Best Reply Awards
101
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.

Level 33
161,480 XP
Oct
14
5 days ago
Activity icon

Replied to Queued Jobs Handled In Correct Order

@andersb glad to help! Please mark the best answer.

Oct
12
1 week ago
Activity icon

Replied to Contributing To A Package

Laravel's project composer.json:

"repositories": [
   {
      "type": "path",
      "url": "../path-to-package-folder",
      "options": {
         "symlink": true
       }
   }
],
"require": {
   "your/package": "*"
}
Oct
11
1 week ago
Activity icon

Replied to How To Add Stripe Elements In Vue2 From?

@mstdmstd so what are using using then? The above code is very similar to Laravel Cashier: https://laravel.com/docs/6.x/billing#creating-subscriptions

Activity icon

Replied to How To Add Stripe Elements In Vue2 From?

@mstdmstd if you're using the latest version of Laravel Cashier, then you need to get payment method with handleCardSetup, not a token with createToken.

https://laravel.com/docs/6.x/billing#storing-payment-methods

Activity icon

Replied to How To Add Stripe Elements In Vue2 From?

@mstdmstd components: { Card }, should be at the top level, not nested under data.

export default {
   components: { Card },
   //...
}
Activity icon

Replied to How To Add Stripe Elements In Vue2 From?

@mstdmstd seems like a problem with styles. I recommend you to use a package instead: https://github.com/fromAtoB/vue-stripe-elements

Activity icon

Replied to Middleware

@davy_yg you can assign a middleware to a group and you can have as many groups as you want (even nest them). Global middleware from routeMiddleware and middlewareGroups runs for ALL routes.

Activity icon

Replied to Targeting A Specific Component Out Of Many With A Click Event

@jasonfrye not sure if I understood your question correctly, but take a look at this:

<order-settings inline-template>
   <modal-tip ref="budget_allowance"></modal-tip>
   <modal-tip ref="other"></modal-tip>

   <button type="button" @click="open('budget_allowance')">Test</button>
   <button type="button" @click="open('other')">Test 2</button>
</order-settings>
methods: {
   open(ref) {
      let component = this.$refs[ref];
      // here you can call a method on modal-tip component to toggle visibility
      // for example: component.open();
   }
}
Activity icon

Replied to How To Add Stripe Elements In Vue2 From?

Is way I added Stripe to my vue form invalid? Which is valid way?

Yes, it's a valid way.

and which method have I to use as in my app I save my data with axios?

stripeTokenHandler

Activity icon

Replied to Middleware

@davy_yg if you add a middleware to any group in $middlewareGroups array it will only run for that group.

For example if you add a middleware to web group, it will run for all routes in routes/web.php file.

Oct
10
1 week ago
Activity icon

Replied to Mocked Dependency Is Not Resolved By The Controller

@voidmrvoid nope, I've just tested it myself and it works.

Test:

/** @test */
public function test_test()
{
    $this->mock(DummyClass::class, function ($mock) {
        $mock->shouldReceive('dummyMethod')->once()->andReturn('test');
    });

    $response = $this->getJson(route('home'))->json();

    $this->assertEquals(['test' => 'test'], $response);
}

Controller:

namespace App\Http\Controllers;

use App\DummyClass;

class HomeController extends Controller
{
    protected $dummyClass;

    public function __construct(DummyClass $dummyClass)
    {
        $this->dummyClass = $dummyClass;
    }

    public function __invoke()
    {
        return response()->json([
            'test' => $this->dummyClass->dummyMethod(),
        ]);
    }
}

PHPUnit 8.4.1 by Sebastian Bergmann and contributors.

.                                         1 / 1 (100%)

Time: 289 ms, Memory: 18.00 MB

OK (1 test, 2 assertions)
Activity icon

Replied to Using Jquery Plugins In Vue Components.

@nitinjohnson you can use jQuery plugins by wrapping it in Vue components.

I recommend you to read this article: https://vuejsdevelopers.com/2017/05/20/vue-js-safely-jquery-plugin/

Activity icon

Replied to Mocked Dependency Is Not Resolved By The Controller

@voidmrvoid your code seems good. Make sure you import WebhooksHandler correctly.

Oct
09
1 week ago
Activity icon

Replied to Javascript Form Submit To URL Or Controller

Change this form.submit(function(event) { to $("#button-id").on("click", function() { and add $('#form-id').submit(); at the end of callback.

Activity icon

Replied to Javascript Form Submit To URL Or Controller

button.onClick(function() {
   // above callback
   $('#form-id').submit();
});
Activity icon

Replied to Javascript Form Submit To URL Or Controller

@wallyj that's why you need to change it's type to button so that it would not submit the form when clicked.

Activity icon

Replied to Javascript Form Submit To URL Or Controller

@wallyj change button type from submit to button and add onClick event listener with the above callback and submit the form at the end.

Be aware that you will not be able to submit the form by clicking enter when filling text fields.

Activity icon

Replied to Javascript Form Submit To URL Or Controller

@wallyj that's because when you're trying to submit the form in the submit callback it creates infinite loop.

event.preventDefault(); will prevent your form from submitting, so it will execute the callback, but will not submit the form.

Activity icon

Replied to Does Laravel Vapor Support Task Scheduling?

@michaelnguyen547 yes.

Scheduled jobs are configured using CloudWatch/EventBridge, Vapor creates a rule that runs every minute and invokes your CLI lambda with the php artisan schedule:run command.

https://divinglaravel.com/what-is-aws-lambda-and-how-laravel-vapor-uses-it

Activity icon

Replied to If Statement In Return

return array_merge([
   'id' => $this->id,
   'title' => $this->title,
   'description' => $this->description,
   'status' => $this->status,
], $variable ? ['tags' => $this->tags] : []);
Activity icon

Replied to Proposal For Symfony Casts

@cosavostra well, Symfony already has their own official site for video tutorials: https://symfonycasts.com

Activity icon

Replied to Object Of Class Closure Could Not Be Converted To String Error When Updating Eloquent

Change this:

'currency'      => function(){
                    $currency = \App\Country::inRandomOrder()->pluck('currency_code')->first();
                    return $currency;
                }

to this:

'currency' => \App\Country::inRandomOrder()->pluck('currency_code')->first()

Oct
08
1 week ago
Activity icon

Replied to Laravel Project Unable To Run Locally

@geertvdv seems like you forgot to run composer install.

Activity icon

Replied to Correct Way To Assert That Mock Expectations Have Passed.

@bwrigley here is the line where it adds assertions count : https://github.com/laravel/framework/blob/5.8/src/Illuminate/Foundation/Testing/TestCase.php#L167

You can try to add dd to check if it hits this line.

Activity icon

Replied to Testing

@davy_yg well, PHPUnit 3.7.21 is more than 5 years old.

Try to run vendor/bin/phpunit --filter AuthenticationTest to run PHPUnit from vendor directory.

Activity icon

Replied to Testing

@davy_yg do you even read error messages?

A void function must not return a value

you should remove return type;.

Oct
07
1 week ago
Activity icon

Replied to Routing Bug

@zefex do you tried to run php artisan route:clear?

Activity icon

Replied to Search Form Error

Try this:

Product::where('is_approve', 1)->where(function($query) use ($search) {
    $query->where('name', 'like', '%'.$search.'%')
        ->orWhere('description', 'like', '%'.$search.'%');
})->get();
Activity icon

Replied to Bad Problem With Database TDD Laravel Course

@vasilukwolf you're not passing values from the request to create method.

routes/web.php:

App\Project::create(['title','description'])

should be:

App\Project::create(request()->only(['title','description']))

Activity icon

Replied to Correct Way To Assert That Mock Expectations Have Passed.

@bwrigley I can confirm that my example works in Laravel 5.8.31 and PHPUnit 7.5.2. Do you made any modifications to TestCase class?

Activity icon

Replied to Npm Install

@davy_yg you can try to update laravel-mix.

Activity icon

Replied to Correct Way To Assert That Mock Expectations Have Passed.

@bwrigley it works fine with the fresh Laravel 6 installation. Might be something with your site. What Laravel version you're using? Can you show the full test class?

/** @test */
class ExampleTest extends TestCase
{
    /** @test */
    public function dummy_test()
    {
        $spy = Mockery::spy(DummyClass2::class);
        $this->app->instance(DummyClass2::class, $spy);

        (new DummyClass)->dummyMethod();

        $spy->shouldHaveReceived('dummyMethod')->with('test')->once();
        $spy->shouldHaveReceived('dummyMethod2')->with('test2')->once();
    }
}
PHPUnit 8.3.5 by Sebastian Bergmann and contributors.

.                                   1 / 1 (100%)

Time: 210 ms, Memory: 16.00 MB

OK (1 test, 2 assertions)
Activity icon

Replied to Correct Way To Assert That Mock Expectations Have Passed.

@bwrigley does your test class extends Laravel's TestCase?

If no, then you need to manually call Mockery::close(). Add this at the end of your test class:

public function tearDown() {
    \Mockery::close();
}
Activity icon

Replied to Search Vs Find

@davy_yg search method comes from Laravel Scout and it's used for full-text search, you can read more about it here: https://laravel.com/docs/6.x/scout

find method allows you to retrieve a model by its primary key: https://laravel.com/docs/6.x/eloquent#retrieving-single-models

Activity icon

Replied to How To Forbid User From Model Specific Property?

@danimohamadnejad the data returned from validate method will only include validated fields.

Activity icon

Replied to Testing

@davy_yg you have to add return type to setUp method public function setUp(): void

Activity icon

Replied to View Render Returns Undefined Variable

@jonjie can you show your view file?

Activity icon

Replied to View Render Returns Undefined Variable

@jonjie can you post the full exception?

Activity icon

Replied to How To Forbid User From Model Specific Property?

@danimohamadnejad you can conditionally change validation rules and then pass validated data to update method:

$rules = [
   //...
];

if($request->user()->hasRole('admin')) { // your might be different
    $rules = ['stateid' => 'required'];
}

$data = $request->validate($rules);

// fetch model

$model->update($data);

Activity icon

Replied to View Render Returns Undefined Variable

@jonjie do you defined $user variable?

Activity icon

Replied to Testing

@davy_yg phpunit --filter AuthenticationTest

Oct
06
1 week ago
Activity icon

Replied to Method Destroy() Not Picking Up ID

@boby the param should be named $owe, not $oweId:

public function destroy($owe)

Activity icon

Replied to Why It Is Showing Undefined Class View?

@nakov it should also work with use View;.

@atif123 Do you have 'View' => Illuminate\Support\Facades\View::class, in aliases array in config/app.php? Do you tried to run composer dump-autoload?

Activity icon

Replied to API

What does this line for?

Well, the comment above clearly states what it does Update the authenticated user's API token..

For the token in which table do I need to add the column token supposing that I want to return product_api ?

Not sure what you are talking about, but you should store the token in users table.