manshu

Member Since 3 Years Ago

Vienna, VA

at Freelance

Experience Points 108,705
Experience Level 22

1,295 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 1085
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

15 Jun
3 days ago

manshu left a reply on Cities And States SQL Query

@richardev Nope. My Hype is still strong, because this is for US only. I uploaded SQL query, for quick database structure.

manshu started a new conversation Cities And States SQL Query

It took me few hours, but finally got everything down. Here's my contribution, if any one is looking for Cities and States as SQL Dump. Just plug and play.

https://gist.github.com/manshu/1ad167e1aad0152e0311e99ad4f07a3b

manshu left a reply on VueJS File Upload, Not Working

Thanks guys, I was able to use base/64 image and converted it to get my solution. If anyone is interested, i can upload the code.

12 Jun
6 days ago

manshu left a reply on VueJS File Upload, Not Working

it's not working. It submits the form, once the image is uploaded. Backend validation error, and form is not captured fully. Tried both ways.

manshu left a reply on VueJS File Upload, Not Working

My file key name is imageUrl. How do i capture that on the reader? I am confused about that.

manshu left a reply on VueJS File Upload, Not Working

@KANE - You're right. Lol !! im still struggling to find an answer. I think im almost there.

manshu left a reply on VueJS File Upload, Not Working

@MUNAZZIL - Your code isn't right. Image uploading on Vuejs is different. https://www.youtube.com/watch?v=VqnJwh6E9ak this might make u understand a little bit.

manshu left a reply on VueJS File Upload, Not Working

@MUNAZZIL - Are u new to VueJS ?

manshu left a reply on VueJS File Upload, Not Working

