successdav

successdav

Member Since 8 Months Ago

Experience Points 4,950
Experience Level 1

50 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 16
Lessons
Completed
Best Reply Awards 2
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.

13 Jun
1 week ago

successdav left a reply on Help Me Refactor This Code Its A Bit Lengthy

@KEVINBUI - Nice rewrite thanks. But what if the already exist an item with an order of 2; we will want the IncrementOrderIfNeeded method to increment to 3 and so on. does the IncrementOrderIfNeeded carry out this functionaly?

02 Jun
3 weeks ago

successdav started a new conversation Help Me Refactor This Code Its A Bit Lengthy

All am doing is: When creating a new learn and setting the order number, check to see if there already exists an item with that order if so increment the order.

The code achieve the end goal but I know it can be written better

here is my code

Store method in Controller:

public function store(Course $course, Request $request)
    {
        $this->validate(request(), [
            'body' => 'required|spamfree',
        ]);
        
        $learn = Learn::addLearn([
            'body' => request('body'),
            'course_id' => $course->id
        ]);
        return $learn;
    }

Logic to persist to database on Learn Model

static public function addLearn($learn)
    {
        $order = 1;
        if(static::whereOrder($order)->exists()){
            $order = self::incrementOrder($order);
        }

        $learn = self::create([
            'body' => $learn['body'],
            'course_id' => $learn['course_id'],
            'order' => $order
        ]);

        return $learn;
    }

    static public function incrementOrder($order)
    {
        while(static::whereOrder($order)->exists()) {
            $order++;
        }

        return $order;
    }

successdav left a reply on The Return Model Does Not Include Some Fields On One To Many Relationship

@BOBBYBOUWMANN - Yep it works and that was incredibly fast reply. Thanks Sir.

successdav started a new conversation The Return Model Does Not Include Some Fields On One To Many Relationship

I have a one to many relationship between Course and learns Models, the learns has the following column 'id', 'course_id', 'body', 'order' When I insert into this learn table and use the return $learn statement the 'body' column does not get included; But when I boot up tinker and fetch the model it gets included. Thanks for your help

Migration Class

Schema::create('learns', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('course_id')->index();
            $table->string('body');
            $table->integer('order'); //This field does not get return
            $table->timestamps();
        });

Course Model Relationship

public function learns()
    {
        return $this->hasMany('App\Learn');
    }

Here is my Controller

public function store(Course $course, Request $request)
    {
        $this->validate(request(), [
            'body' => 'required|spamfree'
        ]);
        
        $learn = $course->addLearn([
            'body' => request('body')
        ]);
        return $learn;
    }

the learn gets saved successfully but the return statement

return $learn;

data does not contain order column when view on the Network Console

01 Jun
3 weeks ago

successdav left a reply on CONFUSE ON HOW TO SET THIS TABLES UP, I NEED HELP

@SNAPEY - Do you know of any Draggable UI component I can use with vuejs?

07 May
1 month ago

successdav left a reply on Help Me Get Algolia To Work On My Site

@EHBEN - Just check your network connections

06 May
1 month ago

successdav left a reply on Vue-js Modal Opens The Both Modals At The Same Time

Thanks it works like perfectly like magic

01 May
1 month ago

successdav started a new conversation Issue With Vue-js Modal

I am using vuejs modal and zurb foundation

When the vuejs modal component is open, using some keys in a form input e.g. the space bar input causes the page itself to scroll thereby removing focus from the modal.

and in some cases using the arrow keys toggles the dropdown menu in the form itself

anyone has faced this problem ... or am doing something wrong?

successdav started a new conversation Vue-js Modal Opens The Both Modals At The Same Time

Hi. I am using a plugin vue-js modal https://github.com/euvl/vue-js-modal

I setup a modal like so

<template>
    <div>
        <a @click="$modal.show('test')">BUTTONS</a>

        <modal name="test" height="auto" draggable=".window-header">
            <div class="window-header">DRAG ME HERE</div>
        </modal>
    </div>
</template>

<script>
    export default {
        
    }
</script>

