Van1310

Van1310

Member Since 1 Year Ago

bhavnagar

Laravel Developer at Byte and Bits At Ahmedabad

Experience Points 24,660
Experience Level 5

340 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 111
Lessons
Completed
Best Reply Awards 10
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.

07 Aug
1 week ago

Van1310 started a new conversation How To Make Online Examination Portal ?

how to make online quiz exam portal

please guys give some suggestion or reference link to i learn

thanks

06 Aug
1 week ago

Van1310 left a reply on How To Get Dynamic Timer Set In Javascript ?

Thanks for reply i will try but cant understand how to do it

please be more explain how can i do it?

Van1310 started a new conversation How To Get Dynamic Timer Set In Javascript ?

I have static script when how can i convert into dynamic value enter and timer set in laravel

blade file

<input type="text" name="timer">

script file

<script>
    var minutes = 0;
    var seconds = 0;
    function startTimer(duration, display) {
            var timer = duration,
            minutes, seconds;
            setInterval(function() {
                minutes = parseInt(timer / 60, {!! $time->toJson() !!});
                seconds = parseInt(timer % 60, 10);

                minutes = minutes < 10 ? "0" + minutes : minutes;
                seconds = seconds < 10 ? "0" + seconds : seconds;

                display.textContent = minutes + ":" + seconds;

                setCookie("minutes", minutes.toString(), 1);
                setCookie("seconds", seconds.toString(), 1);

                if (--timer < 0) {
                timer = 0;
            }
        }, 1000);
}

window.onload = function() {
    var minutes_data = getCookie("minutes");
    var seconds_data = getCookie("seconds");
    var timer_amount = (60*10); //default
    if (!minutes_data || !seconds_data){
        //no cookie found use default
  }
  else{
        timer_amount = parseInt(minutes_data*60)+parseInt(seconds_data)
  }

    var fiveMinutes = timer_amount,
        display = document.querySelector('#time');
        startTimer(fiveMinutes, display); //`enter code here`
};

function setCookie(cname, cvalue, exdays) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays*24*60*60*1000));
        var expires = "expires="+d.toUTCString();
        document.cookie = cname + "=" + cvalue + "; " + expires;
} 

function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1);
        if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
}
return "";
} 

thanks

05 Aug
1 week ago

Van1310 left a reply on Countdown Timer Create In Laravel Using Session ?

i am working on project which has question that expires in specified time so how to implement that in such a way that even if the user refresh the page or press the back button the timer should go on.

thanks

Van1310 started a new conversation Countdown Timer Create In Laravel Using Session ?

how to create timer countdown using session in laravel

01 Aug
2 weeks ago

Van1310 left a reply on How Can I Display Random Option In My Question Every Time?

yes i did this

my controller

public function test()
    {
        $id = Answer::select('question_id')->get();
        $query = Question::whereNotIn('id',$id)->limit(1)->get();

        return view('front.pages.test',compact('query'));
    }

my blade file

@foreach($query->shuffle() as $data)
    {{$data->question}}
@endforeach

@foreach($data->options->shuffle() as $option)
    {{$option->option}}
@endforeach

i can change a option update and store in array so it can possible

thanks @snapey @v

31 Jul
2 weeks ago

Van1310 started a new conversation Property [option1] Does Not Exist On This Collection Instance.

in my controller

public function test()
    {
        $id = Answer::select('question_id')->get();
        $query = Question::whereNotIn('id',$id)
                ->inRandomOrder()->limit(1)->get();
        return view('front.pages.test',compact('query'));
    }

in my blade file

@foreach($query as $data)
    {{$data->options->option1}}
    {{$data->options->option2}}
    {{$data->options->option3}}
    {{$data->options->option4}}
@endforeach

relationship in question and option table but cant find solution its collection instance error

27 Jul
3 weeks ago

Van1310 left a reply on What Are You Missing?

i miss home food and my lovely girlfriend

Van1310 left a reply on Add Flash Message On Login And Logout

you can try this but first add laracasts flash package

https://github.com/laracasts/flash

public function login(Request $request)
    {
        if(User::loginUser($request->email,$request->password)){
        
                flash('Logged In')->success();
                return \Redirect::route('dashboard');
        }
        else{
                flash('Password Or Email Incorrect')->error();
                return redirect()->back();
        }
    }

public function logout(Request $request)
    {    
          \Auth::logout();
    flash('Logout')->success();
        return \Redirect::route('login');
     }

Van1310 left a reply on How Can I Display Random Option In My Question Every Time?