@MUNAZZIL - ``` submitListing() { const config = { headers: { "content-type": "multipart/form-data" } };

  let formData = new FormData();
  formData.append("imageUrl", this.form.imageUrl.data, config);
  axios.post("/listings", this.form, formData).then(response => {
    console.log(response.data);
  });
},
onFileChanged(event) {
  let selectedFile = event.target.files[0];
  this.form.imageUrl = selectedFile;
}

manshu left a reply on VueJS File Upload, Not Working

@MUNAZZIL - Nope, that's not the issue. Issue is, with sending image with the form. I have tried many ways, it sends an object of imageUrl instead of image data. So validation in laravel is seeing the "ImageUrl" property as null.

manshu left a reply on VueJS File Upload, Not Working

Please check the code. It's already there

manshu started a new conversation VueJS File Upload, Not Working

Here is my Vue Component and im having trouble upload image. Any idea why it's not taking image? I am able to submit the form, but having issue submitting image.

<template>
  <div class="container mx-auto py-10">
    <form @submit.prevent="submitListing">
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-company-name"
        >Company Name</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-company-name"
          type="text"
          placeholder="Company Name"
          required
          v-model="form.name"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-email"
        >Email</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-email"
          type="text"
          required
          v-model="form.email"
          placeholder="Company Email"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-website"
        >Your Website</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-website"
          type="text"
          required
          v-model="form.website"
          placeholder="Company Website"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-phone"
        >Company Phone</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-tollfreephone"
          type="text"
          required
          v-model="form.tollfree_phone"
          placeholder="Company Toll Free Phone"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-phone"
        >Company Local Phone</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-localphone"
          type="text"
          required
          v-model="form.local_phone"
          placeholder="Company Local Phone"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-phone"
        >Address</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-address"
          type="text"
          required
          v-model="form.address_1"
          placeholder="Company Address"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-phone"
        >Address 2</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-phone"
          type="text"
          required
          v-model="form.address_2"
          placeholder="Suite 200"
        >
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-phone"
        >Address 2</label>
        <textarea
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          placeholder="Company Details"
          v-model="form.description"
          rows="6"
        ></textarea>
      </div>
      <div class="flex flex-wrap mb-2">
        <div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
          <label
            class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
            for="grid-state"
          >State</label>
          <div class="relative">
            <select
              class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
              id="grid-state"
              required
              v-model="form.state_id"
              @change="getCities($event.target.value)"
            >
              <option selected>Select one</option>
              <option v-for="state in states" :key="state.id" :value="state.id">{{ state.name }}</option>
            </select>
            <div
              class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
            >
              <svg
                class="fill-current h-4 w-4"
                xmlns="http://www.w3.org/2000/svg"
                viewBox="0 0 20 20"
              >
                <path
                  d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
                ></path>
              </svg>
            </div>
          </div>
        </div>
        <div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
          <label
            class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
            for="grid-state"
          >City</label>
          <div class="relative">
            <select
              class="block appearance-none w-full bg-gray-200 border border-gray-200 text-gray-700 py-3 px-4 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
              id="grid-state"
              required
              v-model="form.city_id"
            >
              <option selected>Select one</option>
              <option v-for="city in cities" :key="city.id" :value="city.id">{{ city.name }}</option>
            </select>
            <div
              class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"
            >
              <svg
                class="fill-current h-4 w-4"
                xmlns="http://www.w3.org/2000/svg"
                viewBox="0 0 20 20"
              >
                <path
                  d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"
                ></path>
              </svg>
            </div>
          </div>
        </div>
        <div class="w-full md:w-1/3 px-3 mb-6 md:mb-0">
          <label
            class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2"
            for="grid-zip"
            required
          >Zip</label>
          <input
            class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
            id="grid-zip"
            type="text"
            v-model="form.zip"
            placeholder="90210"
          >
        </div>
      </div>
      <div class="w-full px-3">
        <label
          class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2 mt-2"
          for="grid-phone"
        >Company Image</label>
        <input
          class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
          id="grid-phone"
          type="file"
          accept="image/*"
          @change="onFileChanged"
          placeholder="Company Local Phone"
        >
      </div>
      <div class="w-full px-3 mt-4">
        <div class>
          <button class="btn btn-raisin-light" type="submit">Sign Up</button>
        </div>
      </div>
    </form>
  </div>
</template>

<script>
import axios from "axios";
export default {
  components: {},
  data() {
    return {
      selectedCountry: "",
      states: [],
      cities: {},
      form: {
        name: "",
        description: "",
        email: "",
        website: "",
        tollfree_phone: "",
        local_phone: "",
        address_1: "",
        address_2: "",
        state_id: "",
        city_id: "",
        zip: "",
        imageUrl: null
      }
    };
  },
  created() {
    axios.get("/api/users/states").then(response => {
      this.states = response.data;
    });
  },
  methods: {
    getCities(state) {
      axios.get("/api/users/cities/" + state).then(response => {
        this.cities = response.data;
      });
    },
    submitListing() {
      const config = {
        headers: { "content-type": "multipart/form-data" }
      };

      let formData = new FormData();
      formData.append("imageUrl", this.form.imageUrl.data, config);
      axios.post("/listings", this.form, formData).then(response => {
        console.log(response.data);
      });
    },
    onFileChanged(event) {
      let selectedFile = event.target.files[0];
      this.form.imageUrl = selectedFile;
    }
  }
};
</script>

<style>
</style>
09 Jun
1 week ago

manshu left a reply on Trying To Get Values From The Collection

@SNAPEY - Done. Thanks a lot. I've been working on this for a little while. I'll come back, if more help is required. You've been awesome.

manshu left a reply on Trying To Get Values From The Collection

@SNAPEY - So i tried to see why it was running null. I had no listing on that city. Dummy me !! fixed it. Thanks.

Can u also help me solve this one. I had same issue with this.

 $state = State::where('name', '=', $state)->first();
        $listings = Listing::where('state_id', $state['id'])->latest()->take(3)->get();
        $page = Page::where('state_id', $state['id'])->first();
        return view('frontend.states.show', compact('listings', 'state', 'page'));

manshu left a reply on Trying To Get Values From The Collection

Haha, just as i thought.

"Trying to get property 'id' of non-object"

manshu left a reply on Trying To Get Values From The Collection

Here are my models routes and query

Schema::create('cities', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('state_id');
            $table->string('name');
            $table->timestamps();
        });
Schema::create('states', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('code');
            $table->timestamps();
        });
    Route::get('/{state}/{city}', 'Cities\Controllers\[email protected]');
 public function show(State $state, City $city)
    {
        $listings = Listing::with('city', 'state')->where('state_id', json_decode($state->id))->where('city_id', json_decode($city->id))->get();
        return view('frontend.cities.show')->with(['listings' => $listings, 'city' => $city, 'state' => $state]);
    }

manshu left a reply on Trying To Get Values From The Collection

@SNAPEY - I am not sure, but i was having issue decoding the data. It kept giving me property of 'id' not defined on collection.

manshu left a reply on Trying To Get Values From The Collection

here is how i solved this.

    public function show(State $state, City $city)
    {
        $listings = Listing::with('city', 'state')->where('state_id', json_decode($state->id))->where('city_id', json_decode($city->id))->get();
        return view('frontend.cities.show')->with(['listings' => $listings, 'city' => $city, 'state' => $state]);
    }

manshu left a reply on Trying To Get Values From The Collection

I'd rather use names instead of Id's because the of the URI

manshu left a reply on Trying To Get Values From The Collection

`` ` "Property [city] does not exist on this collection instance. ```

Problem is, that $state holds the name of the State, and $city holds the name of city, and on Listing model, it's just id. so it's not working. I tried that.

manshu started a new conversation Trying To Get Values From The Collection

I am trying to create a query, but having issue. I have Listing that has 2 columns city_id and state_id. I am trying to get result where city_it = city.id model and similar for state.

my route = https://example.com/{state}/{city}/

So if user tries to access some city, they will see all listings for that state. Please help. Thanks

        $state = State::where('name', $state)->get();
        $city = City::where('name', $city)->get();
        $listings = Listing::where(function ($query) use ($state, $city) {
            $query->where('city_id', $city)->get();
            $query->where('state_id', $state)->get();
        });
        return $listings;