Now when I place the button to launch the modal two on same page

    <testing></testing>
    <p>another button here</p>
    <testing></testing>

clicking on one of the buttons launch the modal twice, its like the two buttons are firing at thesame time. but I really want only one modal launched

how do I fix this.. thanks..

23 Apr
2 months ago

successdav left a reply on Register With Either Phone Or Email

@MARTINBEAN - Thanks for your prompt reply...

but what service will I use to send the confirmation code? I have checked google and there are so many options I just need a simple and good one.

secondly cant I use a single input field for the process? take facebook for example.. isnt this possible?

successdav started a new conversation Register With Either Phone Or Email

Can you please guide me on how to setup a registration system where the user can use an email or a phone number in place of email to register. e.g.

Enter your email or Phone

If the user provides an email - I have already setup a script to send the user and email using mailgun.

but if the user provides a phone.. I should be able to detect and send the user a token to confirm the phone number.

In summary what I need is:

  1. Unlike mailgun, what service do I use to send confirmation code
  2. How do I configure the register process to detect if the user typed in a number or email so to enable me post to the right column in my table.

Thanks for your time

22 Apr
2 months ago

successdav left a reply on Unable To Connect To Mysql From Mysql Workbench

@CRONIX - Thanks alot.. I actually got to make it work.... funny enough that I wasnt patient enough to thoroughly go through the settings you sent me and I was missing the General Settings tab section. I keep using General setting for SSH settings and this has cost me a week and 3 days... Thanks anyway

21 Apr
2 months ago

successdav left a reply on Page Loads On My Machine But Return 500 Error Online

@ASHRAAM - how do I get there? the site is running online

successdav started a new conversation Page Loads On My Machine But Return 500 Error Online

Hi! My app /dashboard page loads fine on my machine (www.stechmax.com/dashboard)

But online it returns whoops something went wrong and when I check the network tab it returns 500 error code.

I have redeployed the app, still no fix... Try changing somethings, still doesn't fixed

any help

20 Apr
2 months ago

successdav left a reply on Where Are You All From?

Hello from Nigeria.

successdav left a reply on App Deployed. Yea! So Happens If I Add New Column To User Db

@SERGIU17 - Thanks ... I have been thinking this all day, but now I know how it works. Once again, thanks.

successdav left a reply on Add Image As Background

@AISHAHYAACOB - cannot find the image in the specified path

successdav left a reply on Display 4 Layers Of One To Many Relationships In A Single View

try this

@foreach($forms as $form)
    <a href="/forms/{{ $form->id }}">{{ $form->question }}</a>

    <span>
        @foreach($form as $sub_section)
            <a href="$sub_section->id">{{$sub_section->title}}</a>
                
                //and you can continue nesting deep

        @endforeach
    </span>

@endforeach

also you may want to add something like a path() method to your model that generate the path to the model

public function path()
    {
        return '/forms/' . $this->section->id
    }

successdav left a reply on Add Image As Background

how is your folder setup? -Root - - images - - - photo.jpg

- - index.php
-- application.css

if this is your setup then use this

background-image: url("../sms/image.jpg")

or just try adding .. at the beginning

successdav started a new conversation App Deployed. Yea! So Happens If I Add New Column To User Db

I am just wondering...

someday when I finally deploy an app successfully, and then I add an extra column to the user's table.

then run php artisan migrate:refresh. locally it updates my db table. but erased all table data...

when I redeploy this app online, what happens to my registered users?

will the table also erase everything online just to add the new column?

...Damn this question had got me thinking for hours... maybe now you can help me understand thank you

successdav left a reply on Add Unique $table->unique Generates Error

@TRAY2 - Thanks, it works perfectly sir.

successdav started a new conversation Add Unique $table->unique Generates Error

$table->unique(['user_id', 'subscriber_id', 'subscriber_type', 'active']);

The above code generate error when migrating the database; error:

SQLSTATE[42000]: Syntax error or access violation: 1059 Identifier name 'subscriptions_user_id_subscriber_id_subscriber_type_active_unique' is too long (SQL: alter table `subscriptions` add unique `subscriptions_user_id_subscriber_id_subscriber_type_active_unique`(`user_id`, `subscriber_id`, `subscriber_type`, `active`))