no @snapey i want all the data so i use get() method so plz tell me how can i do it

so when i use shuffle() in foreach loop so everytime only question shuffle not option suffle so how can i do it

Van1310 left a reply on How Can I Display Random Option In My Question Every Time?

i try this but not working every time question shuffle but my question is everytime option shuffle so dear how can i do this

Van1310 started a new conversation How Can I Display Random Option In My Question Every Time?

i have question in four option so every time page refresh then random option display so how can i do this ?

here is my controller

public function test()
    {
        $answer = Answer::select('id')->get();
        $query = Question::whereNotIn('id',$answer)
                ->inRandomOrder()->limit(1)->get();
        return view('front.pages.test',compact('query'));
    }

here is my blade file

@foreach($query as $data)   
    
    <div>{{$data->question}}</div>
    <div>{{$data->option1}}</div>
    <div>{{$data->option2}}</div>
    <div>{{$data->option3}}</div>
    <div>{{$data->option4}}</div>

@endforeach

18 Jul
4 weeks ago

Van1310 left a reply on Validation.captcha Error When Submit Data

its working i can try last 10 hours then its so simple

thanks buddy

Van1310 left a reply on Validation.captcha Error When Submit Data

try this packages "anhskohbo/no-captcha": "^3.0", but cant work please help me out

17 Jul
1 month ago

Van1310 started a new conversation Validation.captcha Error When Submit Data

when i try to click recaptcha then and submit data then error validation.captcha

here is my blade file

<div class="form-group{{ $errors->has('g-recaptcha-response') ? ' has-error' : '' }}">
        <label class="col-md-4 control-label">Captcha</label>
                <div class="col-md-6">
                            {{-- {!! app('captcha')->display() !!} --}}
                            {!! NoCaptcha::display() !!}
                            @if($errors->has('g-recaptcha-response'))
                           <span class="text-danger" style="color:red">{{$errors->first('g-recaptcha-response')}}   </span>
                            @endif
                   </div>
    </div>

here is my controller file

protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|string|max:255',
            'email' => 'required|string|email|max:255|unique:users',
            'password' => 'required|string|min:6|confirmed',
            'g-recaptcha-response' => 'required|captcha',
        ]);
    }

Van1310 left a reply on In Laravel 2fa Google Authenticator How To Setup ?

that's fine its working i follow this link step by step i am done thanks you so much @slev1n sir

Van1310 left a reply on In Laravel 2fa Google Authenticator How To Setup ?

yes its all working but when i try to enter otp then redirect back otp page

otp blade file {{ csrf_field() }}

controller file

protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            'google2fa_secret' => $data['google2fa_secret'],
        ]);
    }

public function register(Request $request)
    {
        //Validate the incoming request using the already included validator method
        $this->validator($request->all())->validate();

        // Initialise the 2FA class
        $google2fa = app('pragmarx.google2fa');

        // Save the registration data in an array
        $registration_data = $request->all();

        // Add the secret key to the registrationdata
        $registration_data["google2fa_secret"] = $google2fa->generateSecretKey();

        // Save the registration data to the user session for just the next request
        $request->session()->flash('registration_data', $registration_data);

        // Generate the QR image. This is the image the user will scan with their app
        // to set up two factor authentication
        $QR_Image = $google2fa->getQRCodeInline(
            config('app.name'),
            $registration_data['email'],
            $registration_data['google2fa_secret']
        );

        // Pass the QR barcode image to our view
        return view('google2fa.register', ['QR_Image' => $QR_Image, 'secret' =>         $registration_data['google2fa_secret']]);
    }

public function completeRegistration(Request $request)
    {        
        // add the session data back to the request input
        $request->merge(session('registration_data'));

        // Call the default laravel authentication
        return $this->registration($request);
    }

route file

Route::get('/home', '[email protected]')->name('home');
Route::get('/complete-registration', 'Auth\[email protected]')->name('complete-   registration');

Route::post('/2fa', function () {
        return redirect(URL()->previous());
})->name('2fa')->middleware('2fa');

Van1310 left a reply on In Laravel 2fa Google Authenticator How To Setup ?

yes i try this but when i register data then error like

Config (google2fa.php) not found. Have you published it?

Van1310 started a new conversation In Laravel 2fa Google Authenticator How To Setup ?

how to setup or packages use for simple login/registration form using 2fa google authenticator

please suggest me thanks

15 Jul
1 month ago

Van1310 left a reply on Undefined Variable: Mail

@nakov Thank You Sir Its working

