asad98iftikhar

asad98iftikhar

Member Since 1 Year Ago

karachi

Web Developer at Qubolt

Experience Points 1,220
Experience Level 1

3,780 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 0
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 Mar
2 months ago

asad98iftikhar started a new conversation How To Use A Dynamic Global Variable Outside The Function In Vue.js

This is my Variable fromNode i want to console.log it outside the function in the same way

const lines=this.scene.links.map((link)=>{ const fromNode=this.findNodeWithID(link.from); return fromNode; }) console.log(fromNode+'I am on Node');

I cannot console.log it outside the Mapping function how can i achieve this is in the Same WayThis is my Variable fromNode i want to console.log it outside the function in the same way

23 Feb
3 months ago

asad98iftikhar started a new conversation RedirectifAuthenticated Not Working Properly Laravel

This is my RedirectifAuthenticated.php

Every time i try to login with role_id==2 it redirect me to 127.0.0.1:8000/large/dashboard Please Guide me through this and help me with this

 if (Auth::guard($guard)->check() && Auth::user()->role->role_id == 1) {
        return redirect()->route('large.dashboard');
    }else
        {
        return $next($request);
    }
    
    if (Auth::guard($guard)->check() && Auth::user()->role->role_id == 2) {
        return redirect()->route('medium.dashboard');
    }else
        {
        return $next($request);
    }

    if (Auth::guard($guard)->check() && Auth::user()->role->role_id == 3) {
        return redirect()->route('small.dashboard');
    }else
        {
        return $next($request);
    }

This is my LoginController.php

     if(Auth::check() && Auth::user()->role->role_id == 1){
        $this->redirectTo=route('large.dashboard');
    }
    $this->middleware('guest')->except('logout');


    if(Auth::check() && Auth::user()->role->role_id == 2){
        $this->redirectTo=route('medium.dashboard');
    }
    $this->middleware('guest')->except('logout');


    if(Auth::check() && Auth::user()->role->role_id == 3){
        $this->redirectTo=route('small.dashboard');
    }
    $this->middleware('guest')->except('logout');

}

22 Feb
3 months ago

asad98iftikhar started a new conversation Argument 1 Passed To Illuminate\Auth\SessionGuard::login() Must Implement Interface Illuminate\Contracts\Auth\Authenticatable, Instance Of App\role Given

I am creating a field in different table from the RegisterController

This is mine controller function

           $user =  User::create([
               'name' => $data['name'],
                       'email' => $data['email'],
             'role_id'=>$data['role_id'],
             'password' => Hash::make($data['password']),
      
         ]);
    return role::create([
        'role_id' => $user->role_id,
   ]);
17 Feb
3 months ago

asad98iftikhar started a new conversation SQLSTATE[HY000]: General Error: 1364 Field 'gsuppliers' Doesn't Have A Default Value (SQL: Insert Into `gdistributors` (`name`, `slug`, `cnic`, `email`, `phone`, `image`, `user_id`, `updated_at`, `created_at`) Values (Testing, Testing, 21, [email protected]

This is mine gdistributor model relationship with gsupplier has Many To Many Relationships

This is gdistributor Model

        public function gsuppliers(){
                return $this->belongsToMany('App\gsupplier')->withTimestamps();
        }

this is gsupplier Model

                public function gdistributors(){
                       return $this->belongsToMany('App\gdistributor')->withTimestamps();
                 }

This is mine Database

                $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->string('name');
            $table->string('slug');
            $table->string('cnic');
            $table->string('email')->unique();
            $table->string('phone');
            $table->string('gsuppliers');
            $table->string('gmanufacturers');
            $table->string('gunmanufacturers');
            $table->boolean('status')->default(false);
            $table->string('image');
            $table->foreign('user_id')
            ->references('id')
            ->on('users')
            ->onDelete('cascade');
            $table->timestamps();

This is the Result when i do The $request->all()

{"_token":"wZB8f87iaUDvTH47BomxvIfpSi16dCcIYn82YWcl","name":"Testing","cnic":"2","email":"[email protected]","phone":"2","suppliers":["1"],"manufacturers":["1"],"unmanufacturers":["1"],"image":{}}

In the Result i got the Suppliers but when i am filling the form supplier field required

$distributor->save();

    $distributor->gsuppliers()->attach($request->suppliers);

This is how i am saving it in the database i have Created another table for gdistributor_gsupplier_table

having these fields

    $table->integer('gdistributor_id');
        $table->integer('gsupplier_id');

Please Help me with thiss PLEASE THANKS IN ADVANCE Friends