When I remove active from the array it runs without error

$table->unique(['user_id', 'subscriber_id', 'subscriber_type']);

Any Idea why it so? I really need the active to be included in the unique row

19 Apr
2 months ago

successdav left a reply on How To Update A Model

oops! I get now

successdav started a new conversation How To Update A Model

here is the code to create. I am using polymorphic relationship morphMany();

public function createSubscription($userId = null)
    {
        if (! $this->subscriptions()->where(['user_id' => auth()->id()])->exists()){
            return $this->subscriptions()->save(
                    new Subscription([
                        'user_id' => $userId ?: auth()->id(),
                        'duration' => $this->duration,
                        'subscription_end_at' => Carbon::now()->addMonths($this->duration)
                    ])
            );
        };
    }

now to update I try

$this->subscriptions->where(['user_id' => auth()->id()])->update(['active' => false]);

the second code does not work it says BadMethodCall Exception. update does not exists.

14 Apr
2 months ago

successdav started a new conversation Alternative To Algolia

I dont have the money to pay for Algolia Services.

Is there not any Github package you can recommend for use on my website to search?

or any good resource I can use as reference to learn building one myself once it can serve for basic live search (see search result as I type)

Thank you

08 Apr
2 months ago

successdav left a reply on Git Clone My Project To A New Pc But Does Not Run

hmm. nope I don't have this folder

successdav left a reply on Git Clone My Project To A New Pc But Does Not Run

nope I just install homestead.. though not sure, but I think its suppose to install the latest version

successdav started a new conversation Git Clone My Project To A New Pc But Does Not Run

I clone my project to my new PC but when I run on browser it displays

