SimonAngatia

Member Since 8 Months Ago

Experience Points
4,030
Total
Experience

970 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 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 1
4,030 XP
May
03
1 week ago
Activity icon

Started a new Conversation Error: SyntaxError: Unexpected End Of JSON Input , How Do I Trim A Json Object ?

When I try to access this object I get the error: Error: SyntaxError: Unexpected end of JSON input

I guess the error is caused by this text: Stripe\CustomerJSON: Since it comes from API, I don't have permission to change the format sent, so my question is, how can I remove the Stripe\CustomerJSON: so that I can just remain with the object {...}?


Stripe\CustomerJSON: {
    "id": "cus_JPr25ELrOxjUMC",
    "object": "customer",
    "account_balance": 0,
    "address": null,
    "balance": 0,
    "created": 1620046638,
    "currency": null,
    "default_source": "ba_1In1KrKzAfELnZRjY1737TVJ",
    "delinquent": false,
    "description": "First Customer to create with stripe",
    "discount": null,
    "email": null,
    "invoice_prefix": "66A1C8A9",
    "invoice_settings": {
        "custom_fields": null,
        "default_payment_method": null,
        "footer": null
    },
    "livemode": false,
    "metadata": [],
    "name": null,
    "next_invoice_sequence": 1,
    "phone": null,
    "preferred_locales": [],
    "shipping": null,
    "sources": {
        "object": "list",
        "data": [
            {
                "id": "ba_1In1KrKzAfELnZRjY1737TVJ",
                "object": "bank_account",
                "account_holder_name": null,
                "account_holder_type": null,
                "bank_name": "STRIPE TEST BANK",
                "country": "US",
                "currency": "usd",
                "customer": "cus_JPr25ELrOxjUMC",
                "fingerprint": "O2amzjOW6lblceV3",
                "last4": "6789",
                "metadata": [],
                "routing_number": "110000000",
                "status": "verified"
            }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "\/v1\/customers\/cus_JPr25ELrOxjUMC\/sources"
    },
    "subscriptions": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "\/v1\/customers\/cus_JPr25ELrOxjUMC\/subscriptions"
    },
    "tax_exempt": "none",
    "tax_ids": {
        "object": "list",
        "data": [],
        "has_more": false,
        "total_count": 0,
        "url": "\/v1\/customers\/cus_JPr25ELrOxjUMC\/tax_ids"
    },
    "tax_info": null,
    "tax_info_verification": null
}

May
02
1 week ago
Activity icon

Started a new Conversation How Do I Solve Package Conflicts In Laravel?

I am trying to install a package but the process aborts with the error: package requires guzzlehttp/guzzle ^6.3 -> found guzzlehttp/guzzle[6.3.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1). So my question is: Is there a way I can tweek the package to be installed without that error? If yes, please explain how.

Apr
23
2 weeks ago
Activity icon

Started a new Conversation Vue-carousel Not Working With Dynamic Content

I am trying to display contents using cue-carouse. It works with static content but when I try dynamic content, it doesn't work. Any help will be appreciated

code:


 <carousel>
            <template slot="prev"><span class="prev">prev</span></template>

            <a href="" class="px-3" v-for="sport in sports" :key="sport.id"
                ><i class="icofont-football"></i>
                <p>{{ sport.name }}</p></a
            >

            <template slot="next"><span class="next">next</span></template>
        </carousel>


<script>

import carousel from "vue-owl-carousel";

</script>

Apr
22
2 weeks ago
Activity icon

Started a new Conversation I Need An Advice On Consuming Sports API

I want to consume a sports API but I am undecided on where to write the logic, Vue js side or Laravel side? This is the application layout: The application is a Laravel application with a Vue frontend. I know that I can handle the data from the Vue side by using Axios then process data from there then Laravel side can be used for storing user's bets. I tried fetching the data from the Laravel side but it is too slow and the site has to be fast. I would appreciate your advice on this matter. Thank you!

Mar
07
2 months ago
Activity icon

Replied to Redirecting To Home Route With Data, Laravel 8

I don't know why I didn't think of this :)

Activity icon

Replied to Redirecting To Home Route With Data, Laravel 8

Please show example code

Activity icon

Replied to Redirecting To Home Route With Data, Laravel 8

This throws a PAGE EXPIRED ERROR

Activity icon

