tomasosho

CEO at TAP ventures & Edar Tech

Member Since 2 Years Ago

Abuja

Experience Points
11,890
Total
Experience

3,110 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
2
Lessons
Completed
Best Reply Awards
2
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.

  • Community Pillar

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

Level 3
11,890 XP
Jan
15
3 days ago
Jan
13
5 days ago
Activity icon

Replied to ...Eloquent\Collection::orWhere Does Not Exist.

ErrorException
Undefined variable: q on line 
$query->where( 'name', 'LIKE', '%' . $q . '%' )
Jan
12
6 days ago
Activity icon

Replied to How To Create A-Z Pagination

Thanks this makes sense! I just have to figure out how to include my query but thank you!.

Activity icon

Started a new Conversation How To Create A-Z Pagination

In laravel How can I create A-Z pagination for example I've a table users

I want to create sorting pagination from the first letter like In character A all the users starting with A must be the same with A-Z.

Activity icon

Replied to ...Eloquent\Collection::orWhere Does Not Exist.

@snapey can you help with a sample of a proper sql query for $userss?

Activity icon

Replied to ...Eloquent\Collection::orWhere Does Not Exist.

You're right, i made an error, it was supposed to be paginate(20)/take(20)->get() and not ```get(20)````

Activity icon

Replied to ...Eloquent\Collection::orWhere Does Not Exist.

get wouldn't work, it's supposed to be paginate(20) and just as @snapey said, i can't run an sql statement on an eloquent collection.

Jan
11
1 week ago
Activity icon

Started a new Conversation ...Eloquent\Collection::orWhere Does Not Exist.

$userss = User::whereHas('roles', function ($q) {
                $q->where('name', 'manager');
            })->get();

            $q = $request->get ( 'q' );

            $users = $userss->where( 'name', 'LIKE', '%' . $q . '%' )->orWhere( 'email', 'LIKE', '%' . $q . '%' )->orWhere( 'phone', 'LIKE', '%' . $q . '%' )->get(20);
            // dd($users);

            if (count ( $users ) > 0)
                return view ( 'frontEnd.search.agent' , compact('users'))->withDetails( $users )->withQuery ( $q );
            else
                return view ( 'frontEnd.search.agent', compact('users'))->withMessage ( 'No Details found. Try to search again !' );
Jan
08
1 week ago
Activity icon

Awarded Best Reply on Target Class [UsersSeeder] Does Not Exist.

change

class CreateUsersSeeder extends Seeder

to

class UsersSeeder extends Seeder
Dec
30
2 weeks ago
Activity icon

Replied to If Exists

From what I can see, the ‘’’’$distance’’’’ variable has too many definitions, you could rename the main distance formula to be ‘’’’$distances = //formula ’’’’. Then change distance in if and else statements to be $distances.

Dec
28
3 weeks ago
Activity icon

Replied to If Exists

This should work

public function customerLocation(Request $request)
{

    $nearCustomer = collect([]);
    $customerLat = $request->lat;
    $customerLng = $request->lng;


    $customer = Customer::all('name', 'code', 'lat', 'lng');


    foreach ($customer as $customer) {
        if ($customerLng and $customerLat != '') {


            $theta = $customerLng - $customer->lng;
            $distance = floatval(sin(deg2rad($customerLat))) * floatval(sin(deg2rad($customer->lng))) +
                floatval(cos(deg2rad($customerLat))) * floatval(cos(deg2rad($customer->lng))) * floatval(cos(deg2rad($theta)));

            $distance = floatval(acos($distance));
            $distance = $distance * 60 * 1.1515; //60 min , 1.1515 because radian
            $distance = $distance * 1.609344;
        }
        if ($distance <= 20) {

            $nearCustomer->push(Customer::all('name', 'code', 'lat', 'lng'));
            return response($nearCustomer);
        }else if($distance == '' or NULL) {
            return response("null")
        }


    }

}
Activity icon

Replied to Target Class [UsersSeeder] Does Not Exist.

change

class CreateUsersSeeder extends Seeder

to

class UsersSeeder extends Seeder
Activity icon

Replied to If Exists

It's supposed to automatically return null by the way if a value is missing though, it's it's an api

Activity icon

Replied to If Exists

try this

$dbcustomernull = "";

or 

$dbcustomernull = null;
Activity icon

Replied to If Exists

you could substitute this in your else

else {
$dbcustomernull = '';
 return response($dbcustomernull);
}

or

