shaikh709

shaikh709

Software Developer at Remote Analytics Jobs

Member Since 2 Years Ago

Thane

Experience Points
45,410
Total
Experience

4,590 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
431
Lessons
Completed
Best Reply Awards
2
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.

Level 10
45,410 XP
29 Jul
1 month ago

shaikh709 left a reply on Help With TimeZones

@ It is a great package. I has helped me a lot in my projects. Thank you for building it. :)

20 Apr
5 months ago

shaikh709 left a reply on Where Are You All From?

Mumbai, India.

28 Mar
5 months ago

shaikh709 started a new conversation Laravel Dusk Not Visiting Vue Route

I've a route like /employer/#/jobs when I try to use following code

            $browser->visit('/login')
                ->assertSee('Login')
                ->type('.email', '[email protected]')
                ->type('.password', 'secret')
                ->click('.submit')
                ->waitForReload()
                ->assertSee('Dashboard')
                ->visit('/employer/#/jobs')
                ->waitForText('Jobs')

it goes to login page, login and land on dashboard but doesn't visit '/employer/#/jobs` page.

Thank you.

30 Jan
7 months ago

shaikh709 left a reply on MITM Protection Api Laravel

Hi @testlara, some tips would be to use HTTPS and following package might help you, but still it won't be 100% secure but it won't be that easy too.

https://github.com/kbs1/laravel-encrypted-api

hope it helps :)

27 Jan
7 months ago

shaikh709 left a reply on Help With TimeZones

Hi @movepixels, I had to do the same thing. In my case it was a blogging system. So, each user may be in different country but post should adapt to local time of where user is right now. I created a timezone lib from scratch but you can use this package https://packagist.org/packages/jamesmills/laravel-timezone

it will add helper methods to allow you to show user's local time in any country.

Hope it helps :)

14 Jan
8 months ago

shaikh709 left a reply on Multi Auth - Login Error Message Visibility - Issue

What do you get when you dd($credential);? Have you tried tinker to try same credentials by using Auth::guard('admin')->attempt($credential, $request->member); Does it log you in? Hope you are targeting right Model in providers array of config/auth.php for admin guard.

13 Jan
8 months ago

shaikh709 left a reply on Multi Auth - Login Error Message Visibility - Issue