Started a new Conversation Redirecting To Home Route With Data, Laravel 8

In the login controller laravel 8 , users are redirected to home page /home by default. My question is what should I do to redirect to home with some data? Lets say I want to redirect to home page with $posts data, how do I do that?

This is the default login controller Laravel 8.

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = RouteServiceProvider::HOME;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
}


Mar
02
2 months ago
Activity icon

Started a new Conversation Connection Could Not Be Established With Host Mail.domain.com :stream_socket_client()

I am using C-PANEL to send emails, it was working well initially but after a few days, it started throwing this error. Any suggestions that could lead to the solution?

Error:

Connection could not be established with host mail.domain.com :stream_socket_client(): unable to connect to tcp://mail.domain.com:465 (Connection timed out) {"userId":145,"exception":"[object] (Swift_TransportException(code: 0): Connection could not be established with host mail.domain.com

Feb
26
2 months ago
Activity icon

Replied to Toastr Notification Not Working

I have a problem. Mine is working but no notification colors. All notifications are coming in white. Could you help? Thank you

Feb
22
2 months ago
Activity icon

Replied to Count(): Parameter Must Be An Array Or An Object That Implements Countable On Laravel Relationship

Thank you for eager loading warning, I have changed it to this:


public function index()
    {
        $categories = Category::with(['forums.topics', 'forums.posts'])->get();
        return view('welcome', \compact('categories'));
    }

I hope that is correct?

Activity icon

Replied to Count(): Parameter Must Be An Array Or An Object That Implements Countable On Laravel Relationship

This is my forum model:


<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Forum extends Model
{
    use HasFactory;

    protected $guarded = [];

    public function category()
    {
        return $this->belongsTo('App\Models\Category');
    }

    public function topics()
    {
        return $this->hasMany('App\Models\Topic');
    }
    public function posts()
    {
        return $this->hasMany('App\Models\Post');
    }
}


Activity icon

Replied to Count(): Parameter Must Be An Array Or An Object That Implements Countable On Laravel Relationship

This is how I pass the data to the view file:


public function index()
    {
        $categories = Category::latest()->get();
        return view('welcome', \compact('categories'));
    }

How I access the data in view file:


@extends('layouts.app')

@section('content')
    

<div class="row">
    <div class="col-lg-8">
      <div class="row">

        @if (count($categories) > 0)
            @foreach ($categories as $category)
            <div class="col-lg-12 table-responsive">
              <!-- second section  -->
              <a href="{{route('category.overview', $category->id)}}">
                <h4 class="text-white bg-info mb-0 p-4 rounded-top">
                  {{$category->title}}
                </h4>
              </a>
              <table
                class="table table-striped table-responsive table-bordered"
              >
                <thead class="thead-light">
                  <tr>
                    <th scope="col">Forum</th>
                    <th scope="col">Topics</th>
                    <th scope="col">Posts</th>
                    {{-- <th scope="col">Latest Post</th> --}}
                  </tr>
                </thead>
                <tbody>

                  @if (count($category->forums) > 0)
                      @foreach ($category->forums as $forum)
                      <tr>
                        <td>
                          <h3 class="h5">
                            <a href="#" class="text-uppercase">{{$forum->title}}</a>
                          </h3>
                          <p class="mb-0">
                            {!!$forum->desc!!}
                          </p>
                        </td>
                        <td><div>{{count($forum->topics)}}</div></td>
                        <td><div>{{count($forum->posts)}}</div></td>
                        {{-- <td>
                          <h4 class="h6 font-weight-bold mb-0">
                            <a href="#">Post name</a>
                          </h4>
                          <div><a href="#">Author name</a></div>
                          <div>06/07/ 2021 20:04</div>
                        </td> --}}
                      </tr>
                      @endforeach
                  @else
                      <p>0 Forums found in this category</p>
                  @endif
              


                </tbody>
              </table>
            </div>
            @endforeach
        @else
            <h1>No Forum categories found</h1>
        @endif
        <!-- Category one -->
       
      </div>
    </div>
    <div class="col-lg-4">
      <aside>
        <div class="card">
          <div class="card-body">
            <h4 class="card-title">Members Online</h4>
            <ul class="list-unstyled mb-0">
              <li><a href="#">Member name</a></li>
              <li><a href="#">Member name</a></li>
              <li><a href="#">Member name</a></li>
              <li><a href="#">Member name</a></li>
              <li><a href="#">Member name</a></li>
            </ul>
          </div>
          <div class="card-footer">
            <dl class="row">
              <dt class="col-8 mb-0">Total:</dt>
              <dd class="col-4 mb-0">10</dd>
            </dl>
            <dl class="row">
              <dt class="col-8 mb-0">Members:</dt>
              <dd class="col-4 mb-0">10</dd>
            </dl>
            <dl class="row">
              <dt class="col-8 mb-0">Guests:</dt>
              <dd class="col-4 mb-0">3</dd>
            </dl>
          </div>
        </div>
        <div class="card">
          <div class="card-body">
            <h4 class="card-title">Members Statistics</h4>
            <dl class="row">
              <dt class="col-8 mb-0">Total Forums:</dt>
              <dd class="col-4 mb-0">15</dd>
            </dl>
            <dl class="row">
              <dt class="col-8 mb-0">Total Topics:</dt>
              <dd class="col-4 mb-0">500</dd>
            </dl>
            <dl class="row">
              <dt class="col-8 mb-0">Total members:</dt>
              <dd class="col-4 mb-0">200</dd>
            </dl>
          </div>
          <div class="card-footer">
            <div>Newest Member</div>
            <div><a href="#">Member Name</a></div>
          </div>
        </div>
      </aside>
    </div>
  </div>
