fahaddsheikh

fahaddsheikh

Member Since 2 Years Ago

Experience Points 16,170
Experience Level 4

3,830 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 152
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

19 Jul
2 years ago

fahaddsheikh left a reply on NPM Webpack Not Found

@jasperstaats Um both the solutions didn't work. I just did npm install. I sort of am relying on the npm install to be the last resort since it takes a lot of time.

fahaddsheikh started a new conversation NPM Webpack Not Found

Hey Everyone,

While trying

npm run dev

I get the following

> @ dev C:\xampp\htdocs\hm
> npm run development

npm WARN invalid config loglevel="notice"

> @ development C:\xampp\htdocs\hm
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified.
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/webpack/bin/webpack.js ENOENT
    at notFoundError (C:\xampp\htdocs\hm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\xampp\htdocs\hm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\xampp\htdocs\hm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Zain\AppData\Roaming\npm-cache\_logs\2017-07-19T20_41_02_926Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Zain\AppData\Roaming\npm-cache\_logs\2017-07-19T20_41_03_026Z-debug.log

Also, While doing

 npm install --no-bin-links

I get the following

npm WARN registry Using stale data from https://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 114 packages in 467.392s

15 Jul
2 years ago

fahaddsheikh left a reply on URL In Create Method For Relationships

I kind off am trying to stick to the restful methods here so I have a dedicated controller for batches.

Route::resource('courses.batch', 'BatchControllerForCourses');

Can you tell me what can I do in this case? Also I would prefer if I dont create separate routes for each restful operation...

What I need is just an ID of the course available to the Batch Controller so I can use it within

14 Jul
2 years ago

fahaddsheikh started a new conversation URL In Create Method For Relationships

On the following URL:

http://localhost/hm/public/courses/2/batch/create

I have a create form for batches for courses.

Now I need the post the form to the following URL:

http://localhost/hm/public/courses/2/batch/

How do I achieve this?

fahaddsheikh left a reply on Store Method On A Morphmany Relationship

Sorry for answering late. I divided my controllers into two separate controllers.

28 Jun
2 years ago

fahaddsheikh left a reply on Store Method On A Morphmany Relationship

@zachleigh I already have that. The relationship is valid and working.

The problem I is I have one store method and in that store method I need a way to identify which instance is being requested so I could appropiately call the addBatch method on it

fahaddsheikh started a new conversation Store Function On A Morphmany Relationship

I have a morhphmany relationship. A batch can be associated to an event and a course. I already have methods to store data but when a post request hits the BatchConroller how do i check if its from an event or a course. Here's my controller.

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request, Course $course, Event $event)
    {
        $course->addBatch([
            'user_id'       => request('user_id'),
            'parent_id'     => request('parent_id'),
            'parent_type'   => request('parent_type'),
            'start_date'    => request('start_date'),
            'end_date'      => request('end_date'),
            'start_time'    => request('start_time'),
            'end_time'      => request('end_time'),
            'start_day'     => request('start_day'),
            'end_day'       => request('end_day'),
            'price'         => request('price'),
            ]);

        return back();
    }

This is my addBatch method which is within a trait in both events and courses

    /**
     * A Batch can be created by its parents
     *
     * @return void
     * @author 
     **/
    function addBatch($batch)
    {
        $this->batches()->create($batch);
    }

fahaddsheikh left a reply on Laravel Says An Existing Method Does Not Exist.

Thankyou very much this worked for me.

    public function store(Course $course, Request $request)
    {

        $course->addCourse([
            'user_id'       => request('user_id'),
            'title'         => request('title'),
            'body'          => request('body'),
            'country'       => request('country'),
            'city'          => request('city'),
            'address'       => request('address')
            ]);
        return back();
    }

fahaddsheikh started a new conversation Laravel Says An Existing Method Does Not Exist.

I have a class named Course and a method on that course by the name addCourse. I've also set guarded to []. Here is the class