01 May
1 month ago
26 Mar
2 months ago

manshu left a reply on Third Party API Series

Yes please, i'd like to learn more about this too.

27 Dec
5 months ago

manshu left a reply on Admin Dashboard

Admin LTE is free. Search google for it.

04 Oct
8 months ago

manshu started a new conversation Collaborate With Other Devs To Create New Project

I work full time, and have spare time on weekends, and would love to start a new project or app for a long term. Looking for few people to join on slack, and develop something for fun.

14 Sep
9 months ago

manshu left a reply on TailwindCSS Custom Navbar

@nhayder Feel free to submit a PR.

25 Aug
9 months ago

manshu left a reply on Vue Object Reactivity On Array

Can you share your code please ?

manshu started a new conversation TailwindCSS Custom Navbar

After spending few hours, i've figured out a nice way to design navbar with different screen sizes.

https://jsfiddle.net/manshu/x5darust/

Feel free to use it in your project. I am still learning front end, so it's little exciting.

02 Jun
1 year ago

manshu left a reply on Registering Service Provider

Actually, as far as i can remember, laravel only bootstraps the SP's. According to @TaylorOtwell these bindings stay inside the storage/app folder.

manshu left a reply on Package Development Laracast For Laravel 5?

There are many resources to learn how to develop packages. You do have to have basic understanding of how everything works. Here is something simple from youtube. https://www.youtube.com/watch?v=SLeY-2IPEXk&list=PLkZU2rKh1mT_UmFeEqZiJep_vrFwLyR07

And then watch this one on Laracasts. https://laracasts.com/discuss/channels/laravel/russian-doll-caching

20 May
1 year ago

manshu left a reply on Which Laptop To Buy?

I use linux mint on my home PC and works like a charm for Dev Env.

manshu left a reply on Docker Series

I'd love to learn more. +1

manshu left a reply on Laravel Pagination Links Not Working

Paste ur controller/Model code here, so we can help you. Also do composer dump and php artisan cache clear, view clear

manshu left a reply on Laravel Eloquent Triple Table Relation

Have u tried MorphMany option using "able" option.

manshu left a reply on How To Display All Data Only Admin?

Why not make isAdmin() function on User model, and use it to grab admin user

manshu left a reply on Convenient Mobile Testing With Real Device

Have u tried browserSync ?

14 Feb
1 year ago

manshu left a reply on Weird PHP Testing Changes With Laravel 5.6.3

When i tried to use that, it gives me this error.

Error: Call to undefined method CreateCourseTest::assertSee()

manshu started a new conversation Weird PHP Testing Changes With Laravel 5.6.3

How's this test passing, when my index method /course has nothing inside it.

    /** @test */
    public function to_see_all_courses()
    {
        $courses = factory(Course::class, 2)->create();
        $this->get('course');
        $this->assertCount(2, $courses);
    }
06 Sep
1 year ago

manshu left a reply on Error While Testing PHPUnit.

Yup, unfortunately there is no help :( my project is still pending.

19 Aug
1 year ago

manshu left a reply on How I Truncate Words In My Blade Template

If anyone is lost, i used the following code

{{ post.body | truncate('400') }}
filters: {
            truncate(string, value){
                return string.substring(0, value) + '...';
            },
            formatDate(value){
                if (value) {
                    return moment((value)).fromNow();
                }
            }
        }
30 Jul
1 year ago
29 Jul
1 year ago

manshu left a reply on Error While Testing PHPUnit.

I am currently back down to 5.7 version. Tried updating to 6.* and everything broke.

manshu started a new conversation Error While Testing PHPUnit.

I have updated and then downgraded PHPUnit and it gives me following error. Can anyone help ?

PHP Fatal error:  Class 'PHPUnit_Framework_Constraint' not found in /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php on line 8
PHP Fatal error:  Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php:895
Stack trace:
#0 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
#1 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('Illuminate\\Cont...')
#2 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('Illuminate\\Cont...')
#3 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('Illuminate\\Cont...')
#4 /Users/man in /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895

Fatal error: Class 'PHPUnit_Framework_Constraint' not found in /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php on line 8

Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Illuminate\Contracts\Debug\ExceptionHandler] is not instantiable. in /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php:895
Stack trace:
#0 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php(735): Illuminate\Container\Container->notInstantiable('Illuminate\\Cont...')
#1 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('Illuminate\\Cont...')
#2 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('Illuminate\\Cont...')
#3 /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('Illuminate\\Cont...')
#4 /Users/man in /Users/username/Documents/Code/projects/thinkpmp/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 895

30 Jun
1 year ago

manshu left a reply on How Do I Check Correct Answer For This ?

It's still not sending the full data back to the server. Any idea how to get full data ?

manshu left a reply on How Do I Check Correct Answer For This ?

okay that works. What do you recommend about checking the correct answer client side or server side ?

manshu left a reply on How Do I Check Correct Answer For This ?

Also im able to select all the radio buttons, instead of single one.