29 Oct
6 months ago

asad98iftikhar left a reply on POST Https://api.stripe.com/v1/tokens 402

@cronix it worked bro the issue was that i am entering the Month wrong in mine Form

asad98iftikhar left a reply on POST Https://api.stripe.com/v1/tokens 402

@Cronix I am using V2 of the Stripe donot know why it's showing the v1 error

asad98iftikhar left a reply on POST Https://api.stripe.com/v1/tokens 402

@Cronix yes i have put *Stripe in VerifyCSRFToken.php

asad98iftikhar left a reply on POST Https://api.stripe.com/v1/tokens 402

i am showing you all the response 1 minute

asad98iftikhar started a new conversation POST Https://api.stripe.com/v1/tokens 402

This is mine PlanCotroller * @param Request $request * @return \Illuminate\Http\RedirectResponse */ public function subscribe(Request $request){ //Validate request $this->validate( $request, [ 'stripeToken' => 'required', 'plan' => 'required' ]); // User chosen plan $pickedPlan = $request->get('plan'); // Current logged in user $me = Auth::user(); try { // check already subscribed and if already subscribed with picked plan if( $me->subscribed('main') && ! $me->subscribedToPlan($pickedPlan, 'main') ) { // swap if different plan attempt $me->subscription('main')->swap($pickedPlan); } else { // Its new subscription // if user has a coupon, create new subscription with coupon applied if( $coupon = $request->get('coupon') ) {

                $me->newSubscription( 'main', $pickedPlan)
                    ->withCoupon($coupon)
                    ->create($request->get('stripeToken'), [
                        'email' => $me->email
                    ]);

            } else {

                // Create subscription
                $me->newSubscription( 'main', $pickedPlan)->create($request->get('stripeToken'), [
                    'email' => $me->email,
                    'description' => $me->name
                ]);
            }

        }
    } catch (\Exception $e) {
        // Catch any error from Stripe API request and show
       return redirect()->back()->withErrors(['status' => $e->getMessage()]);
    }
    return redirect()->route('home')->with('status', 'You are now subscribed to ' . $pickedPlan . ' plan.');
}

This is mine Plan.blade.php

    Stripe.setPublishableKey("{{ config('services.stripe.key') }}");

    $(function() {
        var $form = $('#payment-form');
        $form.submit(function(event) {
            // Disable the submit button to prevent repeated clicks:
            $form.find('.submit').prop('disabled', true);

            // Request a token from Stripe:
            Stripe.card.createToken($form, stripeResponseHandler);

            // Prevent the form from being submitted:
            return false;
        });
    });

    function stripeResponseHandler(status, response) {
        // Grab the form:
        var $form = $('#payment-form');

        if (response.error) { // Problem!

            // Show the errors on the form:
            $form.find('.payment-errors').text(response.error.message);
            $form.find('.submit').prop('disabled', false); // Re-enable submission

        } else { // Token was created!

            // Get the token ID:
            var token = response.id;

            // Insert the token ID into the form so it gets submitted to the server:
            $form.append($('<input type="hidden" name="stripeToken">').val(token));

            // Submit the form:
            $form.get(0).submit();
        }
    };
</script>

@endsection

24 Oct
7 months ago

asad98iftikhar left a reply on Call To Undefined Method App\Plan::findOrFail()

the reason is that i am using stripe functions

asad98iftikhar started a new conversation Call To Undefined Method App\Plan::findOrFail()

This is mine model of plan

        use Illuminate\Support\Facades\Cache;
        use Stripe\Stripe;

        // class Plan extends Model
            class Plan
                {
                   public static function getStripePlans(){
                     //Set the API Key
                        Stripe::setApiKey(User::getStripeKey());

                    try{
                     //Fetch all the plans and fetch it
                  return Cache::remember('stripe.plans', 60*24, function () {
                      return \Stripe\Plan::all()->data;
               });
               }
        catch(\Exception $e){
                  return false;
            }
     }
    }