</div>

@endsection



Feb
20
2 months ago
Activity icon

Replied to Count(): Parameter Must Be An Array Or An Object That Implements Countable On Laravel Relationship

Yes, that returns 0, that is what I don't understand why it is returning 0 instead of an array

Activity icon

Started a new Conversation Count(): Parameter Must Be An Array Or An Object That Implements Countable On Laravel Relationship

I have forums table, topics table and posts table. the relationship between the posts and topics to forums in one to many. I have implemented the relationship but when I try to access the topics count by doing {{count($forum->topics)}} I get this error: count(): Parameter must be an array or an object that implements Countable However, when I try accessing the posts count in the same way:{{count($forum->posts)}}, it works correctly. Please help

Forum model:


<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Forum extends Model
{
    use HasFactory;

    protected $guarded = [];

    public function category()
    {
        return $this->belongsTo('App\Models\Category');
    }

    public function topics()
    {
        return $this->hasMany('App\Models\Topic');
    }
    public function posts()
    {
        return $this->hasMany('App\Models\Post');
    }
}


Topic model:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Topic extends Model
{
    use HasFactory;

    public function forum()
    {
        return $this->belongsTo('App\Models\Forum');
    }
}


Post Model:


<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    use HasFactory;
    public function forum()
    {
        return $this->belongsTo('App\Models\Forum');
    }
}


Feb
16
2 months ago
Activity icon

Started a new Conversation Connection Could Not Be Established With Host Mail.domain.com

I am getting this error while trying to send email.

production.ERROR: Connection could not be established with host mail.mydomain.com :stream_socket_client(): unable to connect to tcp://mail.mydomain.com:465 (Connection timed out)

These are my email settings:

MAIL_MAILER=smtp
MAIL_HOST=mail.mydomain.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=SSL
[email protected]
MAIL_FROM_NAME="${APP_NAME}"

Any help please?

Feb
03
3 months ago
Activity icon

Started a new Conversation Sending Emails Not Working And No Error Is Being Thrown Laravel.

