janakaontomatrix

janakaontomatrix

Member Since 1 Year Ago

Experience Points 830
Experience Level 1

4,170 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 4
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.

14 Sep
1 year ago

janakaontomatrix started a new conversation Create Authenticatable Interface Manually

I have a unique scenario. Users can proceed as guests by giving only the email address. The email is saved on the users table, without password and other details. When a guest wants to register with the site he/she will proceed with the registration.

This is the problem. When a user proceed as guest a entry in users table created. When the same user registers with the site his details are not inserted, only updated in the table.

protected function create(array $data) {

    $user_check = User::where('email', '=', $data['email'])
      ->get();

    $user = User::where('id', '=', $user_check[0]->user->id)
          ->update(['password' => bcrypt($data['password']),]);
    
    return $user;
  }

Above is my code in the RegisterController class. When I try to register a user I get following error:

(1/1) FatalThrowableError Type error: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Http\JsonResponse given, called in \vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 35

But this works if it is an insert:

      $user = User::create([
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
      ]);

Is there any way to manually create Authenticatable variable with the update? Help is appreciated. Thanks.

08 Sep
1 year ago

janakaontomatrix left a reply on Add Custom Message To Message Bag Without Validation

@ChristophHarms

MessageBag {#233 ▼
  #messages: array:1 [▼
    "token" => array:1 [▼
      0 => "This is the error message"
    ]
  ]
  #format: ":message"
}

janakaontomatrix left a reply on Add Custom Message To Message Bag Without Validation

@ChristophHarms No errors. When I debug it in the resources/views/common/errors.blade.php by

{{dd($errors)}}

I get:

ViewErrorBag {#212 ▼
  #bags: []
}

janakaontomatrix started a new conversation Add Custom Message To Message Bag Without Validation

How can we add a custom message to message bag, when there is controller without validation. Lets look at following example.

I have following view resources/views/common/errors.blade.php


@if (count($errors) > 0)
    <div class="alert alert-danger">
        <strong>Whoops! Something went wrong!</strong>

        <br><br>
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

I have above file is added in my views as:

@include('common.errors')

Now here is the code my controller:

if ($my_condition) {
      $message_bag->add('token', 'This is the error message');
      return redirect('/products')->withErrors($message_bag);
    }

Please can you help me with this. As you can see there is no validation is used in this controller.

07 Sep
1 year ago

janakaontomatrix left a reply on Edit Blade Does Not Load Old Data

I believe you use the edit function as get method request.

First check whether the $post is coming to the view by adding {{dd($post)}} in your blade file. If not then you have to check your controller for passing the correct data.

06 Sep
1 year ago

janakaontomatrix left a reply on Localization Set A Locale

@lars6 Thank you I'll look into it.

janakaontomatrix started a new conversation Localization Set A Locale

When we set a locale we use App::setLocale(). Is this a global setting or do we have to set this every time a page loads. The documentation does not have anything on this. Help is appreciated. Thank you.

31 Aug
1 year ago

janakaontomatrix left a reply on Ajax Not Calling Controller Function.

try setting the ajax function with:

 $.ajax({ type: "DELETE", url: '/delprofile', success:alert("Record deleted."), error: alert("Record not deleted.") });
21 Aug
1 year ago
18 Aug
1 year ago

janakaontomatrix started a new conversation Locate Third Party Packages With Composer Install

I have a website build with laravel and I need to install a third party payment gateway. I ran the composer command composer require mypackage/mypackage-php. This installed the package and I want to know where the installed files are located and how to use this package(add a class instance) within our controllers, repositories,etc.

janakaontomatrix left a reply on Install Package Laravel 5

@skliche When we install a package like this, do you know which directory the packages are installed and how to add them to controllers, repositories, etc.?

15 Aug
1 year ago

janakaontomatrix started a new conversation Laravel Default Session Content

This is a vague and broad question. So I apologize in advance. I want to know the content of Laravel default session. I don't want full content of it. If I can know valuable info such as last URL variable in session and how to access them will be great.