else if($distance == '' or NULL) {
$dbcustomernull = '';
 return response($dbcustomernull);
}
Activity icon

Replied to If Exists

yes

Activity icon

Replied to If Exists

//To check after calculating

public function customerLocation(Request $request)
{
    $nearCustomer = collect([]);
    $customerLat = $request->lat;
    $customerLng = $request->lng;

    $customer = Customer::all('name', 'code', 'lat', 'lng');


    foreach ($customer as $customer) {
        $theta = $customerLng - $customer->lng;
        $distance = floatval(sin(deg2rad($customerLat))) * floatval(sin(deg2rad($customer->lng))) +
            floatval(cos(deg2rad($customerLat))) * floatval(cos(deg2rad($customer->lng))) * floatval(cos(deg2rad($theta)));

        $distance = floatval(acos($distance));
        $distance = $distance * 60 * 1.1515; //60 min , 1.1515 because radian
        $distance = $distance * 1.609344;


    }

    if ($distance <= 20 ) {

        $nearCustomer->push(Customer::all('name', 'code', 'lat', 'lng'));

        return response($nearCustomer);

    }
else if($distance == '' or NULL) {
 return response();
}

}

//To check before calculating

public function customerLocation(Request $request)
{
    $nearCustomer = collect([]);
    $customerLat = $request->lat;
    $customerLng = $request->lng;

    $customer = Customer::all('name', 'code', 'lat', 'lng');


    foreach ($customer as $customer) {
if($customerLng AND $customerLat != NULL or ''){
        $theta = $customerLng - $customer->lng;
        $distance = floatval(sin(deg2rad($customerLat))) * floatval(sin(deg2rad($customer->lng))) +
            floatval(cos(deg2rad($customerLat))) * floatval(cos(deg2rad($customer->lng))) * floatval(cos(deg2rad($theta)));

        $distance = floatval(acos($distance));
        $distance = $distance * 60 * 1.1515; //60 min , 1.1515 because radian
        $distance = $distance * 1.609344;


    }

    if ($distance <= 20 ) {

        $nearCustomer->push(Customer::all('name', 'code', 'lat', 'lng'));

        return response($nearCustomer);

    }
}
else {
 return response();
}

}
Dec
19
4 weeks ago
Activity icon

Replied to Field 'password' Doesnt Have A Default Value

make sure your user.php looks like this

/**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password', 'updated_at', 'created_at'
    ];
Activity icon

Replied to Php Artisan Route:list Not Working

check to confirm your RoleController is under the manager folder in Http

Activity icon

Replied to Mac - ImageMagick Not Working

try reinstalling your php version then restart your pc

Activity icon

Started a new Conversation Symfony\Component\ErrorHandler\Error\FatalError Declaration Of App\Product::sluggable() Must Be Compatible With Cviebrock\EloquentSluggable\Sluggable::sluggable(): Array

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Cviebrock\EloquentSluggable\Sluggable;

class Product extends Model
{
    use Sluggable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'p_name', 'p_code', 'user_id', 'p_color', 'description', 'price', 'image', 'categories_id', 'user_slug',
    ];

    /**
     * Return the sluggable configuration array for this model.
     *
     * @return array
     */
    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'p_name'
            ]
        ];
    }
}
Dec
15
1 month ago
Activity icon

Replied to How To List Inbox Messages

This isn'y working though

Dec
14
1 month ago
Activity icon

Started a new Conversation How To List Inbox Messages

###USER Model

 public function latestmessaging()
    {
        return $this->hasMany(Message::class, 'to', 'id');
    }
    
    public function latestMessagefrom()
    {
        return $this->hasMany('App\Message', 'from', 'id');
    }
### Message Model

public function scopeLatestSendersMessages($query) 
    {
        return $query->orderBy('created_at', 'desc')
            ->get(['id', 'from', 'read', 'to', 'text', 'image', 'video', 'price', 'paid', 'created_at'])
            ->unique('from');
    }
}
###Controller

$messagetoauthuser = $c->latestmessaging()->latestSendersMessages();
$messagefromauthuser = $c->latestMessagefrom()->latestSendersMessages();
$authusermessages = $sawa AND $cawa;
        	
Dec
13
1 month ago
Activity icon

Replied to How To List Out Messages In Inbox.

Yes I did, Im

Dec
12
1 month ago
Activity icon

Started a new Conversation How To List Out Messages In Inbox.

I am getting empty values when i dd($messagelist). I just want to list out messages in my inbox. User Model