I had hosted a laravel site on a host and emails were sent successfully but when I changed the host, the emails stopped working. So when I send an email it doesn't go through and there is no error that I receive. How can I go around this, please? config/mail.php:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Mail Driver
    |--------------------------------------------------------------------------
    |
    | Laravel supports both SMTP and PHP's "mail" function as drivers for the
    | sending of e-mail. You may specify which one you're using throughout
    | your application here. By default, Laravel is setup for SMTP mail.
    |
    | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
    |            "sparkpost", "log", "array"
    |
    */

    'driver' => env('MAIL_DRIVER', 'smtp'),
    

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Address
    |--------------------------------------------------------------------------
    |
    | Here you may provide the host address of the SMTP server used by your
    | applications. A default option is provided that is compatible with
    | the Mailgun mail article which will provide reliable deliveries.
    |
    */

    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
  

    /*
    |--------------------------------------------------------------------------
    | SMTP Host Port
    |--------------------------------------------------------------------------
    |
    | This is the SMTP port used by your application to deliver e-mails to
    | user of the application. Like the host we have set this value to
    | stay compatible with the Mailgun e-mail application by default.
    |
    */

    'port' => env('MAIL_PORT', 587),

    /*
    |--------------------------------------------------------------------------
    | Global "From" Address
    |--------------------------------------------------------------------------
    |
    | You may wish for all e-mails sent by your application to be sent from
    | the same address. Here, you may specify a name and address that is
    | used globally for all e-mails that are sent by your application.
    |
    */

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Example'),
    ],

    /*
    |--------------------------------------------------------------------------
    | E-Mail Encryption Protocol
    |--------------------------------------------------------------------------
    |
    | Here you may specify the encryption protocol that should be used when
    | the application send e-mail messages. A sensible default using the
    | transport layer security protocol should provide great security.
    |
    */

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

    /*
    |--------------------------------------------------------------------------
    | SMTP Server Username
    |--------------------------------------------------------------------------
    |
    | If your SMTP server requires a username for authentication, you should
    | set it here. This will get used to authenticate with your server on
    | connection. You may also set the "password" value below this one.
    |
    */

    'username' => env('MAIL_USERNAME'),

    'password' => env('MAIL_PASSWORD'),

    /*
    |--------------------------------------------------------------------------
    | Sendmail System Path
    |--------------------------------------------------------------------------
    |
    | When using the "sendmail" driver to send e-mails, we will need to know
    | the path to where Sendmail lives on this server. A default path has
    | been provided here, which will work well on most of your systems.
    |
    */

    'sendmail' => '/usr/sbin/sendmail -bs',

    /*
    |--------------------------------------------------------------------------
    | Markdown Mail Settings
    |--------------------------------------------------------------------------
    |
    | If you are using Markdown based email rendering, you may configure your
    | theme and component paths here, allowing you to customize the design
    | of the emails. Or, you may simply stick with the Laravel defaults!
    |
    */

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

];


Jan
22
3 months ago
Activity icon

Started a new Conversation Cannot Use Object Of Type StdClass As Array