how do you authenticate admin credentials? is it like Auth::attempt(['email' => '[email protected], 'secret' => 'secret'])?

shaikh709 left a reply on Multi Auth - Login Error Message Visibility - Issue

Are you using route guards for multi login? It would be great if you can post some of your code, So, It will be easier for people to find problems.

24 Dec
8 months ago

shaikh709 left a reply on Get Current User's ID In API Controller

Yeah, That's what is happening. For the system, User is not logged in. checkout laravel passport. Something about tokens "APIs typically use tokens to authenticate users and do not maintain session state between requests.". So, Having token will solve your problem. follow guide on this link https://laravel.com/docs/5.7/passport and that should resolve your issue. It isn't really a issue at this moment your system lacks api token. That's it. :)

shaikh709 left a reply on Get Current User's ID In API Controller

Just a silly thing but make sure you are passing token correctly. Like if you are using passport or JWT. Then in your request header token should be present. You can open Chrome DevTools. click on network tab. Click on the request which was made to store data and then click on header. Headers and preview etc will popup when you click on request. Here is how you can find request header in case if you don't know https://developers.google.com/web/tools/chrome-devtools/network-performance/reference

In there your token should be passed to server correctly. At this moment your app is returning null when you call auth('api')->user(). So, it is thinking that you are not logged-in yet.

27 Sep
11 months ago

shaikh709 left a reply on Auth()->user() Returns Null On Production But Works In Local

@lostdreamer_nl Thank you for comment. Yes, I did ran php artisan passport:keys

26 Sep
11 months ago

shaikh709 started a new conversation Auth()->user() Returns Null On Production But Works In Local

When i'm making ajax request. auth()->user() returns data on local dev area but when same code is uploaded to production. It returns 401 not authenticated and values of auth()->user() and other auth function returns null. but if I do auth()->check() on page reload it returns true. Problem is only when i make ajax request.

Below is a image of headers sent vie axios. https://ibb.co/dQnUwp

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
    ],

I've been stuck here from 2 days. Still not able to solve it. Please help.

01 Sep
1 year ago

shaikh709 left a reply on What Front End Framework Is Use In Laracasts ?

Depending on last tutorial that I saw. It looks like. He is using blade with vue components.

25 Aug
1 year ago

shaikh709 left a reply on [PDOException]

can you please post here your seeder, factory or migration to find the problem.

shaikh709 left a reply on [PDOException]

does running php artisan migrate:fresh --seed gives you same error?

06 Jul
1 year ago

shaikh709 started a new conversation Laravel + Echo + Socket.IO + Redis Performance

If I use Laravel echo with socketio and redis. How do I know the limitations which I might hit when using it in production mode or what are the things I should know before putting all of these technology for chat in production mode.

29 May
1 year ago

shaikh709 left a reply on How To Run Laravel Database Seeder From Phpunit Test SetUp?

Can we run this command $this->artisan('db:seed') once and data stays there till application run tests. So, that we don't need to use db:seed in every test class. Making is drastically slow.

20 May
1 year ago

shaikh709 left a reply on Don't Want Nested Queries

@Vilfago Thank you for your reply. $filters is an instance of MovieFilters Class.

shaikh709 started a new conversation Don't Want Nested Queries

I saw Filters video here (Laracasts) and I guess I have followed everything correctly but below query doesn't function is expected. I have movies and series in my database. If user choose series then it returns movies and series. Which is wrong.

If i add dedicated where clause like

$movies->where('type',  $request->input('movie_type'))->filter($filters)

it works but If I added movie_type filter in MovieFilters class. It returns movies and series. If I do $movies->getQuery() I see one array of wheres and the type is nested and If I do $movies->toSql() I get below output.

select distinct * from `movies` where (`type` = ? and `title` like ? or movies.id IN(SELECT movie_id FROM genre_movie WHERE genre_id IN(SELECT genre_id FROM genres WHERE name = ? )) or movies.id IN(SELECT movie_id FROM country_movie WHERE country_id IN(SELECT id FROM countries WHERE id = (SELECT country_id FROM country_audios WHERE audio = ?))) or movies.id IN(SELECT movie_id FROM country_movie WHERE country_id = (SELECT id FROM countries WHERE name = ?)) or `movies`.`released` = ? or `movies`.`type` = ? or movies.id IN(SELECT movie_id FROM people WHERE name like ?) or movies.id IN(SELECT movie_id FROM i_m_d_bs WHERE awards like ?)) 

If I add

$movies->where('type',  $request->input('movie_type'))->filter($filters)

and do $movies->toSql() it returns

select distinct * from `movies` where `type` = ? and (`type` = ? and `title` like ? or movies.id IN(SELECT movie_id FROM genre_movie WHERE genre_id IN(SELECT genre_id FROM genres WHERE name = ? )) or movies.id IN(SELECT movie_id FROM country_movie WHERE country_id IN(SELECT id FROM countries WHERE id = (SELECT country_id FROM country_audios WHERE audio = ?))) or movies.id IN(SELECT movie_id FROM country_movie WHERE country_id = (SELECT id FROM countries WHERE name = ?)) or `movies`.`released` = ? or `movies`.`type` = ? or movies.id IN(SELECT movie_id FROM people WHERE name like ?) or movies.id IN(SELECT movie_id FROM i_m_d_bs WHERE awards like ?)) 

First thing i notice in where clause it type and other wheres has brackets around them like ( blah OR blah). How can I make query without nesting it?

Thank you.

27 Dec
1 year ago

shaikh709 left a reply on Multi-Choice Question Answer Validation

Please tell me can this work?


    protected function multiSelectQuestionCheck( Question $question )
    {
        # grabbing correct answers
        $correctAnswers = $question->answer;
        $result = DB::select("SELECT id FROM answers WHERE option_id IN (SELECT option_id FROM question_correct_options WHERE question_id = {$question->id})");
        if( count($correctAnswers) === count($result) ) {
            return $question->score;
        }
        return 0;
    }

shaikh709 started a new conversation Multi-Choice Question Answer Validation

I'm working on a online exam web app. there are multiple types of questions. I want to validate if the answer provided by student is correct. here is how i did it with Single Select Question

    /**
     * It will check question answer and return score
     * @param Question $question
     * @return int|mixed
     */
    protected function singleSelectQuestionCheck( Question $question )
    {
        # grabbing correct answer from question relation
        # because the question type is single choice there won't be more correct answer
        # for the question because single choice will have only one right answer
        # so grabbing index 0
        $correctAnswer = $question->answer[0];
        # grab user provided answer for the question
        # grabbing index 0 because as its single choice question
        # user will see radio button which will leave them with
        # only one selection which means one answer
        $userAnswer = Answer::where([
            ['user_id', '=', Auth()->id()],
            ['question_id', '=', $question->id],
            ['exam_id', '=', $this->exam->id]
        ])->first();
        # once we have correct option id and user answer id
        # now we're checking if both option id match
        if( $correctAnswer->option_id == $userAnswer->option_id ) {
            # both option id match which means user provided correct answer for the question
            # now we will return the score defined for the question's answer
            return $question->score;
        }
        # now we will return 0 because user didn't give valid answer for the question
        return 0;
    }

Now When I go with multi-choice question validation $correctAnswer will be array and $userAnswer will be array. How Can I validate option_id and return score.

I tried to do it with SQL but i'm not so good at it and it doesn't work. I tried this

SELECT a.option_id AS answer, qca.option_id AS correct_answer, q.id AS question_id
FROM questions AS q
JOIN question_correct_options AS qca ON q.id = qca.question_id
JOIN answers as a ON a.question_id = q.id
WHERE a.user_id = 3 AND qca.question_id = 101;

other then that I was trying to make a function like this

    protected function multiSelectQuestionCheck( Question $question )
    {
        # grabbing correct answers
        $correctAnswers = $question->answer;
        # grabbing user answers
        $userAnswers = Answer::where([
            ['user_id', '=', Auth()->id()],
            ['question_id', '=', $question->id],
            ['exam_id', '=', $this->exam->id]
        ])->get();
        # looping through correct answers
        foreach( $correctAnswers as $cAnswer ) {
            # looping through user answers
            foreach( $userAnswers as $answer ) {
                $this->processMultiSelectQuestionCheck($cAnswer, $answer);
            }
        }

    }

    protected function processMultiSelectQuestionCheck( QuestionCorrectOption $correctOption, Answer $answer )
    {
        if( $correctOption->option_id === $answer->option_id ) {
            return true;
        }
        return false;
    }

I feel like above code won't work properly and its not the right way to solve this problem i guess.

Please help me.

Thank you.

15 Dec
1 year ago

shaikh709 left a reply on Online Exam Application

@Robstar I think if I use JSON way to store information in database. I guess it might help. Ill check the question type and format answer according to question type.

I don't know if that will work or not. I already have everything else setup like users and all I just need a logic.

Thank you.

14 Dec
1 year ago

shaikh709 left a reply on Online Exam Application

I'm sorry but your answer doesn't help me understand how to implement it.

12 Dec
1 year ago

shaikh709 started a new conversation Online Exam Application

I'm working on online exam project. Which will have multi select, single select and fill in the blank for answer selection. I haven't worked on this kind of project before. So, Just need a tip on how can I make this kind of functionality.

Thank you.

21 Jul
2 years ago

shaikh709 started a new conversation Job Post Filter

I am working on job portal and I have few search filter one is Minimum pay and max pay. Each job posts has min pay and max pay. When user wants to filter they type in min and max pay and filter the result. But Client says

"if you want a job between $5-7, you'd want to know if there's one offering between $6&9 and another offering between $4& 6"

He wants the results to show range that user is looking for.

I am not clear on what logic I should use to achieve that. Here is what I am using at this moment.

        if( isset($request->min_pay) ) {
            $builder->where('min_pay', '>=', $request->min_pay);
        }

        if( isset($request->max_pay) ) {
            $builder->where('max_pay', '<=', $request->max_pay);
        }

Please help. Thank you.

13 Jul
2 years ago
12 Jul
2 years ago

shaikh709 started a new conversation How Do You Work On Porjects?

I am having issues with my workflow. Whatever I create is too buggy and not properly structured. I would like to know what strategy you follow for less bugs in projects and how do you determine what design pattern to use for the system? and would like to know about your workflow like creating UML and etc.

Thank you.

10 Jul
2 years ago

shaikh709 left a reply on Vue App Confusion

@goatshark thank you.

shaikh709 left a reply on Vue App Confusion

@goatshark Thank you very much.

I also came across posts like that but this package https://github.com/tymondesigns/jwt-auth is what I am using in my system.

07 Jul
2 years ago

shaikh709 left a reply on Deploy Laravel 5.4 App In Shared Hosting

@VINSCHI I had the same problem. What I did I created a subdomain called web and changed subdomain directory location from public_html/web to public_html/web/public and placed index.php with below code.

    header('Location: http://web.domain.com');

and everything worked fine. But this is temporary solutions.

shaikh709 left a reply on Unable To Continue Working

@SamL Exactly. Same thing happens with me. I will definitely give it a try.

06 Jul
2 years ago

shaikh709 left a reply on Unable To Continue Working

Thank you for your suggestions.

shaikh709 left a reply on Vue App Confusion

No. I know that I can make a request to api and get the data. What I don't understand is lets say i have backend.dev and frontend.dev and A user wants to login. So I have seens youtube videos and little research it seems that frontend.dev will redirect to backend.dev and then user has to allow access to data and then user will be redirected from backend.dev to frontend with access token. But I have never seen that process. I am missing something here. I just want user to login normally like they would with laravel's default authentication.

shaikh709 left a reply on Vue App Confusion

@goatshark FIRST, Thank you.

I tried that but don't know how registration process would work. Would you please explain about it?

shaikh709 started a new conversation Vue App Confusion

How can I Authenticate with Vue in Laravel?. Or can I use laravel authentication and once authenticated redirect them to vue component page and use it. But How can I verify if the user is logged in?. I am not too good with Vue it is my learning stage. Please suggest me something to implement vue authentication with laravel backend.

Thank you.

03 Jul
2 years ago

shaikh709 left a reply on Unable To Continue Working

First Thank you guys.

That's what I thought. I Should not work 14-16 Hours. But I can't sleep at night because everything is running in my head. If I try to pass time by watching movies or stuff then I feel like wasting time instead why not program and I don't program all 14-16 Hours. Its like working on how to use or implement logic, etc. Why Am I asking here?. Because I am pretty sure you all have been through this situation and may be you all have your own way for solving this problem.

and I am worried about it because I don't have any other jobs. This is the only way I earn my living.

Thanks.

shaikh709 started a new conversation Unable To Continue Working

I have a serious problem. When I have a project or an idea to work on. At the beginning I work on it like 16 or 14 hours a day but as few days goes. I usually lose interest and it gets hard for me to continue working on project. I don't know if it is procrastination or what ? Please suggest me something. Thank you.

27 Jun
2 years ago

shaikh709 left a reply on Laravel Rating Stars Package

@willvincent as you said "just a polymorphic relationship between a user id and a model that has been made ratable.". In my case I have multiple guards. Can I use your package for multi guards?

20 Jun
2 years ago

shaikh709 left a reply on ActingAs Not Working.

Ohh sorry. I'm an idiot. I'm using custom guard i changed my code to below code.

Issue was, i'm using custom guard for admin user. When I inspected actingAs method then I saw it uses default guard to login if nothing provided.

    /** @test */
    public function a_authenticated_admin_can_see_dashboard()
    {
        $admin = factory('App\Admin')->create(['password' => 'secret']);

        $this->actingAs($admin, 'admin')
                ->get(route('admin.index'))
                ->assertSee('DASHBOARD');
    }

Thanks

shaikh709 started a new conversation ActingAs Not Working.

I'm trying to test if user can see dashboard after login however it works perfectly fine in browser but when I run phpunit. I get status code 302. It redirect to login page. I'm using sqlite for testing

    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="DB_CONNECTION" value="sqlite" />
        <env name="DB_DATABASE" value=":memory:"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>

and in this is my test functions

    /** @test */
    public function a_authenticated_admin_can_see_dashboard()
    {
        $admin = factory('App\Admin')->create(['password' => 'secret']);

        $this->actingAs($admin)
                ->get(route('admin.index'))
                ->assertSee('Admin Dashboard');
    }

Please help. Thank you.

shaikh709 left a reply on Write Query Using Eloquent

@SankalpRanade Happy to help you :)