Van1310 started a new conversation Undefined Variable: Mail

hii when i try to send mail then undefined variable error in laravl 5.5

here is my controller file

public function round_store(RoundRequest $request,$id)
    {
        $data= array('name'=>'byteandbits');
        $mail = jobapplication::where('id','=',$id)->first();
 
        $query=Round::where('user_id','=',$request->get('user_id'))
                ->where('round_type','=',$request->get('round_type'))->first();
        if(empty($query)){
                $round = Round::store($request);
                \Mail::send('mail.mail', $data, function($message) use($mail){
                    $message->to($mail->users->email)->subject
                        ('Laravel Round Registration');
                    $message->from('[email protected]');
                });
                flash('Round Added')->success();
                return back();
        }
        flash('Choose Valid Round')->error();
        return back();
    }

here is my formated blade file

    <p>Hello Candidate {{$mail->users->name}},</p>
    <p>Welcome to Byte and Bits Team.</p>
    <p> Your Are Selected For {{$mail->round}}.</p>
    <p>Your Timing : {{$mail->date_time}}.</p>
    <p>Report Shrusti Mam at Date and Time.</p>
13 Jul
1 month ago

Van1310 left a reply on Argument 1 Passed To Illuminate\Mail\PendingMail::queue() Must Be An Instance Of Illuminate\Mail\Mailable, Array Given, Called In

i used this

namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Mail\Mailer;

class MailController extends Controller { public function mail() { return view('admin.pages.mail.compose'); }

    public function sendmail(Request $request)
{
        // return $request;
        $email = $request->get('to');
        // return $email;
        $data = [
                'subject' => $request->subject,
                'message' => $request->message,
                'files' => $request->files,
            ];

        \Mail::to($email)->queue(new Mailer($data));
    }

}

Van1310 left a reply on Argument 1 Passed To Illuminate\Mail\PendingMail::queue() Must Be An Instance Of Illuminate\Mail\Mailable, Array Given, Called In

Here is mailer file

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class Mailer extends Mailable
{
    use Queueable, SerializesModels;
    public $data;
    /**
    * Create a new message instance.
    *
    * @return void
    */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
    * Build the message.
    *
    * @return $this
    */
    public function build()
    {
        return $this->subject('$subject')
        ->view('email.mail');
    }
}

Van1310 started a new conversation Argument 1 Passed To Illuminate\Mail\PendingMail::queue() Must Be An Instance Of Illuminate\Mail\Mailable, Array Given, Called In

i try to send mail in laravel 5.7 using queue then also use array value to send mail so then print error like

Argument 1 passed to Illuminate\Mail\PendingMail::queue() must be an instance of Illuminate\Mail\Mailable, array given, called in C:\laragon\www\bulk_emailer\app\Http\Controllers\MailController.php on line 24

so to fix it please help me out !

here is my controller code

public function sendmail(Request $request){
    // return $request;
    $email = $request->get('to');
    // return $email;
    $data = [
        'subject' => $request->subject,
        'message' => $request->message,
        'files' => $request->files,
    ];

    \Mail::to($email)->queue(new Mailer($data));
}
26 Jun
1 month ago

Van1310 left a reply on Call To A Member Function Save() On Array

@KIMA - thanks for reply its working help by @nakov but thanks a lots for helping us @kima

Van1310 left a reply on Call To A Member Function Save() On Array

@NAKOV - yaa its wroking thanks a lot brother i store the value one by one with name and id .

many many time thanks

Van1310 left a reply on Call To A Member Function Save() On Array

@KIMA - thanks for reply its working but whenever i submit data then store only first value all the value are not store so any idea how to do it

Van1310 started a new conversation Call To A Member Function Save() On Array

store a multiple record store in one column so i get error like this

here is my code

public function document_store(Request $request)
    {
        $data=Input::all();
        foreach($data['document'] as $files => $name)
        {
                if(!empty($name))
                {                           
                    $picName=$files . '.' . $name->getClientOriginalExtension();
                    $name->move(base_path() . '/public/training/document/'.$data['user_id'].'/',$picName);                

                    $document[] = new Document(array(
                        'user_id'=>$request->get('user_id'),
                        'doc_type' => $files,
                        'doc_path' => $picName,
                    ));
                    $document->save();
                    flash('Document Submited')->success();            
                    return \Redirect::back();                   
                }            
        }          
        // return $document; 
    }
24 Jun
1 month ago

Van1310 left a reply on Citywise Job Print Dropdown In Laravel

@JOHNBRAUN - Thanks For Reply I can try it