I serialize data before saving it to the database. Later, I fetch this serialized object, unserialize it, and then loop through to get one object then pass it to another method. Now, the script works on two domains. The code is the same. On one domain it is working well but on the other domain, it throws the error above when I call another method and pass there that object. What could be wrong?


     $bahisler = unserialize($kupon->maclar);//maclar is a serialized object , example below, when it is 			 
      //unserialized, an standard object is returned.
            $tutanlar = 0;
            $yatanlar = 0;
            $bekleyenler = 0;
            $iptaller = 0;

            $toplamOran = 1;

            foreach ($bahisler as &$bahis) {
                if (isset($bahis->kontrol_etme)) {
                    if ($bahis->durum == 2) {
                        $bahis = $this->bahisSonuclandir($bahis);
                    }
                } else {
                    $bahis = $this->bahisSonuclandir($bahis);//The error is thrown on this line
                }

maclar:


a:1:{i:0;O:8:"stdClass":5:{s:3:"mac";O:8:"stdClass":23:{s:11:"betradar_id";s:8:"23135983";s:5:"timer";O:8:"stdClass":8:{s:7:"running";s:1:"1";s:7:"elapsed";s:4:"5108";s:8:"duration";s:2:"90";s:12:"period_short";s:2:"2Y";s:9:"period_id";s:2:"2H";s:11:"period_long";s:8:"2. Yarı";s:10:"period_idx";s:1:"3";s:11:"last_update";s:13:"1611347982570";}s:11:"category_id";s:5:"14855";s:14:"expires_offset";s:4:"3600";s:10:"score_type";s:15:"SOCCER/STANDARD";s:8:"label_de";s:21:"Lierse - Brügge Res.";s:11:"live_status";s:4:"open";s:5:"score";O:8:"stdClass":4:{s:5:"score";a:2:{i:0;s:1:"3";i:1;s:1:"0";}s:9:"score_str";s:5:"3 : 0";s:7:"periods";O:8:"stdClass":2:{s:2:"2H";a:2:{i:0;s:1:"1";i:1;s:1:"0";}s:2:"1H";a:2:{i:0;s:1:"2";i:1;s:1:"0";}}s:10:"score_type";s:15:"SOCCER/STANDARD";}s:4:"date";s:11:"Cuma, 22.01";s:15:"event_code_live";s:2:"6F";s:9:"odds_line";s:1:"0";s:7:"expires";s:5:"20:00";s:8:"label_en";s:20:"Lierse - Brugge Res.";s:5:"cards";O:8:"stdClass":2:{s:6:"yellow";a:2:{i:0;s:1:"0";i:1;s:1:"1";}s:3:"red";a:2:{i:0;s:1:"0";i:1;s:1:"0";}}s:7:"markets";a:28:{i:0;s:8:"47648202";i:1;s:8:"47648195";i:2;s:8:"47648196";i:3;s:8:"47648200";i:4;s:8:"47648199";i:5;s:8:"47648201";i:6;s:8:"47648197";i:7;s:8:"47648190";i:8;s:8:"47648192";i:9;s:8:"47648203";i:10;s:8:"47762392";i:11;s:8:"47762394";i:12;s:8:"47648191";i:13;s:8:"47762398";i:14;s:8:"47762400";i:15;s:8:"47762401";i:16;s:8:"47762404";i:17;s:8:"47762405";i:18;s:8:"47762892";i:19;s:8:"47762893";i:20;s:8:"47762894";i:21;s:8:"47763661";i:22;s:8:"47763664";i:23;s:8:"47764290";i:24;s:8:"47764291";i:25;s:8:"47660333";i:26;s:8:"47764293";i:27;s:8:"47764294";}s:10:"expires_ts";s:10:"1611342000";s:5:"label";s:20:"Lierse - Brugge Res.";s:10:"event_code";s:7:"1568CDF";s:3:"key";s:7:"3350988";s:3:"gun";s:4:"Cuma";s:4:"saat";s:5:"22.01";s:9:"home_name";s:6:"Lierse";s:9:"away_name";s:11:"Brugge Res.";}s:6:"market";O:8:"stdClass":14:{s:23:"live_minimum_selections";s:1:"1";s:6:"period";s:1:"1";s:11:"label_short";N;s:14:"trading_status";s:7:"Unknown";s:5:"label";s:12:"Üstü/Altı";s:11:"predictions";a:2:{i:0;s:9:"140881829";i:1;s:9:"140881828";}s:11:"period_type";s:1:"1";s:10:"type_label";s:12:"Üstü/Altı";s:18:"minimum_selections";s:1:"1";s:8:"event_id";s:7:"3350988";s:6:"detail";N;s:11:"live_status";s:4:"open";s:4:"type";s:10:"OVER_UNDER";s:13:"special_value";s:3:"3.5";}s:4:"oran";O:8:"stdClass":5:{s:4:"type";s:4:"OVER";s:4:"odds";s:4:"3.00";s:11:"label_short";s:1:"+";s:5:"label";s:6:"Üstü";s:9:"market_id";s:8:"47648195";}s:4:"live";b:1;s:5:"durum";i:2;}}

Activity icon

Started a new Conversation Method Illuminate\Notifications\DatabaseNotificationCollection::orWhere Does Not Exist.

I am trying to fetch notifications from the database using various conditions and so I am using orWhere clause but it is giving the above error. What am I doing wrongly?


$notifications = auth()->user()->notifications->where('type', "App\Notifications\NewAppeal")
       ->orWhere('type', "App\Notifications\BloodAppealNotification")
       ->orWhere('type', "App\Notifications\LowBlood")->where('read_at', null)->all();

Dec
15
4 months ago
Activity icon

Started a new Conversation POST Requests Works When Using POSTMAN But Returns 401 (UnAuthorized) When Using Axios

When I send a POST request to a login route: /api/auth/login with the postman, I get back the token, but when I do the same using Axios in my Vue component, it returns error 401. What Am I doing wrong?

Error Error: Request failed with status code 401

import { mapActions, mapGetters } from "vuex";
export default {
    data: {
        email: "",
        password: ""
    },

    methods: {
        sendFormData(e) {
            e.preventDefault();
            let email = this.email;
            let password = this.password;
            return this.loginUser({ email, password });
        },
        ...mapActions({
            loginUser: "loginUser"
        })
    },
    mounted() {
        console.log("Component mounted.");
    }
};
    loginUser({ commit }, data) {
        console.log(data);

        axios
            .post("/api/auth/login", {
                data
            })
            .then(response => {
                console.log(response.data);
            })
            .catch(error => {
                console.log(error);
            });
    },

Dec
10
5 months ago
Activity icon

Started a new Conversation Failed To Execute 'setItem' On 'Storage': Setting The Value Of '136114546' Exceeded The Quota Vue

I am using Vue on the frontend of my Laravel application, the application is running really well on my local machine without any errors but on the server, there are some issues like click events not setting items. When I check the console, however, I get this error: Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of '136114546' exceeded the quota. I found this Related Question where the answer is storage being full but I noticed that this error happens when someone is using chrome browser. Other browsers work quite well.

This is the code that causes that error:

canliDegisim() {
            $.each(app.canliData.predictions, function(index, pre) {
                if (window.localStorage.getItem(index)) {
                    var eski = parseFloat(window.localStorage.getItem(index));
                    var yeni = parseFloat(pre.odds);
                    if (eski < yeni) pre.degisim = "artan";
                    if (eski > yeni) pre.degisim = "azalan";
                    if (eski === yeni) pre.degisim = "sabit";
                }
                console.log(pre.odds.toString());
                window.localStorage.removeItem(index);
                window.localStorage.setItem(index, pre.odds.toString());
            });
        },
Dec
01
5 months ago
Activity icon

Replied to Failed To Execute 'setItem' On 'Storage': Setting The Value Of '136114546' Exceeded The Quota.

Because I am using the same browser. It is working so well on the local server using the same browser but when I upload the app to the server then look at the console, that is when I get that error

Activity icon

Replied to Failed To Execute 'setItem' On 'Storage': Setting The Value Of '136114546' Exceeded The Quota.

Can it work on the local server without that error and it causes that error on the server app when the problem is the browser?

Nov
30
5 months ago
Activity icon

Started a new Conversation Failed To Execute 'setItem' On 'Storage': Setting The Value Of '136114546' Exceeded The Quota.

I am using Vue on the frontend of my application, the application is running really well on my local machine without any errors but on the server, there are some issues like clicking events not setting items. When I check the console, however, I get this error: Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of '136114546' exceeded the quota.

What could be the solution to this kind of error? Since it is working well on my local server, could the problem be with the server?

Nov
16
5 months ago
Activity icon

Replied to Is There A Way I Can Access Authenticated User Information In An API Route In Laravel?

trx_id has nothing to do with the current logged in user. But I need to return response with the user balance, meaning I have to access the logged-in user information.

Activity icon

Started a new Conversation Is There A Way I Can Access Authenticated User Information In An API Route In Laravel?

I have a callback URL(mywebsite.com/final/results), which is a POST route, like:

Route::post('final/results','[email protected]')

On this route, I am waiting for data that comes like

{"trx_id":"12","session":2,"method":"do","retry":true,"minus":20,"sign":"rthrtghert", "plus":0}

When the data comes, it is handled by the someMethod on FinalResultsController Now I need to get the logged-in information so that I can be able to update the user with the information. The problem is however that when I try to get the authenticated user through auth('api')->user(). it returns null. Is there any other way I can get the logged-in user information from the API route?

My project's Laravel version is 6.

Activity icon

Started a new Conversation How Do I Extract An Id From A Dynamically Generated URL?

I dynamically generate URLs based on the current session. Example below. How do I extract the language_code, device_id, and session_id for example? Then the URL is not my website's URL. I just generate it dynamically in one of my controllers.

 https://<host>?l=<LANGUAGE_CODE>&d=<DEVICE_ID>&s=<SESSION_ID>

Nov
13
5 months ago
Activity icon

Started a new Conversation How Do I Get The Logged In User Details Through Auth()->user() In A Post Route Where VerifyCrsfToken Is Disabled?

I have a route where I receive data from an API through POST and when VerifyCSRFToken is enabled on this route, it returns page expired error and data can't be received. So the solution to this was to disable the VerifyCsrfToken middleware of this route. However, when this middleware is disabled on this route, I can't access the logged-in user through auth()->user(), which I really need. This returns an empty array. So, my question is: how can I get the logged-in user in a route where VerifyCsrfToken middleware is disabled, or in case I change that route to API route, how will I be able to access the logged-in user?

Thank you in advance!