sanjayacloud

sanjayacloud

Member Since 11 Months Ago

Experience Points 3,850
Experience Level 1

1,150 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 5
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.

12 Jun
5 days ago

sanjayacloud started a new conversation Instagram Feed Cannot Get With Vinkla Instagram Package.

Hello everyone,

I am trying to get instagram feed data user Vinkla Instagram package. I have followed steps that they given, It as followed.

 $instagram = new Instagram('my_access_token');
        $instagram->media(['count' => 5]);
       dd($instagram);

But i didn't get any data. I got below result.

Instagram {#202 ▼ #accessToken: "8037755353.1677ed0.36e13bbf392c4855b24e2992a07b4c8f" #httpClient: Client {#197 ▶} #requestFactory: GuzzleMessageFactory {#213} #request: null }

Can anyone help me to resolve this thing.

14 May
1 month ago

sanjayacloud left a reply on "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@SNAPEY - But. If I directly access these routs, It's work. why for only this redirection?

sanjayacloud left a reply on "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@SNAPEY - I got point where exactly error is coming. When i add below code to my LoginController to redirect to specific paths based on user role. Once I comment that this error doesn't come. See below my Login Controller.

<?php

namespace App\Http\Controllers\Admin\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

class AdminLoginController extends Controller {
    /*
      |--------------------------------------------------------------------------
      | Login Controller
      |--------------------------------------------------------------------------
      |
      | This controller handles authenticating users for the application and
      | redirecting them to your home screen. The controller uses a trait
      | to conveniently provide its functionality to your applications.
      |
     */

use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
   // protected $redirectTo = 'admin/product';

    /**
     * Show the application's login form.
     *
     * @return \Illuminate\Http\Response
     */
    public function showLoginForm() {
        return view('admin.auth.login');
    }

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

    /**
     * Log the user out of the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function logout(Request $request) {
        $this->guard()->logout();
        $request->session()->invalidate();
        return $this->loggedOut($request) ?: redirect('admin.auth.login');
    }

//    public function redirectTo()
//    {
//        if (auth()->user()->role == '0') {
//            return redirect('/');
//        } elseif (auth()->user()->role == '1' && auth()->user()->status == '1'){
//            return redirect('admin/experience');
//        }elseif (auth()->user()->role == '5'){
//            return redirect('admin/dashboard');
//        }
//    }


}

sanjayacloud left a reply on "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@MUNAZZIL - This is my layout.site file

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- CSRF Token -->
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>

        <!-- Fonts -->
        <link rel="dns-prefetch" href="//fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">

        <!-- Styles -->
        <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    </head>
    <body>
        <div id="app">
            <nav class="navbar navbar-expand-md navbar-light navbar-laravel">
                <div class="container">
                    <a class="navbar-brand" href="{{ url('/') }}">
                        {{ config('app.name', 'Laravel') }}
                    </a>
                    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
                        <span class="navbar-toggler-icon"></span>
                    </button>

                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <!-- Left Side Of Navbar -->
                        <ul class="navbar-nav mr-auto">

                        </ul>

                        <!-- Right Side Of Navbar -->
                        <ul class="navbar-nav ml-auto">
                            <!-- Authentication Links -->
                            @guest
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
                            </li>
                            @if (Route::has('register'))
                            <li class="nav-item">
                                <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
                            </li>
                            @endif
                            @else
                            <li class="nav-item dropdown">
                                <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                                    {{ Auth::user()->name }} <span class="caret"></span>
                                </a>

                                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="{{ route('logout') }}"
                                       onclick="event.preventDefault();
                                               document.getElementById('logout-form').submit();">
                                        {{ __('Logout') }}
                                    </a>

                                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                        @csrf
                                    </form>
                                </div>
                            </li>
                            @endguest
                        </ul>
                    </div>
                </div>
            </nav>
            <main class="py-4">
                @yield('content')
            </main>
        </div>
        <!-- Scripts -->
        <script>
            var base = '{{url(' / ') . ' / '}}';
        </script>
        <script src="{{ asset('js/app.js') }}" defer></script>
        <script src="{{asset('assets/frontend/js/jquery.sticky.js')}}"></script>
    </body>
</html>


sanjayacloud left a reply on "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@DEVFREY - II have check my files there aren't any white space found. Can you help me. please check reply. I have added my blade file.

sanjayacloud left a reply on "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

@MUNAZZIL - This my blade file. There are know find any issue. Can you check it?

@extends('layouts.site')
@section('content')
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">{{ __('Admin Login') }}</div>

                    <div class="card-body">
                        <form method="POST" action="{{ route('admin.login') }}">
                            @csrf

                            <div class="form-group row">
                                <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>

                                <div class="col-md-6">
                                    <input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>

                                    @if ($errors->has('email'))
                                        <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row">
                                <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>

                                <div class="col-md-6">
                                    <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>

                                    @if ($errors->has('password'))
                                        <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-md-6 offset-md-4">
                                    <div class="form-check">
                                        <input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>

                                        <label class="form-check-label" for="remember">
                                            {{ __('Remember Me') }}
                                        </label>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row mb-0">
                                <div class="col-md-8 offset-md-4">
                                    <button type="submit" class="btn btn-primary">
                                        {{ __('Login') }}
                                    </button>

                                    @if (Route::has('password.request'))
                                        <a class="btn btn-link" href="{{ route('password.request') }}">
                                            {{ __('Forgot Your Password?') }}
                                        </a>
                                    @endif
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

13 May
1 month ago

sanjayacloud started a new conversation "Header May Not Contain More Than A Single Header, New Line Detected" After User Is Login

Hi,

I have above error after user login my admin login controller. My controller like below.

<?php

namespace App\Http\Controllers\Admin\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class AdminLoginController extends Controller {
use AuthenticatesUsers;

    public function showLoginForm() {
        return view('admin.auth.login');
    }

    public function __construct() {
        $this->middleware('guest')->except('logout');
    }
    
    public function logout(Request $request) {
        $this->guard()->logout();
        $request->session()->invalidate();
        return $this->loggedOut($request) ?: redirect('admin.auth.login');
    }

    public function redirectTo()
    {
        if (auth()->user()->role == '0') {
            return redirect('/');
        } elseif (auth()->user()->role == '1' && Auth::user()->status == '1'){
            return redirect('admin/experience');
        }elseif (auth()->user()->role == '5'){
            return redirect('admin/dashboard');
        }
    }

}

Can anyone help me for resolve this error?

07 May
1 month ago

sanjayacloud left a reply on HTML Array Not Work With Table

@FORAM - Ididnot understand. How can i do it

sanjayacloud started a new conversation Load File Path In Html Input

Hi Guys,

I am trying to update images where coming from array. I want to know how to load image file path in input value. I did it like

<input type="file" id="action_json" name="featured_image[]" class="form-control" value="{{$obj2->image}}">

After that I got "getClientOriginalExtension() on null " Error. Anyone has a solution for this. My image path save in database column like below.

{["image":"UyxiIclQSQ1556793102.png"},"image":"Rdfl1KVgug1556793102.png"}]

sanjayacloud left a reply on HTML Array Not Work With Table

@MARTINZELTIN - Do you have any idea ?

06 May
1 month ago

sanjayacloud left a reply on HTML Array Not Work With Table

@MARTINZELTIN - It's work if i use div instead of table row (tr). I want to solution for that. Can you try this array with table rows? It's not work.

04 May
1 month ago

sanjayacloud started a new conversation HTML Array Not Work With Table

Hi Guys, I am trying a make an invoice using the table. When I'm array value I have got only one array. But I have generated more that one row. My code like below. can you anyone help me to resolve this error.

HTML

<table class="table table-bordered table-hover" id="tab_logic">
                        <thead>
                        <tr>
                            <th class="text-center"> #</th>
                            <th class="text-center"> Product</th>
                            <th class="text-center"> Qty</th>
                            <th class="text-center"> Price</th>
                            <th class="text-center"> Total</th>
                        </tr>
                        </thead>
                        <form action="{{url('vendor/storeInvoice')}}" method="post" enctype="multipart/form-data">
                            @csrf
                        <tbody>
                        <tr id='addr0'>
                            <td>1</td>
                            <td>
                                {{--<input type="text" name='product[]' placeholder='Enter Product Name'--}}
                                       {{--class="form-control"/>--}}
                                <select class="form-control" name="product[]">
                                    <option value="">Select Product</option>
                                    @foreach($products as $product)
                                        <option value="{{$product->id}}" >{{$product->name}}</option>
                                    @endforeach

                                </select>
                            </td>
                            <td><input type="number" name='qty[]' placeholder='Enter Qty' class="form-control qty"
                                       step="0"
                                       min="0"/></td>
                            <td><input type="number" name='price[]' placeholder='Enter Unit Price'
                                       class="form-control price"
                                       step="0.00" min="0"/></td>
                            <td><input type="number" name='total[]' placeholder='0.00' class="form-control total"
                                       readonly/>
                            </td>
                        </tr>
                        <tr id='addr1'></tr>
                        </tbody>
                    </table>

My controller method like this,

public function storeInvoice(Request $request)
    {
        $answersArray = array();
        $i = 1;
        foreach($request['product'] as $answer){
            $answersArray[$i] = $answer;
            $i++;
        }
        dd($answersArray);
    }

30 Apr
1 month ago

sanjayacloud left a reply on Image Source Not Readable In Laravel 5.7

@FTIERSCH - I didn't understand, Can you explain more?

sanjayacloud started a new conversation Image Source Not Readable In Laravel 5.7

I am trying to upload image but i get error above in subject.

this my code

$featuredImageArray = array();
        $f = 1;
        foreach($request['featured_image'] as $featuredImage){
            $featuredImageArray[$f] = $featuredImage;

            $image_path = Image::make($featuredImageArray);
            $set_img_path = time().$featuredImageArray->getClientOriginalName();
            $image_path->save(public_path().'/uploads/experience/'.$set_img_path);

            $f++;
        }
        dd($set_img_path);

Can anyone help me to resolve this error.

29 Apr
1 month ago

sanjayacloud left a reply on Validate HTML Array Input In Laravel

@GRENADECX - I got an undefined variable $key when I did as you suggest in the last 3 steps.

sanjayacloud started a new conversation Validate HTML Array Input In Laravel

Hi Guys,

I am trying validate html array input value. but it does not work. my code like below, can you help me to resolve this error?

HTML

<div class="col-md-6 col-sm-6 col-xs-12 form-group has-feedback">
                                        <input type="text" class="form-control"  name="included_items[]" placeholder="Item Name">
                                        @if ($errors->has('included_items[]'))
                                            <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('included_items[]') }}</strong>
                                    </span>
                                        @endif
                                    </div>

Validation code,

"included_items.*"  => "required",
22 Apr
1 month ago

sanjayacloud started a new conversation Cannot Upload Laravel Project To Git

Hi Guys,

I am trying to upload my existing laravel (5.8) project. When Im upload it vendor folder does not upload. I had following commands.

  1. git init

  2. git add .

  3. git commit -m "Add all my files"

  4. git remote add origin https://github.com/yourusername/your-repo-name.git

Can you guys help me to resolve this thing.

16 Apr
2 months ago

sanjayacloud started a new conversation Use SCSS With Laravel With Mixin

Hello every one,

I want to know how to use scss mixin with laravel and i want use it for bootstrap media queries. Any one can help me ?

02 Apr
2 months ago

sanjayacloud started a new conversation Best Live Chat Plugin For Laravel

Hey Guys,

Any can suggest me the best plugin for laravel?

19 Mar
2 months ago

sanjayacloud started a new conversation Old Value Not Work Properly After Validation Run

I am developing a questionnaire page with radio button. I have issue with validation. When user submit form some field checked and required field without checked, after the validation run that checked field old value go to final radio button.

As an example if user click answer one and validation run that clicked answer one not checked it checked answer five, that means final answer.

My code like below.

  <div class="radio">
                            <div class="form-group col-md-12">
                                <input type="radio" id="1" name="q1" value="1" {{ old('q1') ? 'checked' : ''}} >
                                <label for="1">PLL tends to deliver beyond our expectations</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="2" name="q1" value="2" {{ old('q1') ? 'checked' : ''}}>
                                <label for="2">PLL always meets our expectation levels</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="3" name="q1" value="3" {{ old('q1') ? 'checked' : ''}}>
                                <label for="3">PLL sometimes meets our expectation levels</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="4" name="q1" value="4" {{ old('q1') ? 'checked' : ''}}>
                                <label for="4">PLL hardly meets our expectation levels</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="5" name="q1" value="5" {{ old('q1') ? 'checked' : ''}}>
                                <label for="5">PLL never meets our expectation levels</label>
                            </div>
                        </div>
                    </div>

Anyone has solution for this? Please help me.

18 Mar
2 months ago

sanjayacloud left a reply on Property [q1] Does Not Exist On This Collection Instance.

@CRONIX - Got it. Thank you for your support.

sanjayacloud started a new conversation Property [q1] Does Not Exist On This Collection Instance.

Hi Guys,

I am trying to get data from database and show on my radio button. But when i trying show data, I have got below error. any one the solution for this?

Error " Property [q1] does not exist on this collection instance. "

My code

$data = \App\Question::all()->where('user_id', Auth::user()->id);
   <div class="radio">
                            <div class="form-group col-md-12">
                                <input type="radio" id="1" name="q1" value="1" {{ $data->q1 == '1' ? 'checked' : '' }}>
                                <label for="1">PLL tends to deliver beyond our expectations</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="2" name="q1" value="2" {{ $data->q1 == '1' ? 'checked' : '' }}>
                                <label for="2">PLL always meets our expectation levels</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="3" name="q1" value="3" {{ $data->q1 == '3' ? 'checked' : '' }}>
                                <label for="3">PLL sometimes meets our expectation levels</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="4" name="q1" value="4" {{ $data->q1 == '4' ? 'checked' : '' }}>
                                <label for="4">PLL hardly meets our expectation levels</label>
                            </div>
                            <div class="form-group col-md-12">
                                <input type="radio" id="5" name="q1" value="5" {{ $data->q1 == '5' ? 'checked' : '' }}>
                                <label for="5">PLL never meets our expectation levels</label>
                            </div>
                        </div>

But when im dd(); I got my all data. can anyone help me to resolve this error?

17 Mar
3 months ago

sanjayacloud started a new conversation How To Display Block Form Step If Radio Button Checked

I am creating a form wizard for questionnaire. I want to enable one step if some radio button if checked. I have did with jQuery. but it's not work. my code like below.

<form id="regForm" action="" method="post">
    <div class="tab">
                    <input type="radio" id="test1" name="q4" value="1">
                    <label for="test1">I believe that PLL’s packaging quality is the best in the industry</label>
                    <input type="radio" id="test2" name="q4" value="2">
                    <label for="test2">I believe that there are few players who offer same packaging quality as PLL</label>
    </div>
    <div id="q4_adiv" class="tab">
            <select class="form-control form-control-lg col-md-12" name="q4_a">
                <option value="1">ALFT</option>
                <option value="2">JF packaging</option>
                <option value="3">TuffLine</option>
                <option value="4">ACME</option>
                <option value="5">SELMO</option>
            </select>
    </div>
            <button type="button" id="prevBtn" onclick="nextPrev(-1)">Previous</button>
            <button type="button" id="nextBtn" onclick="nextPrev(1)">Next</button>
            <button tyle="submit" id="bt">Save</button>

    <div style="text-align:center;margin-top:40px;">
        <span class="step"></span>
        <span id="q4_a" class="step"></span>
    </div>
</form>

<script>
    $(function () {
        $("input[name='q4']").click(function () {
            if ($("#test2").is(":checked")) {
                $("#q4_a").css('display', 'block', 'important');
                $("#q4_adiv").css('display', 'block', 'important');
            } else {
                $("#q4_a").css('display', 'none', 'important');
                $("#q4_adiv").css('display', 'none', 'important');
            }
        });
    });
</script>
<script>
    var currentTab = 0; // Current tab is set to be the first tab (0)
    showTab(currentTab); // Display the current tab
    function showTab(n) {
        // This function will display the specified tab of the form...
        var x = document.getElementsByClassName("tab");
        x[n].style.display = "block";
        //... and fix the Previous/Next buttons:
        if (n == 0) {
            document.getElementById("prevBtn").style.display = "none";
        } else {
            document.getElementById("prevBtn").style.display = "inline";
        }
        if (n == (x.length - 1)) {
            document.getElementById("nextBtn").innerHTML = "Submit";
            document.getElementById("bt").style.display = "none";
        } else {
            document.getElementById("nextBtn").innerHTML = "Next";
            document.getElementById("bt").innerHTML = "Save";
        }
        //... and run a function that will display the correct step indicator:
        fixStepIndicator(n)
    }
    function nextPrev(n) {
        // This function will figure out which tab to display
        var x = document.getElementsByClassName("tab");
        // Exit the function if any field in the current tab is invalid:
        // if (n == 1 && !validateForm()) return false;
        // Hide the current tab:
        x[currentTab].style.display = "none";
        // Increase or decrease the current tab by 1:
        currentTab = currentTab + n;
        // if you have reached the end of the form...
        if (currentTab >= x.length) {
            // ... the form gets submitted:
            document.getElementById("regForm").submit();
            return false;
        }
        // Otherwise, display the correct tab:
        showTab(currentTab);
    }
    function validateForm() {
        // This function deals with validation of the form fields
        var x, y, i, valid = true;
        x = document.getElementsByClassName("tab");
        y = x[currentTab].getElementsByTagName("input");
        // A loop that checks every input field in the current tab:
        for (i = 0; i < y.length; i++) {
            // If a field is empty...
            if (y[i].checked == "") {
                // add an "invalid" class to the field:
                y[i].className += " invalid";
                // and set the current valid status to false
                valid = false;
            }
        }
        // If the valid status is true, mark the step as finished and valid:
        if (valid) {
            document.getElementsByClassName("step")[currentTab].className += " finish";
        }
        return valid; // return the valid status
    }
    function fixStepIndicator(n) {
        // This function removes the "active" class of all steps...
        var i, x = document.getElementsByClassName("step");
        for (i = 0; i < x.length; i++) {
            x[i].className = x[i].className.replace(" active", "");
        }
        //... and adds the "active" class on the current step:
        x[n].className += " active";
    }
</script>

Can anyone help me to resolve this problem. I am using w3schools form steps for this form wizard.

Source URL: https://www.w3schools.com/howto/howto_js_form_steps.asp

sanjayacloud started a new conversation How To Display Block Form Step If Radio Button Checked

I am creating a form wizard for questionnaire. I want to enable one step if some radio button if checked. I have did with jQuery. but it's not work. my code like below.

<form id="regForm" action="" method="post">
    <div class="tab">
                    <input type="radio" id="test1" name="q4" value="1">
                    <label for="test1">I believe that PLL’s packaging quality is the best in the industry</label>
                    <input type="radio" id="test2" name="q4" value="2">
                    <label for="test2">I believe that there are few players who offer same packaging quality as PLL</label>
    </div>
    <div id="q4_adiv" class="tab">
            <select class="form-control form-control-lg col-md-12" name="q4_a">
                <option value="1">ALFT</option>
                <option value="2">JF packaging</option>
                <option value="3">TuffLine</option>
                <option value="4">ACME</option>
                <option value="5">SELMO</option>
            </select>
    </div>
            <button type="button" id="prevBtn" onclick="nextPrev(-1)">Previous</button>
            <button type="button" id="nextBtn" onclick="nextPrev(1)">Next</button>
            <button tyle="submit" id="bt">Save</button>

    <div style="text-align:center;margin-top:40px;">
        <span class="step"></span>
        <span id="q4_a" class="step"></span>
    </div>
</form>

<script>
    $(function () {
        $("input[name='q4']").click(function () {
            if ($("#test2").is(":checked")) {
                $("#q4_a").css('display', 'block', 'important');
                $("#q4_adiv").css('display', 'block', 'important');
            } else {
                $("#q4_a").css('display', 'none', 'important');
                $("#q4_adiv").css('display', 'none', 'important');
            }
        });
    });
</script>
<script>
    var currentTab = 0; // Current tab is set to be the first tab (0)
    showTab(currentTab); // Display the current tab
    function showTab(n) {
        // This function will display the specified tab of the form...
        var x = document.getElementsByClassName("tab");
        x[n].style.display = "block";
        //... and fix the Previous/Next buttons:
        if (n == 0) {
            document.getElementById("prevBtn").style.display = "none";
        } else {
            document.getElementById("prevBtn").style.display = "inline";
        }
        if (n == (x.length - 1)) {
            document.getElementById("nextBtn").innerHTML = "Submit";
            document.getElementById("bt").style.display = "none";
        } else {
            document.getElementById("nextBtn").innerHTML = "Next";
            document.getElementById("bt").innerHTML = "Save";
        }
        //... and run a function that will display the correct step indicator:
        fixStepIndicator(n)
    }
    function nextPrev(n) {
        // This function will figure out which tab to display
        var x = document.getElementsByClassName("tab");
        // Exit the function if any field in the current tab is invalid:
        // if (n == 1 && !validateForm()) return false;
        // Hide the current tab:
        x[currentTab].style.display = "none";
        // Increase or decrease the current tab by 1:
        currentTab = currentTab + n;
        // if you have reached the end of the form...
        if (currentTab >= x.length) {
            // ... the form gets submitted:
            document.getElementById("regForm").submit();
            return false;
        }
        // Otherwise, display the correct tab:
        showTab(currentTab);
    }
    function validateForm() {
        // This function deals with validation of the form fields
        var x, y, i, valid = true;
        x = document.getElementsByClassName("tab");
        y = x[currentTab].getElementsByTagName("input");
        // A loop that checks every input field in the current tab:
        for (i = 0; i < y.length; i++) {
            // If a field is empty...
            if (y[i].checked == "") {
                // add an "invalid" class to the field:
                y[i].className += " invalid";
                // and set the current valid status to false
                valid = false;
            }
        }
        // If the valid status is true, mark the step as finished and valid:
        if (valid) {
            document.getElementsByClassName("step")[currentTab].className += " finish";
        }
        return valid; // return the valid status
    }
    function fixStepIndicator(n) {
        // This function removes the "active" class of all steps...
        var i, x = document.getElementsByClassName("step");
        for (i = 0; i < x.length; i++) {
            x[i].className = x[i].className.replace(" active", "");
        }
        //... and adds the "active" class on the current step:
        x[n].className += " active";
    }
</script>

Can anyone help me to resolve this problem. I am using w3schools form steps for this form wizard.

12 Mar
3 months ago

sanjayacloud left a reply on Trying To Get Property Of Non-object

@CRONIX - I did that. Same thing happen again.

sanjayacloud left a reply on Trying To Get Property Of Non-object

@CRONIX - Actually I want to do when new user login in should be show unchecked answers and when return user login should be show what he answered. Now when return user comes it shown and checked answered answer. When new user login in to system show above error. Do you have any idea or do you have any other solution for do this. please help me.

sanjayacloud started a new conversation Trying To Get Property Of Non-object

Hi Friends,

I am developing a questionnaire app. I want do if login use has already answered question, should be show his answer or if that user never answer this questionnaire should be show normal question. But i got below error.

"Trying to get property of non-object" My code like below.

  <form action="{{url('/quiz2Store')}}" method="post">
                @csrf
                <div class="form-row">
                    <?php
                    $data = \App\Question::all()->where('user_id', Auth::user()->id)->first();

                    if (empty($data)){
                        ?>
                        <div class="form-group col-md-6">
                            <input type="hidden" name="id" value="{{Auth::user()->id}}">
                            <input type="radio" id="test1" name="q2" value="1" >
                            <label for="test1">Extremely satisfied</label>
                        </div>
                        <div class="form-group col-md-6">
                            <input type="radio" id="test2" name="q2"  value="2" >
                            <label for="test2">Satisfied</label>
                        </div>
                        <div class="form-group col-md-6">
                            <input type="radio" id="test3" name="q2"  value="3" >
                            <label for="test3">Neutral</label>
                        </div>
                        <div class="form-group col-md-6">
                            <input type="radio" id="test4" name="q2"  value="4">
                            <label for="test4">Dissatisfied</label>
                        </div>
                        <div class="form-group col-md-6">
                            <input type="radio" id="test5" name="q2"  value="5">
                            <label for="test5">Highly dissatisfied</label>
                        </div>
                    <?php
                    } else {
                    ?>

                    <div class="form-group col-md-6">
                        <input type="hidden" name="id" value="{{Auth::user()->id}}">
                        <input type="radio" id="test1" name="q2" value="1" {{$data->q2 == "1" ? 'checked' : ''}}>
                        <label for="test1">Extremely satisfied</label>
                    </div>
                    <div class="form-group col-md-6">
                        <input type="radio" id="test2" name="q2"  value="2" {{$data->q2 == "2" ? 'checked' : ''}}>
                        <label for="test2">Satisfied</label>
                    </div>
                    <div class="form-group col-md-6">
                        <input type="radio" id="test3" name="q2"  value="3" {{$data->q2 == "3" ? 'checked' : ''}}>
                        <label for="test3">Neutral</label>
                    </div>
                    <div class="form-group col-md-6">
                        <input type="radio" id="test4" name="q2"  value="4" {{$data->q2 == "4" ? 'checked' : ''}}>
                        <label for="test4">Dissatisfied</label>
                    </div>
                    <div class="form-group col-md-6">
                        <input type="radio" id="test5" name="q2"  value="5" {{$data->q2 == "5" ? 'checked' : ''}}>
                        <label for="test5">Highly dissatisfied</label>
                    </div>
                    <?php } ?>
                </div>

                <button type="submit" class="btn btn-lg btn-success float-right">Next</button>
            </form>

any one has a solution for this?

02 Mar
3 months ago

sanjayacloud started a new conversation How To Get User Login Data In Laravel 5.7

Hello every one.

I want to know, When user is login to the system I want add record to another table. Any one know how to do this thing? As an example when user login I want do insert user id and login time to the another table for future reference.

27 Feb
3 months ago

sanjayacloud left a reply on Method Not Allowed When Delete Record In Laravel

@LINDSTROM - You are correct. It's my mistake.

sanjayacloud started a new conversation Method Not Allowed When Delete Record In Laravel

Hello Friends,

I have got some error "Method not allowed " when delete record. My Delete method like this,

 public function destroy(Request $request, $id)
    {
        $data = Product::findOrFail($id);
        $data->delete();
        return redirect('/product/index');
    }

And my for like below,

<form action=""{{url('product/destroy/'.$row->id)}} method="post">
                                                    @csrf
                                                    <button type="submit" class="btn btn-outline-danger btn-block">Delete</button>
                                                </form>

My route like this,

   Route::post('/product/destroy/{id}','[email protected]');

Any one have any idea about this error?

25 Feb
3 months ago

sanjayacloud started a new conversation How Do Access-control-allow-origin For Api In Laravel 5.7

Hi Every one,

I am trying to develop a api for my flutter mobile app using laravel. Can I know how to do a access-control-allow-origin for api in laraavel?

11 Feb
4 months ago
07 Feb
4 months ago

sanjayacloud started a new conversation Send Email Using Notification In Laravel 5.4

Hello Friend,

I am trying to send an email to user when user submit a contact form. But I have got "Call to a member function notify() on string" Error. Any one know, How can i fix this issue.

This is my Contact form function.

    public function contactStore(Request $request){
        $validator = Validator::make($request->all(), [
            'name' => 'required',
            'email' => 'required',
            'subject' => 'required',
            'message' => 'required'
        ]);
        if ($validator->fails()) {
            return redirect('contact')
                ->withErrors($validator)
                ->withInput();
        }
        $data = new Contact;
        $data['name'] = $request->name;
        $data['email'] = $request->email;
        $data['subject'] = $request->subject;
        $data['message'] = $request->message;
        $data['emailCopy'] = $request->emailCopy;
        $emailSend = $request->emailCopy;

        $email = array(
            'name' => $request->name,
            'email' => $request->email,
            'subject' => $request->subject,
            'message' => $request->message,
            'emailCopy' =>$request->emailCopy,
        );
        $emailSend->notify(new CustomerNotification($email));
        $data->save();
        return redirect('contact');

    }

And this my notification class.

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class CustomerNotification extends Notification
{
    use Queueable;

    public $name;
    public $email;
    public $subject;
    public $message;
    public $emailCopy;

    
    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($name, $email, $subject, $message, $emailCopy)
    {
        $this->name   = $name;
        $this->email = $email;
        $this->subject = $subject;
        $this->message = $message;
        $this->emailCopy = $emailCopy;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)->subject('Get a Free Sample Pack Today')->markdown('mail.customer-notification', [
            'name' => $this->name,
            'email'   => $this->email,
            'subject'   => $this->subject,
            'message'   => $this->message
        ]);
    }

}

And finally, this is my model.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;

class Contact extends Model
{
    use Notifiable;
    protected $fillable = ['name', 'email', 'subject', 'message', 'emailCopy'];
}


30 Jan
4 months ago

sanjayacloud left a reply on How To Insert Date Into Table In Laravel

@CRONIX - Actually, I am trying to insert course start date. Any way, I have sorted it now. Thank you guys for your support.

sanjayacloud left a reply on How To Insert Date Into Table In Laravel

@CRONIX - Yes It's same in my form input name attribute.

sanjayacloud started a new conversation How To Insert Date Into Table In Laravel

Hello,

I am trying to insert course date what I choose from my form to table. But there is no data inserted in my course_date column. My controller is like below.

    public function store(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'title' => 'required|max:255',
            'description' => 'required',
            ''
        ]);

        if ($validator->fails()) {
            return redirect('courses/create')
                ->withErrors($validator)
                ->withInput();
        }

        $image= $request->file('feature_image');
        $image_path = Image::make($image);
        $set_img_path = time().$image->getClientOriginalName();
        $image_path->save( public_path().'/images/course/'.$set_img_path);

        $data = new Courses;

        $now = date('Y-m-d H:i'); //Fomat Date and time
        $now = $request->couese_date;
        
        $data['title'] = $request->title;
        $data['description'] = $request->description;
        $data['course_date'] = $now;
        $data['feature_image'] = $set_img_path;
        $data->save();
        return back()->with('status', 'Course Successfully Added');

    }

Here is my model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Courses extends Model
{
    protected $fillable = ['title', 'description', 'feature_image', 'course_date'];
}

Any one can help me to fix this?

29 Jan
4 months ago

sanjayacloud left a reply on Permission Denied When Delete Image From File Path

@JAWELO - I am in windows. Not the linux OS

sanjayacloud started a new conversation Permission Denied When Delete Image From File Path

Hi Friends,

I am trying to delete a uploaded image file from path in laravel 5.4. But when I trying to delete it I have got following error.

"unlink(E:\xampp\htdocs\project-path\public/images/pages/): Permission denied"

My controller like this

  public function destroy(Request $request, $id)
    {
        $id = decode($id);
        $img =  $request->imgValue;
        $Path = public_path().'/images/pages/'.$img;
       // fclose($Path);
        if(file_exists($Path)){
            unlink($Path);
        }
        if($request->ajax()){

            if(\App\Image::destroy($id)){
                return response()->json(array(
                    'success' => true
                ));
            }
        }else{
            return redirect()->action('[email protected]');
        }

    }

Any one know solution for this error what I got above?

14 Dec
6 months ago

sanjayacloud left a reply on Laravel.log Could Not Be Opened: Failed To Open Stream: Permission Denied

Try this inside your project folder

sudo chown -R $USER:www-data storage sudo chown -R $USER:www-data bootstrap/cache

09 Dec
6 months ago

sanjayacloud left a reply on After Login User, Redirect To Specific Path

@LJLIZARRAGA - What is this hasRole() method?

07 Dec
6 months ago

sanjayacloud left a reply on After Login User, Redirect To Specific Path

@dawgonking not yet. Do you have any idea?

30 Nov
6 months ago

sanjayacloud left a reply on After Login User, Redirect To Specific Path

@DAWGONKING - I have different user level. like user, manager, super admin, how can i handle it?

sanjayacloud started a new conversation After Login User, Redirect To Specific Path

Hello every one. I want redirect when user is login to specific path. Ex: when admin is login I need to redirect /Dashboard. how can I do it.. I try this : https://laravel.com/docs/5.7/authentication. But I fail.. Any one has a any idea.?