21 Jun
1 month ago

Van1310 started a new conversation Citywise Job Print Dropdown In Laravel

i have 2 dropdown first is city next one is job

when i click city then print citywise job print

for example click new york then open only newyork city job

so how to do it give me suggestion or examples how to learn it

thanks

20 Jun
1 month ago

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@JAY_CHAUHAN - Thank You Bro You Are Such A Camp, Rockstar Or Many More

Its Totally Working Thanks A Lot............

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@JAY_CHAUHAN - nothing error i just click my dropdown then cant update my status value so can you suggest some better solution

19 Jun
1 month ago

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@PEACENGARA - i am using localhost so how to share my code

here is i try this

blade file

<select class="form-control m-input" id="status" name="status">
        <option value="underprocess" >Under Process</option>
           <option value="reject">Reject</option>
        <option value="clear">Clear</option><br>
</select>

javascript file

<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script>
        $(document).ready(function(){
        $('select').live('change',function () {
                var statusVal = $(this).val();
                alert(statusVal);
                $.ajax({
                    type: "POST",
                    url: "round/update",
                    data: {statusType : statusVal },
                    success: function(msg) {
                        $('#autosavenotify').text(msg);
                    }
                })
        });
    });
</script>

route file

Route::post('round/update               /{id}',array('as'=>'round.edit','uses'=>'Admin\[email protected]_update'));

controller file

public function status_update(Request $request,$id)
    {
        \DB::table('rounds')
                ->where('id','=',$id)
                ->update([   
                    'status'=>$request->get('status')]);
                flash('Status Updated')->success();                        
                return back();
    }

please help me

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@SERGIU17 - i cant understand this packages please suggest me some other way to i do it

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@SERGIU17 - not work i try this

<select class="form-control m-input" id="update" name="status">
        <option value="underprocess">Under Process</option>
        <option value="reject">Reject</option>
        <option value="clear">Clear</option>
</select>

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

<script>
        document.querySelector('#update').addEventListener('change', function (e) {
        axios.patch('round/update/', {
            value: this.value
        })
    });
</script>

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@VANDAN29 - yes i try in ajax but i m new in ajax so i cant uderstand how it work please help me out

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@PEACENGARA - thanks for reply but cant work i am new in ajax so can be more explain

here is my code

blade file

<select class="form-control m-input" id="#update" name="status">
        <option value="underprocess">Under Process</option>
           <option value="reject">Reject</option>
           <option value="clear">Clear</option>
</select>

Ajax code

<script>
        function dropdownUpdate() {
        $('#update').on('change', function(e) {
                e.preventDefault();             
                axios({
                    method: 'post',
                    url: 'round/update/{id}',
                    data: {
                            status: 'status'
                    }
                });
        }
</script>

Van1310 left a reply on Ajax Autosave Selection Without Submit Button

@SERGIU17 - No i am using laravel simple select drop down

Van1310 started a new conversation Ajax Autosave Selection Without Submit Button

suppose i click dropdown value then automatically value store in database without page refresh or submit button

please help me

14 Jun
2 months ago

Van1310 left a reply on Login With Linkedin Using Socialite

@JAY_CHAUHAN - @jay_chauhan i try this two link then i post my error i will print error in above please help me out

13 Jun
2 months ago

Van1310 left a reply on If Condition Cant Work

@MVD - Thanks @mvd its working

Van1310 left a reply on If Condition Cant Work

@MVD - yes i try this but i have record which in inserted value="basic" so now i try this

@if(empty($interviewschedule)) 
    Data empty
@elseif($interviewschedule == "basic")
        Has Basic Data
@else
        False
@endif

but everytime its excute else condtion actually is run ifelse but run else so how the fix it

Van1310 started a new conversation If Condition Cant Work

i try to check if round_type field has data then condtion move on else if but cant work

here is my controller

public function view($id)
{
    $user=User::where('role','=','user')->first();
    $interviewschedule = Interviewschedule::where('user_id','=',$user->id)->pluck('round_type');
    return view('admin.pages.interviewschedule',compact('interviewschedule','user'));
}

blade file

@if(empty($interviewschedule->round_type)) 
    Data empty
@elseif($interviewschedule->round_type="basic")
    Has Basic Data
@else
    False
@endif

when try to condtion i have basic record in my field round_type but cant work elseif condtion every time is if condtion check

11 Jun
2 months ago

Van1310 left a reply on Login With Linkedin Using Socialite

@DIPAKRATANIAGILE - i dont know how to check it plz suggest me