This is mine Controller public function show($id){ //Get the plan id from the cache // $plan=$this->getPlanByIdOrFail($id); $plans=Plan::findOrFail($id); return view('plan',compact('plan')); }

asad98iftikhar started a new conversation What Is The Purpose Of Param Request

Why we write these things in laravel /** * Handle subscription request * * @param Request $request * @return \Illuminate\Http\RedirectResponse */

06 Oct
7 months ago

asad98iftikhar left a reply on Laravel Prefix Route Problem

The Reason i was getting this error was that in my as it is 'as'=>'admin' but it should be 'as'=>'admin.'

asad98iftikhar started a new conversation Laravel Prefix Route Problem

this is mine Web.php Route::group(['as'=>'admin', 'prefix' => 'admin', 'namespace'=>'Admin', 'middleware'=>['auth','admin']], function () {

        Route::get('dashboard','[email protected]')->name('dashboard');

        });

This is mine Route its need to gave me this Output when i should run php artisan r:l admin.dashboard | App\Http\Controllers\Admin\[email protected]

But its gaving me this Result

     admindashboard   | App\Http\Controllers\Admin\[email protected]

asad98iftikhar started a new conversation Admin/dashboard Not Defined On Redirectif Authenticated Route Error On Lcoalhost\login

This is mine RedirectifAuthenticated.php code

When i am Manually going to localhost/admin/dashbaord then its accessible after logging in if i remove this code but when i am writting this code then its not accessible

public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->check() && Auth::user()->role->id == 1) { return redirect()->route('admin.dashboard'); }elseif(Auth::guard($guard)->check() && Auth::user()->role->id == 2){ return redirect()->route('user.dashboard'); }else { return $next($request); } } } I have this code its gaving Error that route admin.dashboard not defined if i Mnaually go to route admin.dashbaord then its Accessible

l

01 Oct
7 months ago

asad98iftikhar started a new conversation Jquery Not Defined

This is my console result to check which version of Jquery is running but it gaves the error jquery not defined i check it using

$.fn.jquery and it gaves this result "1.12.4"

https://gyazo.com/120be8752e122ce1de488434a28bc49c

This is mine Jquery

<script src="{{asset('assets/backend/plugins/jquery/jquery.min.js')}}"></script>

<!-- Bootstrap Core Js -->
<script src="{{asset('assets/backend/plugins/bootstrap/js/bootstrap.js')}}"></script>

<!-- Select Plugin Js -->
{{--  <script src="{{asset('assets/backend/plugins/bootstrap-select/js/bootstrap-select.js')}}"></script>  --}}

<!-- Slimscroll Plugin Js -->
<script src="{{asset('assets/backend/plugins/jquery-slimscroll/jquery.slimscroll.js')}}"></script>

<!-- Waves Effect Plugin Js -->
<script src="{{asset('assets/backend/plugins/node-waves/waves.js')}}"></script>
26 Sep
7 months ago

asad98iftikhar started a new conversation I Have Three User Registration Form I Want To Make One Form And Play With Id If Id==1 Then This

I have to make One form in which three different types of user can be registered on single database then how can i manage to pass the

127.0.0.1:8000/register/1

Is this possible so how can i do this

asad98iftikhar left a reply on Splice Method Issue

whats the second parameter should be to delete @Digitalized i want to delete one item which is this.current_event

20 Sep
8 months ago

asad98iftikhar started a new conversation Splice Method Issue

I am deleting an element from an array

    this.my_events.splice(this.current_event);
            this.current_event=null;
            this.old_event=null;
            jQuery('#eventModal').modal('hide');

When i Add Three or More Items in an Array and then Delete any ONE from them it Delete all the items and return Null without refreshing the page i am using Vue.js

If i then refresh the page then the Two elements are shown whats this issue i am begineer with Javascript this help would be usefull

19 Sep
8 months ago

asad98iftikhar started a new conversation How To Create Symlink From /public/webmail To /packages/Rkesa/Email/vendor/afterlogic_webmail/

I am using windows in liunix automatically it generates this i don't have any knowledge about this Please Help me with this

asad98iftikhar started a new conversation How To Create Create Symlink From /public/webmail To /packages/Rkesa/Email/vendor/afterlogic_webmail/

I am using Windows in Liunix mine boss says it automatically creates the file can anyone help me with this it will be helpfull

The problem is that windows doenst support symbolic links, but linux does

This is mine public folder https://gyazo.com/3bdc5bd5cfc1ed16f2ecafa7858ac110

This is mine

28 Aug
8 months ago
07 Aug
9 months ago

asad98iftikhar started a new conversation After Payment Url Problem Because Of The Function

After payment returning the Welcome view from payment function with above id its going there but the path is something like this

http://127.0.0.1:8000/payment/17

But it should return

http://127.0.0.1:8000

14 Apr
1 year ago

asad98iftikhar left a reply on Sequelize Error Who To Insert Data In Database Using Sequalize