Warning: require(/home/vagrant/Sites/stechmax-website/public/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/Sites/stechmax-website/public/index.php on line 24
01 Apr
2 months ago

successdav left a reply on Unable To Connect To Mysql From Mysql Workbench

@CRONIX - use SSH tunnel: checked Host: localhost Port: 3306 User Name: forge Authentication method: public Key Private Key: C:\Users\SUCCESS.ssh\id_rsa passphrase: *********** Save Passphrase: checked

Those are the configuration settings I have used but still not working..

Server unexpectedly closed network connection

and when I change the host to the server IP address, it loads for a while then say Network: Connection timed out

successdav started a new conversation Unable To Connect To Mysql From Mysql Workbench

I am using windows, I install mysql suite and it comes with sql workbench.

I have spend the whole day trying to connect mysql workbench to my database. but no luck ye..

I am using forge to manage the application.

here is the error mysql workbench generates

The authenticity of host '149.28.72.25' cant be established. Server key fingerprint is 6cf3:bd... are you sure you want to continue connectin?

when I click ok, comes the next error

Could not connect to SSH Tunnel Access denied for 'none'. Authentcation that can continue: public key

Can you help? Please do

successdav left a reply on How Do I Become Good At Programming

@MARTINBEAN - Yep. I get it, maybe I have been trying to learn it all quickly and I ended up being a dump. thanks alot for your contribution.

successdav left a reply on How Do I Become Good At Programming

@EDERSON - Yep... I just started a new project from scratch and I plan to not use copy and paste.... hope this helps

31 Mar
2 months ago

successdav started a new conversation How Do I Become Good At Programming

Oh! I need your help to make myself better...

I think I understand and know what the code does when reading through it.

but when ask to code this very feature, whoops I complete feel like a blockhead.

I keep referring to documentation, or video tutorials for almost anything I want to code

even for a project as simple as creating a basic CRUD project with laravel, I still refer back to documentation and videos.

Recently I decide to learn TDD and yes I did, but when I try to build a project with TDD, I dont even know how to go about writing a simple test.

I feel like a guru when reading a TDD test or anyother code I have learned. I understand the code when reading it.

also

I feel like a complete newbie when I am trying to code a TDD feature on my own

I need your advice on how to get better at writing code...

I have heard people say the learned php in 90days and are doing awesome, writing good code.

damn I have been learning PHP for a year and am not good at anything (it sucks)

24 Mar
3 months ago

successdav left a reply on Return Eloquent Model With Extra Data

actually I need this to be available on my frontend. I am using vue to collect the items once page finish loading.

successdav started a new conversation Return Eloquent Model With Extra Data

I have a function that generates the path to the object

public function path()
    {
        return '/courses/' . $this->subject->slug . '/' . $this->id;
    }

I want it so each time I fetch a course, a row should be included as 'path' => 'courses/English/3'

Is there a way to do this?

Thanks for your help

successdav left a reply on Rendering Computed Properties In Vuejs

actually this question was insane... such a shame I made this common mistake. The data was actually rendering.... I only need to do some refactoring.

You know I was actually wondering why cronix have not help me out.

successdav left a reply on Multiple Post Requests To One Page

I dont think so, but you have several other options, why not do it this way

Route::post('/Video/{slug}/comment' , ['video-comment' , 'uses' => '[email protected]']); Route::post('/Video/{slug}/like' , ['video-like' , 'uses' => '[email protected]'] );

successdav started a new conversation Rendering Computed Properties In Vuejs

Short Story

I created two computed properties courses and paths from a property subject, that basically sort out items with type_id === 1 into courses and type_id === 2 into paths I want to display this computed properties on a page but nothing shows for items that has content on courses and paths.

I view this on vue console and it shows clearly that courses is an array with 2 items and paths is an array with 4 items but it doesn't render on the page

Detailed explanation

I have a data property subjects

data () {
        return {
            active: false,
            subjects: {},
            selected: 'saepe'
        }
    },

and two computed properties from subjects. when a user hovers over a specific subject, I want to retrieve the courses associated with the subject. some of the courses are singleCourses while some are paths indicated by type_id

computed: {
    // here I am sorting out the hovered course from subject then store to data, then sort data and return  only courses whose type_id is 1

        courses () {
            let courses = [];
            let data = [];
            for (var i = this.subjects.length - 1; i >= 0; i--) {
                if (this.selected.id == this.subjects[i].id) {
                    data = this.subjects[i]['courses'];
                }
            }
            for (var i = data.length - 1; i >= 0; i--) {
                if (data[i].type_id === 1) {
                    courses.push(data[i]);
                }
            }
            return courses;
        },

// here I am sorting out the hovered course from subject then store it to data, then sort data and return   only courses whose type_id is 2 as path

        paths () {
            let paths = [];
            let data = [];
            for (var i = this.subjects.length - 1; i >= 0; i--) {
                if (this.selected.id == this.subjects[i].id) {
                    data = this.subjects[i]['courses'];
                }
            }
            for (var i = data.length - 1; i >= 0; i--) {
                if (data[i].type_id === 2) {
                    paths.push(data[i]);
                }
            }
            return paths;
        }

now when I view this on console, it works fine, when I mouseover a subject it get the subject sort the course with type_id 1 to courses and courses with type_id 2 to paths but when I render it on the browser

<!-- Courses inside of Subjects -->
                    <div class="flex-child-grow grid-x">
                        <div class="small-6">
                           <ul>
                              <li v-for="path in paths">
                                  <a href="" v-text="path.title"></a>
                              </li>
                            </ul> 
                        </div>
                        <div class="small-6">
                            <ul>
                              <li v-for="course in courses">
                                  <a href="" v-text="course.title"></a>
                              </li>
                            </ul> 
                        </div>           
                    </div>

and here is the problem, nothing displays for any subject that has items in courses and paths

17 Mar
3 months ago

successdav left a reply on Link A Javascript File To A Template

Yes I have a file on my public/js/app.js

its not the root folder, the root folder is: vue_exercises. so I have the js file on:

 vue_exercises/public/js/app.js 

and the template file on

vue_exercises/resources/views/Projects/create.blade.php

successdav started a new conversation Link A Javascript File To A Template

Thanks for reading, Yep this may sound funny but I have spend 5hrs trying to solve this problem.

I setup a new project

create a inside: resources/views/projects/create.blade.php

and I link it to the javascript file on: public/js/app.js

on my app.js file I write alert('Hello World') // I want to be sure the javascript file is connected

then on my create.blade.php file i have used the following code to link the js file

<script src="js/app.js'"></script> // This dint work

<script src="{{ asset('js/app.js') }}"></script>  // this still dint work 

<script src="{{'../../../public/js/app.js') }}"></script>  // did not work either

None of this code worked because the alert('hello world') does not run when the view the page on my browser

This thing is driving me crazy

08 Mar
3 months ago

successdav left a reply on Help Me Get Algolia To Work On My Site

yep I got it fixed, it was a network problems.

07 Mar
3 months ago

successdav started a new conversation Help Me Get Algolia To Work On My Site

when i run

php artisan scout:import 'App\Thread'

it generates this error

 cURL error 28: Resolving timed out after 2518 milliseconds (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

  at /home/vagrant/Sites/success_techmax/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:185
    181|         );
    182|
    183|         // Create a connection exception if it was a specific error code.
    184|         $error = isset($connectionErrors[$easy->errno])
  > 185|             ? new ConnectException($message, $easy->request, null, $ctx)
    186|             : new RequestException($message, $easy->request, $easy->response, null, $ctx);
    187|
    188|         return \GuzzleHttp\Promise\rejection_for($error);
    189|     }

  Exception trace:

  1   GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle))
      /home/vagrant/Sites/success_techmax/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:149

  2   GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
      /home/vagrant/Sites/success_techmax/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:102

  Please use the argument -v to see more details.

