tokoiwesley

tokoiwesley

Member Since 2 Years Ago

Nairobi

Experience Points
40,290
Total
Experience

4,710 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
310
Lessons
Completed
Best Reply Awards
13
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 9
40,290 XP
Sep
28
1 month ago
Activity icon

Replied to Arrow Function Inside A If Statement

As @tykus has pointed out, you need to declare your arrow function. Using your example...

did_we_find_item_to_remove ="no";
is_thier_pagination = "no";

let myArrowFunction = () => console.log("We are in");

if(did_we_find_item_to_remove != "yes" && is_thier_pagination != "yes")

{

    myArrowFunction();

} else {

    console.log("We are out");

}
Activity icon

Commented on Eloquent Subquery Additions

Thanks for the lesson.

Jul
16
3 months ago
Activity icon

Replied to Weird 'Function Name Must Be A String' With Auth:api

@matthewh Well, I have figured out that this error is due to improperly registering the said middleware in app/Http/Kernel.php. On correcting my mistake everything is fine and works as expected.

Activity icon

Replied to Laravel Passport: 'Function Name Must Be A String' Error

On trying to reproduce the error on a separate project, I figured out what the issue was;

I missed to properly register the CheckClientCredentials::class middleware in app/Http/Kernel.php. Everything is now working perfectly.

Activity icon

Replied to Vue.js Vs Angular:

@mahaveer Frameworks and languages are just tools. They have both strengths and weaknesses depending on the context (task/project) because of how they work (are designed to work) internally.

So without a specific project at hand (no variables to consider) it's just as @tykus stated!

Activity icon

Replied to Weird 'Function Name Must Be A String' With Auth:api

@tray2 I don't exactly see how I have hijacked the thread! I wanted to know whether a solution was found because the problem @matthewh experienced is identical to what am experiencing. Nevertheless, I have created a new thread for my issue.

Activity icon

Started a new Conversation Laravel Passport: 'Function Name Must Be A String' Error

I have a working implementation of Laravel Passport that has only uses Password Grant tokens for authentication of users. So on trying to implement Client Credentials Grant for server-to-server authentication, the client middleware throws a weird error I have never encountered before: "Function name must be a string" whenever I apply it on any route I want to protect.

  • php: 7.1.3
  • laravel framework: 5.7.25
  • laravel passport: 7.0
"message": "Function name must be a string",
    "exception": "Symfony\Component\Debug\Exception\FatalThrowableError",
    "file": "/var/www/html/mochange/project.test/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
    "line": 152,
Activity icon

Replied to Weird 'Function Name Must Be A String' With Auth:api

@matthewh Did you find a solution?

I am getting this error as well when I tried to implement machine-to-machine (server-to-server) authentication (using client credentials) . In my case the auth:api middleware works perfectly fine, but the client middleware throws the same error described above.

Jun
11
5 months ago
Jun
07
5 months ago
Activity icon

Replied to Laravel Passport Test

You don't need to add any controllers. Before diving into Laravel passport testing, you need to be familiar with writing tests in Laravel.

Activity icon

Replied to Prevent Factory Duplication For Models Relationships

Yes, there is another way. Modify your Seeder as shown below:

use App\Thread;
use App\Tag;

factory(Thread::class, 60)->create();

Thread::all()->each(function ($thread){
factory(Tag::class, 10)->create(['thread_id'=> $thread->id]);
});
Activity icon

Replied to Tokenmismatchexception With Script

First, don't encrypt the csrf_token(). Pass it exactly the way it is generated. Next, I can see in your script you are setting the X-XSRF-TOKEN header. Have you tried using the X-CSRF-TOKEN header instead?

Jun
03
5 months ago
Activity icon

Replied to Relationship HasMany() Dosen't Work

@RESPECT - Then maybe you are using migrations the wrong way. They are meant exactly for this type of job in the first place - easily modifying tables in production.

May
28
5 months ago
Activity icon

Replied to Project Not Being Created

@swimmer using @nakov's solution should solve the issue. Your Laravel project folder will be Medici.

Activity icon

Replied to Project Not Being Created

What do you want the name of your project folder/directory to be?

Activity icon

Replied to Relationship HasMany() Dosen't Work

I created these tables in production manually without migration what i forget

@respect editing code directly in production is a terrible idea. I suggest you write the code in your local environment and test it before moving/deploying it to production.

May
22
5 months ago
Activity icon

Replied to Insert Multiple Data Into Database

@EMFINANGA - Say for example a customer can have many orders. Your orders table should have the relevant column to accommodate this relationship then you'll define the relationship and it's inverse in the respective models.

I have used the customers to represent your customer_details table;

customers - id - name ...

orders - id - customer_id ...

Customer model class

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Customer extends Model
{
    protected $guarded;

    public function orders()
    {
        return $this->hasMany(Order::class, 'customer_id', 'id');
    }
}

Order model class

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    protected $guarded = [];

    public function customer()
    {
        return $this->belongsTo(Customer::class, 'customer_id', 'id');
    }
}

When a customer makes an order, you need to retrieve the relevant customer model (record) and create a related order model (record). Example;

<?php

namespace App\Http\Controllers;

use App\Order;
use App\Customer;
use Illuminate\Http\Request;

class OrdersController extends Controller
{
    public function store(Request $request)
    {
        $customer = Customer::find(1);

        Order::create([
            'customer_id' => $customer->id,
            ...
        ]);
    }
}
May
20
5 months ago
Activity icon

Replied to Insert Multiple Data Into Database

If I get your question, you need to use a relationship between the two tables.

May
15
5 months ago
Activity icon

Replied to Laravel Csrf Token Mismatch In POST Request With URL

@CRAZYLIFE - Then you will need to use the second solution I have suggested above (exclude /response from CSRF protection)

Activity icon

Replied to Laravel Csrf Token Mismatch In POST Request With URL

If you don't want to pass the token then exclude /response from CSRF protection in /app/Http/Middleware/VerifyCsrfToken.php file;

/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
    'response',
];

or

protected $except = [
    'http://www.test.com/response',
];
Activity icon

Replied to Laravel Csrf Token Mismatch In POST Request With URL

Use the @csrf Blade directive to generate the token field

<form method="POST" action="/response">
    @csrf
    ...
</form>