class Course extends Model
{
    protected $guarded = [];

    /**
     * Add a course
     *
     * @return void
     * @author 
     **/

    public function addCourse($course)
    {
        $this->create($course);
    }

}

On the store method I am calling the following

    public function store(Request $request)
    {
        $request->addCourse([
            'user_id'       => request('user_id'),
            'title'         => request('title'),
            'body'          => request('body'),
            'country'       => request('country'),
            'city'          => request('city'),
            'address'       => request('address')
            ]);
        return back();
    }

But the following test

    /**
     * A user may create courses
     *
     * @return void
     * @author 
     **/
    function test_an_authenticated_user_may_create_courses()
    {
        $this->mockUser();

        $course   = factory('App\Course')->make();

        $this->post('/courses', $course->toArray());
        
        $this->assertCount(1, $this->course);
        
    }

returns the following

BadMethodCallException: Method addCourse does not exist.

27 Jun
2 years ago

fahaddsheikh left a reply on Route Model Binding Not Working On Relationships.

@oushare. Thankyou that worked. Can you please elaborate a little bit on why it did work? Please edit the existing answer so others could benefit

fahaddsheikh started a new conversation Route Model Binding Not Working On Relationships.

I'm sorry I'm very new to Laravel but please let me know

I have a nested route:

    Route::resource('courses.batch', 'BatchController');

when visited the url

    courses/{course}/batch/{batch}

shouldn't route model binding automatically work for

    /**
     * Display the specified resource.
     *
     * @param  \App\Batch  $batch
     * @return \Illuminate\Http\Response
     */
    public function show(Batch $batch)
    {
        $batches = $batch->load('creator', 'participant','participant.creator');
        return view('batches.index', compact('batches'));
    }

But it gives me an error

    Argument 1 passed to App\Http\Controllers\BatchController::show() must be an instance of App\Batch, string given
26 Jun
2 years ago

fahaddsheikh started a new conversation Eager Loading In Show Method

I already have

    public function index()
    {
        $courses = Course::with('creator')->get();
        return view('course.index', compact('courses'));
    }

How do I do the same for

    public function show(Course $course)
    {
        return view('course.single', compact('course'));
    }
11 Jun
2 years ago

fahaddsheikh started a new conversation Randomize Seeding For Factory

I have courses and events. Both courses and events will have batches. For database seeding I need to generate a random id for existing courses or events in the batches table. So each batch could randomly be assigned to either a course or an event.

I used array_rand to either associate a batch to a course or an event. Used the following code

