nipun

nipun

Member Since 1 Month Ago

Sri Lanka

Experience Points 470
Experience Level 1

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

19 Apr
3 days ago

nipun left a reply on Adding New Field Into To User Table

Sorry for posting this. I found the error. The reason was i was updating user controller not RgisterController

nipun left a reply on Where Are You All From?

Sri lanka

nipun left a reply on Adding New Field Into To User Table

@CRONIX - As generated error insert into dosen't show the usertype field. Could you please tell me why is that

nipun left a reply on Adding New Field Into To User Table

@CRONIX - @cronix plese see the below code of the controller

public function store(UserRequest $request, User $model)
    {
        $model->create($request->merge(['password' => Hash::make($request->get('password'))])->all());

        return redirect()->route('user.index')->withStatus(__('User successfully created.'));
    }

nipun started a new conversation Adding New Field Into To User Table

I have updated the laravel users table by adding few more field.usertype was one of it. Then I have updated the User model fillable field and also I have added required input types into my form. After all of these I have run php artisan migrate:refresh after that I can see that my table field also updated. But when I submit the form it generates the below error saying usertype dosent have a default value. usertype field is not a null filed .Can anyone say me whats wrong in this. For more references please refer below codes.

migration table

    {
        Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');

            //added by myself
            $table->string('usertype');
            $table->boolean('activestatus')->default(false);
            //
            $table->rememberToken();
            $table->timestamps();
        });
    }```

`User model`
```   */
    protected $fillable = [
        'name', 'email', 'password','usertype',
    ];