19 Jun
2 years ago

shaikh709 started a new conversation How Do You Determine If The Code Quality Is Good Or How Can I Write Code In Good Way?

I'm self taught developer. I usually make anything I can imagin but at the end of the day. I don't like the way my code works. I tried to learn design pattern but unable to make sense of it in my project. So, What can i do to program in better way or how can make my code quality good?

I love the way laravel looks and works. Its clean, easy and simple. I want to see that kind of structure in my projects. Please tell me what should I do ?

Thank you.

shaikh709 left a reply on How To Calculate Time For Given Project?

@martinbean Awesome. Thank you for that 30% margin idea :). I think that should solve most of my problems.

@joshgallagher24 Thank you for your suggestion. I usually do this but 99% of the time my projects are completely different. That's why I had that difficulty but now after @martinbean suggestion i will use that 30% margin Strategy. Thank you :)

shaikh709 left a reply on Write Query Using Eloquent

I think you wanna join two table. I think this would work.

DB::TABLE('service_list AS s')->select(DB::RAW('v.*, s.service_name'))
                        ->join('vendors AS v', 'v.service_id', '=', 's.id')
    ->where('v.account_status', 2)->get();

Read this part (https://laravel.com/docs/5.4/queries#raw-expressions) of laravel doc. May help in more depth.

shaikh709 started a new conversation How To Calculate Time For Given Project?

Whenever I receive new projects. They ask me how much time will it take and I say may be 20 or 25 days. But most of the time I fail to deliver on time. Because of that never projects gets affected. So, How can I calculate the time it will take to complete the project ? and how do you structure your folder and files for your project?

Thank you.