'''php

fahaddsheikh started a new conversation Eloquent Query For 2 Tables In Database Seeding

I have courses and events. Both courses and events will have batches. For database seeding I need to generate a random id for existing courses or events in the batches table. So each batch could randomly be assigned to either a course or an event. I am able to randomly pull an event or a course but I unable to pull a random from both. Please Help.

I am using the following code

$factory->define(App\Batch::class, function ($faker) {

    // Random datetime for starting date within a week
    $startingDate = $faker->dateTimeBetween('this week', '+6 days');
    // Random datetime for ending date of the current week *after* `$startingDate`
    $endingDate   = $faker->dateTimeBetween($startingDate, '+3 months');

    // Random datetime for starting time
    $startingTime = $faker->dateTimeBetween('this week', '+1 hours');
    // Random datetime of ending time from the starting
    $endingTime   = $faker->dateTimeBetween($startingTime, '+3 hours');

    return [
        'user_id'       => App\User::all()->random()->id,
        'parent_id'     => App\Course::all()->random()->id,
        'start_date'    => $startingDate,
        'end_date'      => $endingDate,
        'start_time'    => $startingTime,
        'end_time'      => $endingTime,
        'start_day'     => $faker->dayOfWeek,
        'end_day'       => $faker->dayOfWeek,
        'price'         => $faker->numberBetween($min = 1, $max = 10) * 100 
    ];
});
30 Apr
2 years ago

fahaddsheikh started a new conversation I Want To Move

I want to move out of my country and settle somewhere else.

I have a bachelors degree is Computers Sciences. 4 years experience with php mysql html css javascript

Most of the work i have done is on WordPress. Ive made custom plugins and themes and worked a little on the wordpress rest api.

Recently started learning laravel. Thanks to @JeffreyWay ive learned alott.. Made some applications and i understand laravel concepts very cleary now. Although i am still a begginer i feel that with a little hands on experience ill easily adopt to laravel.

Ive been working as a freelancer on upwork for almost 3 years and dealt with clients from all over the world so my english is good and i also have experience in dealing with clients directly.

What do you guys suggest i do?

24 Apr
2 years ago

fahaddsheikh left a reply on How Much Do You Earn?

@TheSteed Which skills do you prefer to go for if i want to be a software engineer?

21 Apr
2 years ago

fahaddsheikh left a reply on How Much Do You Earn?

@kenske That's very good. I am glad to see someone is earning handsomely.

@ohffs I totally agree. I just wanted to go full time laravel and wanted to have an idea if it would payoff. Not that a skill will never pay off I believe it always does but I just wanted to know the value of a good laravel/php developer. Thankyou for understanding

@Ruffles That's what I am trying to do. Advance up the ladder. I've been working with wordpress for almost 4 years now and i've realised i'll always be capped to a limited potential. So i decided to move on. But yea I agree with you its more about a person.

I just want to know how much to expect when I am atleast an amateur in laravel. I guess I'll have to ask around in my local community. Thankyou very much all for your time.

fahaddsheikh left a reply on How Much Do You Earn?

@ohffs

I just wanted to know what sort of standard of living can I maintain If I be proficient at laravel.

I dont understand why is our field so underpaid. We have such a high learning curve and the need to learn something completely new every year yet I find people in our field our underpaid.

People in other fields graduate and their need to learn and study disappears and they eventually earn 3 times more than a decent developer. I find that very sad and demotivating

If you're saying that a good laravel developer earns USD 1500 per month and still barely makes through the month why is this happening I dont understand..

@Ruffles

I dont understand if i Know I am good at something why wont I switch to a company that can pay me higher?

17 Apr
2 years ago

fahaddsheikh left a reply on How Much Do You Earn?

@BradHe 1700USD is decent. So you've jumped from begginer to senior in just 8 months? that's great progress

fahaddsheikh left a reply on How Much Do You Earn?

@JeffreyWay Isn't there a way to undo if we accidentally selected a right answer? If there isnt I think there should be at least a confirmation..

fahaddsheikh left a reply on How Much Do You Earn?

@BradHe Thats exactly what I am interested in.

  • We need to realize which markets are underpaid and which are decent.
  • Can I get any better or what I am getting is enough for my skill level.
  • Is it worth it to move to better paying countries

fahaddsheikh left a reply on Debate

I've worked with Wordpress for almost 4 years and as a developer I think you should know both and apply whatever works best for the project.

Spending 4 years on Wordpress i've learnt that it really limited my potential as a developer and when I moved on to frameworks a whole new world was made open to me. Also working with Wordpress is much more easier now.

Although I am still a beginner but what i've learnt is as a developer don't be afraid to learn. Just conquer and move on!

fahaddsheikh left a reply on Unable To See Laravel Tutorial

Are other videos working?

fahaddsheikh started a new conversation How Much Are You Worth?

Hello, Just curious how much is a Laravel developer worth in different countries. Respond with

Monthly Income: Experience: (Beginner, Intermediate, Advanced) Time spent working with Laravel: Country:

How much do you think a fresh laravel developer should know and how much do you think he can earn? (Just to motivate new people)

22 Feb
2 years ago

fahaddsheikh left a reply on Laravel Fetching Old Table Names

protected $table = 'role';

Fixes the problem but it should not be like this because in my schema the table name is role

fahaddsheikh started a new conversation Laravel Fetching Old Table Names

So i was watching this ACL video in what's new in Laravel 5.1 and i decided to rename my roles table to role. I did it everywhere. No instance of roles can be found when pressing ctrl + p but when i try $role->save(); through tinker it says the following

Illuminate\Database\QueryException with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel-h.roles' doesn't exist (SQL: insert into `roles` (`updated_at`, `created_at`) values
 (2017-02-22 06:07:01, 2017-02-22 06:07:01))'

I have tried

composer dump-autoload
php artisan cache:clear
php artisan view:clear

Still the same error.

20 Feb
2 years ago

fahaddsheikh left a reply on Create User Sub Types When User Is Created

@kemito I was thinking to just provide inputs to the user on the registration form if he wants to register as a employee, client or both and then when the user is created on the RegisterController create method I also create records in clients or employees...

fahaddsheikh started a new conversation Create User Sub Types When User Is Created

I have the default auth model provided by laravel. I have users distributed in two types of roles. One is Client and the other is Employee.

I have two separate tables for these one by the name of Client and other by the name of Employee. Now Upon registration I want to ask the registrar which type of account he needs to create and then update the record in the relative employee or client table.

So on a successful register there will be main record on the users table and if the registrar is an employee a record will automatically be created for him.

The relationship between these entities are. User has one Employee or has one Client and Client or Employee belongs too the User

How do I do that upon the user registration a record is automatically created in the client or employee table.

03 Feb
2 years ago

fahaddsheikh left a reply on Starting Out A Big Web App

Okay guys thankyou so very much. I've decided to get this done as soon as I can and starting working on the website and see how things go from there.

I am redesigning the database to make it more simpler and less complicated while keeping in mind all your suggestions. I'll keep you guys updated if I can.

Thanks alot. Cheers!

fahaddsheikh left a reply on Starting Out A Big Web App

@ohffs I get what you're trying to say and I 100% agree but what I am worried about are transactions. From what i've researched everybody told me if you're making transactions everything should be perfect and that made me really scared :(,,

Also I am worried if I add a payment method in the future I would have to redesign everything and it will all be a big mess again..

fahaddsheikh left a reply on Starting Out A Big Web App

I have planned a rough sketch can you guys please point any potential problems in this or anyway I could improve this further

https://www.dropbox.com/s/oq5uf4pfh7idvao/download%20%281%29.png?dl=0

fahaddsheikh left a reply on Starting Out A Big Web App

@ohffs I have to assume that there will be seriously large data/traffic in the future when building because this is a freelancing website which will contain alot of users and alot of transactions. I can't build it while not thinking ahead right?

fahaddsheikh left a reply on Starting Out A Big Web App

Thankyou very much for your responses. It surely does clear things up.

Also my db will also have payments. Now this is really confusing since there will be differrent types of payment methods like skrill, paypal or wire transfer and then there will be withdrawals and deposits and all of these will have different attributes too.

Also since this is a freelancing type website a freelancer will first have its money arrive in its account and then he can widthdraw. Which will be total amount - withdrawl amount

How do you guys think I should design the tables for this?

Should I keep all the transactions in one place and connect them to various payment methods and payment types ie withdrawl and deposit in the form of tables?

02 Feb
2 years ago

fahaddsheikh started a new conversation Starting Out A Big Web App

Hello Everyone,

I am starting to work on a big scale freelance web app for my local market which will have users and payment transactions.

I am planning to first build this website on paper. At first I tried to look at the database model so that I can extract data objects from it.

Now what makes me confused is lets say I have a user profile which has sub-parts like skills, jobs and proposals. Now what I planned is to actually keep all of these in a separate table and then link them to the user.

So i'll have a users table, a skills table, a jobs table and a proposals table. Now when in future my web app grows and there are thousands of records in a table will involving too much tables and extracting data from these different tables and showing them in a single page effect the performance of my website?