else{ Page.findOne({slug:slug},function(err,page){ if(page){ req.flash('danger','Page slug Already Exist,'); res.render('admin/add_page',{

        title:title,
        slug:slug,
        content:content
      });
    }
    else{
        var page=new Page({
          title:title,
          slug:slug,
          content:content,
          sorting:0
        });
        page.save(function(err){
          if(err) return console.log(err);

          req.flash('success','Page Added Successfully!!');
          res.redirect('/admin/pages');
        });
    }

asad98iftikhar started a new conversation Sequelize Error Who To Insert Data In Database Using Sequalize

/POST ADD page router.post('/add-page',function(req,res){

req.checkBody('title','Title must have a body.').notEmpty(); req.checkBody('content','Content must have a body.').notEmpty();

var title=req.body.title; var slug=req.body.slug.replace(/\s+/g, '-').toLowerCase(); if(slug==" ")slug=title.replace(/\s+/g, '-').toLowerCase();

var content=req.body.content;

var errors=req.validationErrors();

if(errors){ res.render('admin/add_page',{ errors:errors, title:title, slug:slug, content:content }); }

asad98iftikhar left a reply on Seqequalize Error Can Anyone Please Tell Me How To Insert Into Database Using Form In Node

@rin4ik i don't how to enter the code and it will get screen shot of the code

asad98iftikhar left a reply on Sequqlize How To Insert Data In Sequelize Using Node I Have Done Almost Every Thing But Still Getting Error

//POST ADD page router.post('/add-page',function(req,res){

req.checkBody('title','Title must have a body.').notEmpty(); req.checkBody('content','Content must have a body.').notEmpty();

var title=req.body.title; var slug=req.body.slug.replace(/\s+/g, '-').toLowerCase(); if(slug==" ")slug=title.replace(/\s+/g, '-').toLowerCase();

var content=req.body.content;

var errors=req.validationErrors();

if(errors){ res.render('admin/add_page',{ errors:errors, title:title, slug:slug, content:content }); }

asad98iftikhar started a new conversation Sequqlize How To Insert Data In Sequelize Using Node I Have Done Almost Every Thing But Still Getting Error

//POST ADD page router.post('/add-page',function(req,res){

req.checkBody('title','Title must have a body.').notEmpty(); req.checkBody('content','Content must have a body.').notEmpty();

var title=req.body.title; var slug=req.body.slug.replace(/\s+/g, '-').toLowerCase(); if(slug==" ")slug=title.replace(/\s+/g, '-').toLowerCase();

var content=req.body.content;

var errors=req.validationErrors();

if(errors){ res.render('admin/add_page',{ errors:errors, title:title, slug:slug, content:content }); } else{ Page.findOne({slug:slug},function(err,page){ if(page){ req.flash('danger','Page slug Already Exist,'); res.render('admin/add_page',{

        title:title,
        slug:slug,
        content:content
      });
    }
    else{
        var page=new Page({
          title:title,
          slug:slug,
          content:content,
          sorting:0
        });









        page.save(function(err){
          if(err) return console.log(err);

          req.flash('success','Page Added Successfully!!');
          res.redirect('/admin/pages');
        });
    }

asad98iftikhar left a reply on Seqequalize Error Can Anyone Please Tell Me How To Insert Into Database Using Form In Node

var express=require('express'); var router=express.Router(); var expressValidator = require('express-validator'); var bodyParser=require('body-parser'); var mysql=require('mysql');

//Get Page model var Page=require('../models/page');

/*

  • GET PAGES INDEX */

router.get('/',function(req,res){ res.send('admin area'); }); router.get('/admin/dashboard',function(req,res){ res.render('admin/dashboard'); });

/* ** GET ADD PAGE */ router.get('/add-page',function(req,res){ var title=""; var slug=""; var content="";

res.render('admin/add_page',{ title:title, slug:slug, content:content

}); });

//POST ADD page router.post('/add-page',function(req,res){

req.checkBody('title','Title must have a body.').notEmpty(); req.checkBody('content','Content must have a body.').notEmpty();

var title=req.body.title; var slug=req.body.slug.replace(/\s+/g, '-').toLowerCase(); if(slug==" ")slug=title.replace(/\s+/g, '-').toLowerCase();

var content=req.body.content;

var errors=req.validationErrors();

if(errors){ res.render('admin/add_page',{ errors:errors, title:title, slug:slug, content:content }); } else{ Page.findOne({slug:slug},function(err,page){ if(page){ req.flash('danger','Page slug Already Exist,'); res.render('admin/add_page',{

        title:title,
        slug:slug,
        content:content
      });
    }
    else{
        var page=new Page({
          title:title,
          slug:slug,
          content:content,
          sorting:0
        });
        page.save(function(err){
          if(err) return console.log(err);

          req.flash('success','Page Added Successfully!!');
          res.redirect('/admin/pages');
        });
    }
  });

}

}); //Exports module.exports=router;

asad98iftikhar started a new conversation Seqequalize Error Can Anyone Please Tell Me How To Insert Into Database Using Form In Node

var express=require('express'); var router=express.Router(); var expressValidator = require('express-validator'); var bodyParser=require('body-parser');

//Get Page model var Page=require('../models/page');

/*

  • GET PAGES INDEX */

router.get('/',function(req,res){ res.send('admin area'); }); router.get('/admin/dashboard',function(req,res){ res.render('admin/dashboard'); });

/* ** GET ADD PAGE */ router.get('/add-page',function(req,res){ var title=""; var slug=""; var content="";

res.render('admin/add_page',{ title:title, slug:slug, content:content

}); }); //POST ADD page router.post('/add-page',function(req,res){

req.checkBody('title','Title must have a body.').notEmpty(); req.checkBody('content','Content must have a body.').notEmpty();

var title=req.body.title; var slug=req.body.slug.replace(/ \s+/g, '-').toLowerCase(); if(slug==" ")slug=title.replace(/ \s+/g, '-').toLowerCase();

var content=req.body.content;

var errors=req.validationErrors();

if(errors){ res.render('admin/add_page',{ errors:errors, title:title, slug:slug, content:content }); } else{ Page.findOne({slug:slug},function(err,page){ if(page){ req.flash('danger','Page slug Already Exist,'); res.render('admin/add_page',{

        title:title,
        slug:slug,
        content:content
      });
    }
    else{
        var Page=new Page({
          title:title,
          slug:slug,
          content:content,
          sorting:0
        });
        page.save(function(err){
          if(err) return console.log(err);

          req.flash('success','Page Added Successfully!!');
          res.redirect('/admin/pages');
        });
    }
  });

}

}); //Exports module.exports=router;

//This is my admin_page

'use strict'; module.exports = (sequelize, DataTypes) => { var page = sequelize.define('page', { title: DataTypes.STRING, slug: DataTypes.STRING, content: DataTypes.STRING, sorting:DataTypes.INTEGER }, {}); page.associate = function(models) { // associations can be defined here }; return page; };

//This is my Page Model

{ "name": "gaffercart", "version": "1.0.0", "description": "\u001b[A\u001b[A\u001b[B\u001b[BE-Commerce shopping Cart Made By Gaffer", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "body": "^5.1.0", "connect-flash": "^0.1.1", "ejs": "^2.5.8", "express": "^4.16.3", "express-messages": "^1.0.1", "express-session": "^1.15.6", "express-validator": "^5.1.2", "mustache-express": "^1.2.5", "mysql": "^2.15.0", "mysql2": "^1.5.3", "pg": "^7.4.1", "sequelize": "^4.37.6", "sequelize-cli": "^4.0.0", "sequelize-handlers": "^1.0.6" } }

//This is my Package.json

07 Apr
1 year ago

asad98iftikhar started a new conversation Class 'App\Http\Controllers\Slider' Not Found In HomeController.php (line 24)

use App\Slider; use Carbon\Carbon; use Illuminate\Http\Request; use App\Http\Controllers\Controller;

//This is mine SiderController

This is mine ERror

Route::get('/', '[email protected]')->name('welcome');

Auth::routes();

Route::group(['prefix'=>'admin','middleware'=>'auth','namespace'=>'admin'],function(){ Route::get('dashboard','[email protected]')->name('admin.dashboard'); Route::resource('slider','SliderController');

//This is my Web.php

asad98iftikhar started a new conversation Class 'App\Http\Controllers\Slider' Not Found In HomeController.php (line 24)

use App\Slider; use Carbon\Carbon; use Illuminate\Http\Request; use App\Http\Controllers\Controller;

This is my SliderController

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller { /** * Create a new controller instance. * * @return void */

/**
 * Show the application dashboard.
 *
 * @return \Illuminate\Http\Response
 */

public function index()
{
    $sliders=Slider::all();
   return view('welcome',compact('sliders'));
}

}

05 Apr
1 year ago

asad98iftikhar left a reply on TokenMismatchException In VerifyCsrfToken.php Line 68:

If it is occuring in the Form then it will appearing due to the Version problem you have Write the Code of Laravel 5.6 but your Composer Support 5.4 or some different version try to go on Laravel official Website it will help you Help me!!