User registration form

                            @csrf
                            <input type="text" name="usertype" id="hiddenUserType" value="a" hidden/>


                            <div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
                                <div class="input-group input-group-alternative mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="ni ni-hat-3"></i></span>
                                    </div>
                                    <input class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" placeholder="{{ __('Name') }}" type="text" name="name" value="{{ old('name') }}" required autofocus>
                                </div>
                                @if ($errors->has('name'))
                                    <span class="invalid-feedback" style="display: block;" role="alert">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group{{ $errors->has('email') ? ' has-danger' : '' }}">
                                <div class="input-group input-group-alternative mb-3">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="ni ni-email-83"></i></span>
                                    </div>
                                    <input class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" placeholder="{{ __('Email') }}" type="email" name="email" value="{{ old('email') }}" required>
                                </div>
                                @if ($errors->has('email'))
                                    <span class="invalid-feedback" style="display: block;" role="alert">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group{{ $errors->has('password') ? ' has-danger' : '' }}">
                                <div class="input-group input-group-alternative">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="ni ni-lock-circle-open"></i></span>
                                    </div>
                                    <input class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" placeholder="{{ __('Password') }}" type="password" name="password" required>
                                </div>
                                @if ($errors->has('password'))
                                    <span class="invalid-feedback" style="display: block;" role="alert">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <div class="input-group input-group-alternative">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text"><i class="ni ni-lock-circle-open"></i></span>
                                    </div>
                                    <input class="form-control" placeholder="{{ __('Confirm Password') }}" type="password" name="password_confirmation" required>
                                </div>
                            </div>
                            {{--  <div class="text-muted font-italic">
                                <small>{{ __('password strength') }}: <span class="text-success font-weight-700">{{ __('strong') }}strong</span></small>
                            </div>  --}}
                            <div class="row my-4">
                                <div class="col-12">
                                    <div class="custom-control custom-control-alternative custom-checkbox">
                                        <input class="custom-control-input" id="customCheckRegister" type="checkbox">
                                        <label class="custom-control-label" for="customCheckRegister">
                                            <span class="text-muted">{{ __('I agree with the') }} <a href="#!">{{ __('Privacy Policy') }}</a></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="text-center">
                                <button type="submit" class="btn btn-primary mt-4">{{ __('Create account') }}</button>
                    </div>
                    </form>```
`Error `

SQLSTATE[HY000]: General error: 1364 Field 'usertype' doesn't have a default value (SQL: insert into users (name, email, password, updated_at, created_at) values (Nipun Tharuksha, [email protected], $2y$10$09gqy/Y2oipcMFna0EyzCuLFlTDMVYEMc6uAioH1LGsBkzlZEEwM6, 2019-04-19 14:41:56, 2019-04-19 14:41:56))``

17 Apr
5 days ago

nipun left a reply on Laravel 5.8 With Sweetalerts

@SNAPEY - Dear @snapey

Thank you very much for the comment and its working as I wanted right now .So once again thank you. This is the answer for my question. Thanks

16 Apr
6 days ago

nipun left a reply on Laravel 5.8 With Sweetalerts

@SNAPEY - This is what I did

** ** pull in the package through Composer via ** **

composer require uxweb/sweet-alert

** **I'am using Laravel 5.8 . However I did below changes at config/app.php ** **

'providers' => [ UxWeb\SweetAlert\SweetAlertServiceProvider::class, ];

'aliases' => [ 'Alert' => UxWeb\SweetAlert\SweetAlert::class, ];

** ** Then installed Javascript library through npm via ** **

npm install [email protected]^2.0 --save-dev

** **This is my code used at registration controller. What I wanted to do is when a user get register a sweetalert will popup saying registration successfull. So as in the documentation I have used use Alert; . ** ** Please see the below code

<?php

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use Alert;

class RegisterController extends Controller
{
    

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';



    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
        
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255','regex:/^[a-zA-Z\s]+$/','min:3'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'mobile' => ['required','unique:users','regex:/^[0-9]{10}$/','max:10'],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
            'mobile' => $data['mobile']
        ]);
        alert()->warning('WarningAlert','Lorem ipsum dolor sit amet.');
    }
}

** ** Then updated the app.blade.php inlcuding js CDN ** ** This is the code

  
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js">

<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>

</head>

<body>

    <div id="app">

    @include('sweetalert::alert') 

When the user get signup it did popup anything. @jdc1898 as you mentioned there was a coding error in my CDN link and I have fix it with the CDN you submitted. Can anyone tell me is there is any wrong at registrtion function.

nipun left a reply on Laravel 5.8 With Sweetalerts

@JOUCKE - Dear @joucke I have pasted the link though the official site

nipun left a reply on Laravel 5.8 With Sweetalerts

@DIPAKRATANIAGILE - Thank you for reply. I have tried all of these. With respect to the 2nd link I have followed all the steps and after that when I go through the url it only show me a line with text " Laravel Sweet Alert Notification" . I think I have followed all the steps correctly

nipun left a reply on Laravel 5.8 With Sweetalerts

@JDC1898 - Thanks for the reply. After you said i checked my console and this was the error .

The script from “http://localhost:8000/%E2%80%9Dhttps://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js%22” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type.

15 Apr
1 week ago

nipun started a new conversation Laravel 5.8 With Sweetalerts

Can anyone tell me how to add sweetalerts with Laravel 5.8 . I tried sweetsalerts as as mentioned in github. But it isn't working. So it would be great if anyone can give me a brief description about using sweetalerts with laravel 5.8

11 Mar
1 month ago

nipun left a reply on Show Users Not In Table

are you expecting the query

nipun left a reply on Show Users Not In Table

what do u wants to know

nipun left a reply on Laravel Passport Authentication

@CRONIX - thank you for letting me know how to insert my code .Could you please check it now

nipun started a new conversation Laravel Passport Authentication

please see the below code of UserController . Iam trying to use VUEJS via api .So i have created routes for register and login at api.php . For testing im trying to pass data through postman and via http://localhost:8000/api/register with Accepted application/json and Content-type with application/json. Im passing data via body as form data. The problem is that when I try to send data postman send data continuously withoult a response and when I cancell the request the port 8000 dosent work anymore. So i have to stop the server and run again. Can anyone tell me are there are any errors in my code.