SimonAngatia

Member Since 5 Months Ago

Experience Points
3,380
Total
Experience

1,620 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
3,380 XP
Jan
22
3 days 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
1 month 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
1 month 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
1 month 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
1 month 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
2 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
2 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!

Nov
08
2 months ago
Activity icon

Replied to How Do I Change The Mail Sender Name Using Swift Mailer In Laravel?

That is the configuration I am having in mail.php file but it is still sending emails with non-reply username


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

Activity icon

Started a new Conversation How Do I Change The Mail Sender Name Using Swift Mailer In Laravel?

I am sending emails from my application using the following configurations:

{"name":"smtp","host":"mail.mydomain.com","port":"587","enc":"tls","username":"[email protected]","password":"mypassword","driver":"smtp"}

with these details, the emails are sent with the sender's name as noreply How do I set it in a way that instead of sending with noreply it will send with theSenderNameIWant? I am using swift mailer.

Nov
06
2 months ago
Activity icon

Started a new Conversation How Do You Join Multiple Tables In Laravel?

I have three tables: table1, table2,table3. Each table has columns won and lost, so I want to select those columns from table1 join with the same columns in table2 and again join the same columns from table3. How do I achieve this using joins?

Nov
03
2 months ago
Activity icon

Replied to How Do I Get Only Some Users On The Database Based On Their Ranks With Eloquent?

User doesn't have more than one rank, can only have one rank

Activity icon

Replied to How Do I Get Only Some Users On The Database Based On Their Ranks With Eloquent?

It is one table, I just used rank as example. It can be any other column with different values

Activity icon

Replied to How Do I Get Only Some Users On The Database Based On Their Ranks With Eloquent?

Just take it simple: You've table users, with column called ranks. Users have different ranks and you want to only get users with rank as admin and user . How do I do that?

Activity icon

Started a new Conversation How Do I Get Only Some Users On The Database Based On Their Ranks With Eloquent?

Lets say I have users table where users have different ranks, lets say admin, superadmin, user, how do I get only users with ranks as admin and user ?

Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items


import axios from "axios";
const state = {
    tags: [],
    tagmsg: ""
};

const getters = {
    tags: state => state.tags,
    tagmsg: state => state.tagmsg
};

const actions = {
    fetchTags({ commit }) {
        commit("setIsLoading", true);
        axios
            .get(`/api/admin/tags`)
            .then(response => {
                let tags = response.data;

                commit("setTags", tags);
                commit("setIsLoading", false);
            })
            .catch(error => console.log("We encountered an error:", error));
    },
    createTag({ commit }, name) {
        commit("setIsLoading", true);
        if (state.currentUser !== null) {
            axios
                .post(`/api/admin/tags/create`, {
                    name
                })
                .then(response => {
                    let current = response.data;
                    console.log(current);
                    commit("setTagMsg", "Tag Added Successfully");
                    commit("setIsLoading", false);
                })
                .catch(error => console.log("We encountered an error:", error));
        }
    }
};
const mutations = {
    setTagMsg: (state, tagmsg) => (state.tagmsg = tagmsg),
    setTags: (state, tags) => (state.tags = tags)
};

export default {
    state,
    getters,
    actions,
    mutations
};


Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items

You're right. I removed and now the data is not being consoled logged

Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items

I noticed it initially console logs tags and categories as an empty objects, before doing the second logging, his time with data. Can that lead to a solution?

[__ob__: Observer]
VM6601 app.js:2399 [__ob__: Observer]
Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items

<pre>{{ tags }}</pre>

That returns an empty array

Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items

With this(async), the data is still logged in the console still but not displaying on the webpage

Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items

That is the whole component even the categories don't show anything

Activity icon

Replied to Looping Through Items In Vue Doesn't Display The Items