public function latestMessageto()
    {
        return $this->hasOne('App\Message', 'to', 'id')->latest();
    }
    
public function latestMessagefrom()
    {
        return $this->hasOne('App\Message', 'from', 'id')->latest();
    }

Controller

$messagelist = User::where('id', $user)->with('latestMessageto', 'latestMessagefrom')->get();
Dec
08
1 month ago
Activity icon

Replied to Unable To Ignore Email Of The User, When Updating A Selected User, In Case Of Model Property Binding, In Livewire.

Check your error log to confirm the error message produced

before your rule in your controller, you can say

if(email == ' ')
{
$email = $user->email
protected $rules = [
        'user.name' => ['required','string','max:255'],
        'user.email' => ['required','string','email','max:255','unique:users.email'],
        'role' => ['required'],
    ];
}
Activity icon

Replied to ErrorException Trying To Get Property 'product_id' Of Non-object (View:

Thanks, i ran it this way.

@if($i->deal == null)
                                
@elseif($i->deal !== null)

@endif
Activity icon

Replied to Unable To Ignore Email Of The User, When Updating A Selected User, In Case Of Model Property Binding, In Livewire.

You set your user in the rules as required, my advice is you should make user email input field as value not placeholder e.g

<x-input.group for="email" label="Email" :error="$errors->first('user.email')">
                    <x-input.text wire:model="user.email" id="email" value="{{$user->email}}" />

OR you take out the required from your rules under email

Activity icon

Replied to ErrorException Trying To Get Property 'product_id' Of Non-object (View:

Yes, but with this only the elseif form is displaying, the if form is not displaying

@if($i->deal && $i->deal->product_id != $i->id)
                                <form action="{{ route('produce.store') }}" style="margin-left : 20px;float:right;"  method="post" data-toggle="tooltip" data-original-title="Add to Deals">
                                    {{ csrf_field() }}
                                    <input type="text" name="deal" value="{{$i->id}}" hidden>
                                    <button type="submit" class="btn btn-success"> Add to Deals</button>
                                </form>

@elseif($i->deal && $i->deal->product_id == $i->id)
                                <form action="{{ route('produce.update', $i->deal->id) }}" style="margin-left : 20px;float:right;"  method="post" data-toggle="tooltip" data-original-title="Add to Deals">
                                    {{ csrf_field() }}
                                    <input type="text" name="deal" value="" hidden>
                                    <button type="submit" class="btn btn-danger"> Remove Deal</button>
                                </form>
@endif
Activity icon

Started a new Conversation ErrorException Trying To Get Property 'product_id' Of Non-object (View:

I have my product_id in a foreach loop. My deal relationship is null for some that's why i'm getting the error.

@if($i->deal->product_id != $i->id)

@endif

when i acknowledge the null values, the error disappears, but then the if statement does not work. e.g

@if($i->deal->product_id ?? ' ' != $i->id)

@endif

how can i get the if statement working even with the null values?

Dec
07
1 month ago
Activity icon

Replied to Blade Calculation

i want to make the calculation...

		@foreach($products as $i)
                        <tr>
                            
                                <td>{{($i->price/$i->old_price)*100}}</td>

                            </td>
                        </tr>
                 @endforeach
Activity icon

Replied to Blade Calculation

$i->price and $i->old_price are in a foreach loop. how do i print their values?

Activity icon

Started a new Conversation Blade Calculation

I want to calculate this in my blade, instead its returning same values to me

{!! $i->price !!}/{!! $i->old_price !!}x100

how do i run calculations in blade?

Nov
30
1 month ago
Activity icon

Awarded Best Reply on ErrorException Call To Undefined Method App\AgentVerify::links()

This worked for me.

$app = AgentVerify::first();
$agents = $app->with('user')->paginate(10);
Activity icon

Replied to ErrorException Call To Undefined Method App\AgentVerify::links()

This worked for me.

$app = AgentVerify::first();
$agents = $app->with('user')->paginate(10);
Activity icon

Replied to ErrorException Call To Undefined Method App\AgentVerify::links()

This is looping my user relationship and not the app items. I'm just getting one app item.

$agent = $app->setRelation('user', $app->user()->paginate(10));

I took out the paginate, and it's looping the app item, just that my user relationship is not working or appearing underneath the $app

$agent = $app->setRelation('user', $app->user())->paginate(10);
Activity icon

Replied to ErrorException Call To Undefined Method App\AgentVerify::links()

{{ $agent->links() }} same thing

Nov
29
1 month ago
Activity icon

Started a new Conversation ErrorException Call To Undefined Method App\AgentVerify::links()

{!! $agent->links() !!}
$agent = AgentVerify::with('user')->orderBy('created_at','desc')->paginate(5);
Nov
18
2 months ago
Activity icon

Replied to True Or False Statements

You were right

if (auth()->user()->following->where('user_id',$user->id)->count() >= 1) {
            $follows = true;
        }
        else{
            $follows = false;
        }

@gitwithravish

But instead of me finding the same id, i just counted.

Thank you for showing interest.

Activity icon

Replied to True Or False Statements

Here is my dd again, I'm user a pivot

Illuminate\Database\Eloquent\Collection {#717 ▼
  #items: array:3 [▼
    0 => App\Profile {#725 ▶}
    1 => App\Profile {#736 ▶}
    2 => App\Profile {#728 ▼
      #guarded: []
      #connection: "mysql"
      #table: "profiles"
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:6 [▼
        "id" => 7527
        "user_id" => 7528
        "description" => null
        "url" => null
        "created_at" => "2020-11-16 15:49:46"
        "updated_at" => "2020-11-16 15:49:46"
      ]
      #original: array:8 [▼
        "id" => 7527
        "user_id" => 7528
        "description" => null
        "url" => null
        "created_at" => "2020-11-16 15:49:46"
        "updated_at" => "2020-11-16 15:49:46"
        "pivot_user_id" => 1
        "pivot_profile_id" => 7527
      ]
      #changes: []
      #casts: []
      #dates: []
      #dateFormat: null
      #appends: []
      #dispatchesEvents: []
      #observables: []
      #relations: array:1 [▼
        "pivot" => Illuminate\Database\Eloquent\Relations\Pivot {#722 ▼
          +incrementing: false
          #guarded: []
          #connection: "mysql"
          #table: "profile_user"
          #primaryKey: "id"
          #keyType: "int"
          #with: []
          #withCount: []
          #perPage: 15
          +exists: true
          +wasRecentlyCreated: false
          #attributes: array:2 [▼
            "user_id" => 1
            "profile_id" => 7527
          ]
          #original: array:2 [▶]
          #changes: []
          #casts: []
          #dates: []
          #dateFormat: null
          #appends: []
          #dispatchesEvents: []
          #observables: []
          #relations: []
          #touches: []
          +timestamps: false
          #hidden: []
          #visible: []
          #fillable: []
          +pivotParent: App\User {#713 ▶}
          #foreignKey: "user_id"
          #relatedKey: "profile_id"
        }
      ]
      #touches: []
      +timestamps: true
      #hidden: []
      #visible: []
      #fillable: []
    }
  ]
}
Activity icon

Replied to True Or False Statements

Yes, i am trying to see if a LOGGED IN USER (auth()->user()) is following a user```($user).

Activity icon

Replied to True Or False Statements

My user model

public function following()
    {
        return $this->belongsToMany(Profile::class);
    }

My profile model

public function user()
    {
        return $this->belongsTo(User::class);
    }
Activity icon

Replied to True Or False Statements

i'm getting null with this

$result = auth()->user()->following()->where('profile_id',$user->id)->first();
        dd($result);
Activity icon

Replied to True Or False Statements

I have the column profile_id. It comes in form of an array thats why

Activity icon

Replied to True Or False Statements

when i dd(auth()->user()->following); My result

Illuminate\Database\Eloquent\Collection {#717 ▼
  #items: array:3 [▼
    0 => App\Profile {#725 ▶}
    1 => App\Profile {#736 ▶}
    2 => App\Profile {#728 ▼
      #guarded: []
      #connection: "mysql"
      #table: "profiles"
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:6 [▼
        "id" => 7527
        "user_id" => 7528
        "description" => null
        "url" => null
        "created_at" => "2020-11-16 15:49:46"
        "updated_at" => "2020-11-16 15:49:46"
      ]
      #original: array:8 [▶]
      #changes: []
      #casts: []
      #dates: []
      #dateFormat: null
      #appends: []
      #dispatchesEvents: []
      #observables: []
      #relations: array:1 [▶]
      #touches: []
      +timestamps: true
      #hidden: []
      #visible: []
      #fillable: []
    }
  ]
}
Activity icon

Replied to True Or False Statements

Exception
Property [profile_id] does not exist on this collection instance.