danyal14

danyal14

Member Since 1 Year Ago

Experience Points
8,260
Total
Experience

1,740 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
54
Lessons
Completed
Best Reply Awards
1
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.

Level 2
8,260 XP
Apr
22
2 months ago
Activity icon

Started a new Conversation Heigh CPU Usage

We are running Lumen 5.7 api services on AWS with lot of traffic.

Endpoint saves the user input in database, and that triggers 100% CPU usage.

Event though when I ran ab on index endpoint with no database interaction it get peek in CPU.

Both endpoint with database or without database has same CPU consumption.

Has anyone experienced this sort of issue?

Apr
04
3 months ago
Activity icon

Awarded Best Reply on Accessing FormRequest Values During Testing

You need to write HTTP tests, and Laravel well documented this with examples. https://laravel.com/docs/5.7/http-tests

Mar
09
3 months ago
Activity icon

Replied to Laravel Blade And VUE Form Consuming API

Post endpoint is stored in api.php and application routes are stored in web.php And therefore api requires the authentication, that I understand. And I think in that case I might need to pass api_token.

Create.blade.php

@section('content')

    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-4 col-lg-3 pr-md-2">
                <div class="list-group">
                    <a href="#" class="list-group-item list-group-item-action"><li class="fas fa-user"></li> My Profile</a>
                    <a href="#" class="list-group-item list-group-item-action"><li class="fas fa-tags"></li> My Posts</a>
                    <a href="#" class="list-group-item list-group-item-action"><li class="fas fa-star"></li> Favourites</a>
                    <a href="#" class="list-group-item list-group-item-action"><li class="fas fa-comment"></li> Messages</a>
                </div>
            </div>
            <div class="col-md-8 col-lg-9 pl-md-0 mt-2 mt-md-0">

                <div>
                    <example-component />
                </div>

            </div>
        </div>
    </div>
@endsection

Vue

<template>
  <div class="container" v-if="!loading">
    <div class="card p-4">
      <h2>Post</h2>
      <fieldset id="fieldset_create">
        <div class="form-row">
          <div class="form-group col-md-12 form-group-txt_name">
            <label for="txt_name">Title</label>
            <input
              type="text"
              class="form-control"
              v-model="post.name"
              placeholder="enter post title"
            />
          </div>
          <div class="form-group col-md-12">
            <label for="txt_description">Description</label>
            <textarea
              class="form-control"
              v-model="post.description"
              placeholder="enter post details"
            ></textarea>
          </div>
          <div class="form-group col-md-12">
            <label for="dd_categories">Category</label>
            <select
              class="form-control"
              v-model="post.category"
              @change="selectCategory($event)"
            >
              <option selected>Select category</option>
              <option
                v-for="category in categories"
                :key="category.id"
                :value="category.id"
                >{{ category.name }}</option
              >
            </select>
          </div>
          <div class="form-group col-md-12" v-if="brands">
            <label for="dd_brands">Brand</label>
            <select
              class="form-control"
              v-model="post.brand"
              @change="selectBrand($event)"
            >
              <option>Select brand</option>
              <option
                v-for="brand in brands"
                :key="brand.id"
                :value="brand.id"
                >{{ brand.name }}</option
              >
            </select>
          </div>
          <div class="form-group col-md-12">
            <label for="dd_models">Model</label>
            <select class="form-control" v-model="post.model">
              <option>Select model</option>
              <option
                v-for="model in models"
                :key="model.id"
                :value="model.id"
                >{{ model.name }}</option
              >
            </select>
          </div>

          <div class="form-group col-md-12">
            <label for="files">Picture</label>
            <input
              type="file"
              @change="onFileChange"
              class="form-control"
            />
          </div>
        </div>
        <button @click="save" class="btn btn-primary">
          Save your Post
        </button>
        <button
          class="btn btn-dark"
          disabled
          style="display: none;"
        >
          <span
            class="spinner-border spinner-border-sm"
            role="status"
            aria-hidden="true"
          ></span>
          Saving Post ...
        </button>
      </fieldset>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  name: "CreateForm",
  components: {},
  data: function() {
    return {
      loading: true,
      categories: null,
      brands: null,
      models: null,
      post: {
        category: 18,
        name: "iPhone 8",
        description: "Selling my iphone because got newone",
        brand: 2,
        model: 8,
        files: []
      }
    };
  },
  mounted() {
    console.log("Component mounted.");
  },
  created() {
    this.loadCategories();
  },
  methods: {
    doSave() {
      Promise.all([this.$store.dispatch("savePost", this.post)])
        .then(responses => {
          this.models = responses[0].data;
          this.loading = false;
        })
        .catch(error => {
          this.errormsg = error;
        })
        .finally(function() {
          this.loading = false;
        });
    },
    save() {
      this.doSave();
    },
    selectCategory(event) {
      this.loadBrandsForSelectedCategory(event.target.value);
    },
    selectBrand(event) {
      this.loadModelForSelectedBrand(event.target.value);
    }
  }
};
</script>
Activity icon

Started a new Conversation Laravel Blade And VUE Form Consuming API

Hi Guys,

I am testing a laravel project with VUE form in blade.

User is login session based via Laravel Auth. Once he is login, and want to add new post, that post form is in VUE and that where I make POST api call and gets 401.

I know that I might need to pass api_token that user, am I right?

Feb
10
4 months ago
Activity icon

Replied to Reset Data Then Redirecting To Same Page After Saving Data

Thanks, your are right I necessary don't have to redirect :)

Activity icon

Started a new Conversation Reset Data Then Redirecting To Same Page After Saving Data

Hi Guys,

I have a form, when I save data and redirect to the same page to add more v-model/participant still holds the old values. Where I expect it to be clear. Any hint?

<script>
import { mapGetters } from 'vuex'

export default {
  name: "AppC",
  components: {Loading},
  data: function() {
    return {
      participant: {
        first_name: null,
        last_name: null,
        email: null,
        mobile: null,
        group_id: null,
        status: null,
        event_id: null
      }
    };
  },
  created() {
    this.loadAppEvent();
  },
  methods: {
    save() {
      this.loading = true;
      if (this.validation()) {
        this.loading = false;
        return;
      }
      this.participant.event_id = this.$route.params.id;
      this.$store.dispatch("createAppParticipant", this.participant).then(response => {
        if (response.status == 401) {
          this.$router.push('/');
        }
        if (response.status == 422) {
          this.error = true;
          this.errorMessage = "Something went wrong, try again.";
          this.loading = false;
        }
        if (response.status == 201) {
          this.loading = false;
          if (this.$route.query.client_id) {
            this.$router.push({
              name: 'admin-clientDashboard',
              params: { id: this.$route.query.client_id }
            });
          } else {
            this.$router.push({name: 'app-client-event-participants', params: { id: this.$route.params.id }});
          }
        }
      });
    }
  },
  computed: {
      ...mapGetters([
          'event'
      ]),
  }
};
</script>