18 Feb
4 months ago

successdav left a reply on Mail Test Not Passing

I have not, can you please show me how fire this event from tinker

successdav started a new conversation Mail Test Not Passing

I am following up a laracast video on sending mails but my test is not passing...

My test class

use DatabaseMigrations;
    
    /** @test */
    public function a_comfirmation_email_is_sent_upon_registration()
    {
        Mail::fake();
        
        event(new Registered(create('App\User')));

        Mail::assertSent(PleaseConfirmYourEmail ::class);
    }

Event Service Provider Class

 protected $listen = [
        'App\Events\ThreadHasNewReply' => [
            'App\Listeners\NotifyThreadSubscribers',
        ],

        Registered::class => [
            'App\Listeners\SendEmailConfirmationRequest'
        ]
    ];

My SendEmailConfirmationRequest Class

   public function handle(Registered $event)
    {
        Mail::to($event->user)->send(new PleaseConfirmYourEmail());
    }

and when I run this test it just returns

1) Tests\Feature\RegistrationTest::a_comfirmation_email_is_sent_upon_registration
The expected [App\Mail\PleaseConfirmYourEmail] mailable was not sent.
Failed asserting that false is true.

03 Feb
4 months ago

successdav started a new conversation Laraforge Payment

Please I need some clarification, the fee I will be paying to laraforge services, does it include digital ocean fee or its just laraforge fee and I will have to pay digitial ocean fee seperately?

28 Jan
4 months ago

successdav left a reply on Where To Host

laravel forge is just going to demand an extra fee... cant afford that at the moment

successdav started a new conversation Where To Host

Hi... I need your guide on hosting my website?

Its an online training website, where we teach people how to do repairs. so its going to be containing a whole lot of media files (videos, pictures, etc ...).

I have heard much about amazon, digital ocean & vultr

but I dont know which of this three is good to go with. and I really dont want something that will cost me a whole lot of money).

27 Jan
4 months ago

successdav left a reply on RedirectTo After Registration

ok pals... dont bother I had it fixed..

I actually had a bad code in my courses.view

session()->flush()

which I forget to remove

successdav started a new conversation RedirectTo After Registration

I want to redirect the user to the products page after registration, I change this variable from

protected $redirectTo = '/home';

to

protected $redirectTo = '/products';

in the RegisterController, the redirect works but it does not sign in the user after redirecting to this URL, If I set it back to its initial, it redirects the user to home and also sign in the user.