<template>
    <section class="ftco-section bg-light">
        <div class="container">
            <div class="col-md-12 ftco-animate  mb-5 mt-5">
                <h1 class="mb-3 bread">Write in our Forum</h1>
            </div>
            <div class="row">
                <div class="col-md-12 col-lg-8 mb-5">
                    <form>
                        <div class="row form-group">
                            <div class="col-md-12 mb-3 mb-md-0">
                                <label class="font-weight-bold" for="title"
                                    >Post Title</label
                                >
                                <input
                                    type="text"
                                    v-model="title"
                                    class="form-control"
                                    placeholder="eg. Professional UI/UX Designer"
                                />
                            </div>
                        </div>

                        <div class="row form-group mb-5">
                            <div class="col-md-12 mb-3 mb-md-0">
                                <label class="font-weight-bold" for="fullname"
                                    >Post Short Description</label
                                >
                                <input
                                    type="text"
                                    v-model="shortDescription"
                                    class="form-control"
                                    placeholder="eg. The summary of the post... Be brief :)"
                                />
                            </div>
                        </div>

                        <div v-if="categories">
                            <div class="row form-group mb-5">
                                <div class="col-md-12 mb-3 mb-md-0">
                                    <label
                                        class="font-weight-bold"
                                        for="fullname"
                                        >Post Category</label
                                    >
                                    <select
                                        class="form-control"
                                        v-model="categoryId"
                                    >
                                        <option
                                            v-for="category in categories"
                                            :key="category.id"
                                            :value="category.id"
                                            >{{ category.title }}</option
                                        >
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-12"><h3>Post Tags</h3></div>

                            <div
                                class="col-md-12 mb-3 mb-md-0"
                                v-for="tag in tags"
                                :key="tag.id"
                            >
                                <label for="option-job-type-1">
                                    <input
                                        type="radio"
                                        id="option-job-type-1"
                                        :value="tag.name"
                                    />
                                    {{ tag.name }}
                                </label>
                            </div>
                        </div>

                        <div class="row form-group mb-4">
                            <div class="col-md-12"><h3>Location</h3></div>
                            <div class="col-md-12 mb-3 mb-md-0">
                                <input
                                    type="text"
                                    class="form-control"
                                    name="location"
                                    placeholder="Western City, UK"
                                />
                            </div>
                        </div>
                        <input type="number" value="" name="user_id" hidden />
                        <div class="row form-group">
                            <div class="col-md-12 mb-3 mb-md-0">
                                <label for="option-price-1">
                                    Starting Salary
                                </label>
                                <input
                                    class="form-control"
                                    type="number"
                                    name="salary"
                                    id="option-price-1"
                                />
                            </div>
                        </div>

                        <div class="row form-group">
                            <div class="col-md-12">
                                <h3>Job Description</h3>
                            </div>
                            <div class="col-md-12 mb-3 mb-md-0">
                                <textarea
                                    name="description"
                                    class="form-control description"
                                    id=""
                                    cols="30"
                                    rows="5"
                                >
                                </textarea>
                            </div>
                        </div>

                        <div class="row form-group">
                            <div class="col-md-12">
                                <input
                                    type="submit"
                                    value="Post"
                                    class="btn btn-success  py-2 px-5"
                                />
                            </div>
                        </div>
                    </form>
                </div>

                <div class="col-lg-4">
                    <div class="p-4 mb-3 bg-white">
                        <h3 class="h5 text-black mb-3">Contact Info</h3>
                        <p class="mb-0 font-weight-bold">Address</p>
                        <p class="mb-4">
                            203 Fake St. Mountain View, San Francisco,
                            California, USA
                        </p>

                        <p class="mb-0 font-weight-bold">Phone</p>
                        <p class="mb-4"><a href="#">+1 232 3235 324</a></p>

                        <p class="mb-0 font-weight-bold">Email Address</p>
                        <p class="mb-0">
                            <a href="#"
                                ><span
                                    class="__cf_email__"
                                    data-cfemail="671e081215020a060e0b2703080a060e094904080a"
                                    >[email&#160;protected]</span
                                ></a
                            >
                        </p>
                    </div>

                    <div class="p-4 mb-3 bg-white">
                        <h3 class="h5 text-black mb-3">More Info</h3>
                        <p>
                            Lorem ipsum dolor sit amet, consectetur adipisicing
                            elit. Ipsa ad iure porro mollitia architecto hic
                            consequuntur. Distinctio nisi perferendis dolore,
                            ipsa consectetur
                        </p>
                        <p>
                            <a href="#" class="btn btn-primary  py-2 px-4"
                                >Learn More</a
                            >
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </section>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
export default {
    data() {
        return {
            title: "",
            description: "",
            shortDescription: "",
            categoryId: ""
        };
    },
    methods: {
        ...mapActions({
            fetchUser: "fetchUser",
            createCategory: "createCategory",
            fetchCategories: "fetchCategories",
            fetchTags: "fetchTags"
        }),

        sendFormData(e) {
            e.preventDefault();
            let title = this.title;
            let description = this.description;
            return this.createCategory({ title, description });
            this.title = "";
            this.description = "";
        }
    },
    computed: {
        ...mapGetters({
            isLoading: "isLoading",
            currentUser: "currentUser",
            categories: "categories",
            tags: "tags",
            message: "message"
        })
    },

    watch: {
        currentUser: function(newCU, oldCU) {},
        message: function(nv, ov) {},
        categories: function(nv, ov) {},
        tags: function(nv, ov) {}
    },

    mounted() {
        this.fetchUser();
        this.fetchCategories();
        this.fetchTags();
        console.log(this.categories);
        console.log(this.tags);
    }
};
</script>


Nov
02
2 months ago
Activity icon

Started a new Conversation Looping Through Items In Vue Doesn't Display The Items

I am looping through items (tags) in vue but the items are not showing, even though no error is thrown. Below is my code:

  <div class="row form-group">
                            <div class="col-md-12"><h3>Post Tags</h3></div>

                            <div
                                class="col-md-12 mb-3 mb-md-0"
                                v-for="tag in tags"
                                :key="tag.id"
                            >
                                <label for="option-job-type-1">
                                    <input
                                        type="radio"
                                        id="option-job-type-1"
                                        :value="tag.name"
                                    />
                                    {{ tag.name }}
                                </label>
                            </div>
                        </div>

When I console log tags data, I get the data:

0:
created_at: (...)
id: 1
name: "Web Design"
updated_at: "2020-10-13T00:15:26.000000Z"
__ob__: Observer {value: {…}, dep: Dep, vmCount: 0}
get created_at: ƒ reactiveGetter()
set created_at: ƒ reactiveSetter(newVal)
get id: ƒ reactiveGetter()
set id: ƒ reactiveSetter(newVal)
get name: ƒ reactiveGetter()
set name: ƒ reactiveSetter(newVal)
get updated_at: ƒ reactiveGetter()
set updated_at: ƒ reactiveSetter(newVal)
__proto__: Object
1: {__ob__: Observer}
2: {__ob__: Observer}
3: {__ob__: Observer}
4: {__ob__: Observer}
5: {__ob__: Observer}
6: {__ob__: Observer}

What might I be doing wrong?

Oct
31
2 months ago
Activity icon

Replied to How Do I Start Cron Job On The Server?

So after running this, thats all?

Activity icon

Replied to How Do I Start Cron Job On The Server?

How can I do that if I am using c-panel, please? Centos 7

Activity icon

Replied to How Do I Start Cron Job On The Server?

No, I havent done that

Activity icon

Started a new Conversation How Do I Start Cron Job On The Server?

I have set up a cron job that calls a method on the controller every five minutes. However, it is not running. So I thought maybe there is a way of kicking off cron jobs after setting up application on the server. Any help?

$schedule->call('App\Http\Controllers\[email protected]')->everyFiveMinutes();
Oct
26
2 months ago
Activity icon

Replied to Model Returns Data But Neither Returns True Nor False Using If-else .

My bad, I wasn't returning a response. That is why it was empty! Thank you all for your concern and help

Oct
23
3 months ago
Activity icon

Started a new Conversation Model Returns Data But Neither Returns True Nor False Using If-else .

This is my code:

$lastReq = XpgReply::where('gameId', $data['GameId'])->where('roundId', $data['RoundId'])->where('sequence', $data['Sequence'])->first();

If I try to dd($lastReq) it returns data. However, if I try checking it with if-else statement, both rturns true.

Whether that row is found or not it returns true;

   
            if ($lastReq)
            {
               //Do something...
		//This code doesn't return true

            }
   
            if (!$lastReq)
            {
               //Do something...
		//This code doesn't return true also

            }

Please help me someone.

Oct
20
3 months ago
Activity icon

Started a new Conversation How Do I Retry A Laravel Transaction Using The Manual Method?

Well, Laravel DB transactions provide a retry method where failed transactions can be retried, That is automatic transactions:

\DB::transaction(function(){
  // do your queries
}, $tries = 3);

How can someone handle this when using the Manual method? I can't figure out. Like

DB::beginTransaction();


DB::rollBack();
//retry the transaction();

DB::commit();


Activity icon

Replied to LockWaitTimeoutException For Transaction Retry

How do you handle this when you are doing it manually?

Like

DB::beginTransaction();


//Retry incase of deadlock



DB::commit();

Activity icon

Replied to Model::decrement() And Model::increment() Not Working Efficiently

This issue was solved but then there is another issue related to it. That is when multiple request are sent, since a table is locked, there is a deadlock that arises. How do you handle this so that there will not be a deadlock?


Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction (SQL: insert into `xpg_transactions` (`user_id`, `request`, `type`, `operatorId`, `session`, `gameId`, `roundId`, `debitDetails`, `amount`, `sequence`, `casino_balance`, `updated_at`, `created_at`) values (75, {"Login":"XPGTEST66","OperatorId":2076,"Session":"","GameId":1,"RoundId":90923816,"Amount":437,"Sequence":1,"DebitDetails":"RO;23:5.00;153:257.00;148:160.00;9:15.00"}, debit, 2076, , 1, 90923816, RO;23:5.00;153:257.00;148:160.00;9:15.00, 437, 1, 101311.00, 2020-10-19 18:22:55, 2020-10-19 18:22:55))

Oct
19
3 months ago
Activity icon

Replied to How To Get Authenticated User In API Route

Well, let's say you are doing payment API integration, where after successful payment, the API sends data to your callback URL. Now of course you what to save that data under the user who did that transaction. So how do you get the user_id if the response data is sent through an API route? That's the situation I am in

Activity icon

Replied to How To Get Authenticated User In API Route

But even with web.php, when I try posting data, I get page expired error when I try to add the route in the exempted routes in VerifyAuthToken middleware, I again can't access the auth()->user() object.

Activity icon

Replied to How To Get Authenticated User In API Route

So there's no way I can get the logged in user's data?

Activity icon

Replied to How To Get Authenticated User In API Route

It is not an API. I receive data through post, and I have to save that data in the database. Now I am trying to get the logged in User through auth()->user() but that is returning null. The data comes through a request

Activity icon

Replied to How To Get Authenticated User In API Route

No. It is Laravel 6

Activity icon

Started a new Conversation How To Get Authenticated User In API Route

I am trying to access an authenticated user but it is returning an empty object.

The auth()->user() returns an empty object

I have tried someone's suggestion of creating the API route in the web.php file then use web auth middleware but when I send a request to that route, instead of it saving the data into the database, it returns the login page. How do I go about this?

Web API route:

Route::prefix('api')->middleware('auth')->group(function () {
 Route::post('v1/B2C/transaction/result', '[email protected]');
});

It returning the login page when I send a request through postman

Oct
14
3 months ago
Activity icon

Started a new Conversation How Do I Access My App Running On A Subdomain Without Exposing The Port?

I have a laravel application running on the main domain which is https://website.com and I have another node js app which is running on port 8080 on a subdomain like this: http://sub.website.com:8080/ how do I access the node js app without :8080? That is http://sub.website.com?

Oct
13
3 months ago
Activity icon

Replied to How Can You Speed Up Request Response Time In Laravel?

Alright. Let me look at it. Thanks

Activity icon

Started a new Conversation How Can You Speed Up Request Response Time In Laravel?

I am working on an API that expects the server to respond to it within 3 seconds, otherwise, the request will be canceled. Unfortunately, my script is taking more than 3 seconds to process the request when many requests are sent at the same time. That is why I am asking if there is any way I can make my script process requests faster?