tanveerkhanwd

tanveerkhanwd

Member Since 1 Year Ago

Experience Points
5,710
Total
Experience

4,290 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
27
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 2
5,710 XP
Oct
07
1 month ago
Activity icon

Replied to View Render Returns Undefined Variable

$user = auth()->user(); return view('users.edit', compact('user'));

Aug
29
2 months ago
Activity icon

Replied to How To Store Images ?

problem is when i stored it gives me error that image does not have a default value

Activity icon

Replied to How To Store Images ?

nothing problem with the storage i just want wright way to store data using

protected  $fillable =[ --all fields--  ];

and  

//This is not correct way to store i just want correct way

$aCart = $request->all();
        if (isset($aCart) && count($aCart)>0) {
            $aCart->images = $aVals;
            $aCart->Cart::create($aCart);
Activity icon

Replied to How To Store Images ?

hii

here is my controller :

        if($request->hasFile('images')){            
            $images = array();
            foreach ($request->file('images') as $image) {

                $filenamewithextension = $image->getClientOriginalName();
         
                $filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);
         
                $extension = $image->getClientOriginalExtension();
         
                $filenameorignaltostore = $filename.'_'.time().'.'.$extension;
                $filenamethumbtostore = 'thumb_'.$filename.'_'.time().'.'.$extension;

                $images[] = $filenameorignaltostore;
                $image->move(public_path('/uploads/orignal'), $filenameorignaltostore);

                $oldPath = public_path('uploads/orignal/'.$filenameorignaltostore);
                $newPath = public_path('uploads/thumbnail/'.$filenamethumbtostore);
                                    

                if (\File::copy($oldPath , $newPath)) {     
                    $aryNewImage[]=$filenameorignaltostore;
                }

                //Resize image here
                $thumbnailpath = public_path('uploads/thumbnail/'.$filenamethumbtostore);
               
                $img =  Image::make($thumbnailpath)->fit(245, 239, function($constraint){
                            $constraint->upsize();
                        })->save($thumbnailpath);               
                
            }  

            $aVals =json_encode($images);   

        } else{
            $aVals = '';
        }
        /*===== Upload multiple images =======*/
        $aCart = $request->all();
        if (isset($aCart) && count($aCart)>0) {
            $aCart->images = $aVals;
            $aCart->Cart::create($aCart);
            return response()->json(['msg'=>"Item added successfull", 'data'=>$input , 'status'=>true]);
        }else{
            return response()->json(['msg'=>"Something wrong please try again", 'data'=>null , 'status'=>false]);
        }

    }
Activity icon

Replied to How To Store Images ?

my code:

model:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Cart extends Model
{
    protected $fillable = ['product_id','size_id','user_id','price'];
    /*Product Size Info*/
    public function productSize()
    {
        return $this->belongsTo(ImageSize::class, 'size_id');
    }

    /*Single Product Deatails*/
    public function productDet()
    {
        return $this->belongsTo(Product::class, 'product_id');
    }
}




controller:

public function addCart(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'images.*' => 'required',               
            'product_id' => 'required',               
            'user_id' => 'required',
            'size_id' => 'required',
            'price' => 'required',
        ]);
        $aResponse = array();
        if ($validator->fails()) {
            if ($validator->errors()->first('subject')) {
                $aResponse['msg']=$validator->errors()->first('subject');
                $aResponse['data']=null;
                $aResponse['status']=false;
            }
            if ($validator->errors()->first('description')) {
                $aResponse['msg']=$validator->errors()->first('description');
                $aResponse['data']=null;
                $aResponse['status']=false;
            }
            if ($validator->errors()->first('user_id')) {
                $aResponse['msg']=$validator->errors()->first('user_id');
                $aResponse['data']=null;
                $aResponse['status']=false;
            }
        return response()->json($aResponse);
        }

        /*===== Upload multiple images =======*/
        if($request->hasFile('images')){            
            $images = array();
            foreach ($request->file('images') as $image) {

                $filenamewithextension = $image->getClientOriginalName();
         
                $filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);
         
                $extension = $image->getClientOriginalExtension();
         
                $filenameorignaltostore = $filename.'_'.time().'.'.$extension;
                $filenamethumbtostore = 'thumb_'.$filename.'_'.time().'.'.$extension;

                $images[] = $filenameorignaltostore;
                $image->move(public_path('/uploads/orignal'), $filenameorignaltostore);

                $oldPath = public_path('uploads/orignal/'.$filenameorignaltostore);
                $newPath = public_path('uploads/thumbnail/'.$filenamethumbtostore);
                                    

                if (\File::copy($oldPath , $newPath)) {     
                    $aryNewImage[]=$filenameorignaltostore;
                }

                //Resize image here
                $thumbnailpath = public_path('uploads/thumbnail/'.$filenamethumbtostore);
               
                $img =  Image::make($thumbnailpath)->fit(245, 239, function($constraint){
                            $constraint->upsize();
                        })->save($thumbnailpath);               
                
            }  

            $aVals =json_encode($images);   

        } else{
            $aVals = '';
        }
        /*===== Upload multiple images =======*/
        $input = $request->all();
        if (isset($input) && count($input)>0) {
            $aCart = new Cart;
            $aCart->images = $aVals;
            $aCart->product_id = $request->product_id;
            $aCart->user_id = $request->user_id;
            $aCart->size_id = $request->size_id;
            $aCart->price = $request->price;
            $aCart->save();
            return response()->json(['msg'=>"Item added successfull", 'data'=>$aCart , 'status'=>true]);
        }else{
            return response()->json(['msg'=>"Something wrong please try again", 'data'=>null , 'status'=>false]);
        }

    }





I just want to store data in my database using method protected fillable but 

i don't want to use save method 
$aCart = new Cart;
            $aCart->images = $aVals;
            $aCart->product_id = $request->product_id;
            $aCart->user_id = $request->user_id;
            $aCart->size_id = $request->size_id;
            $aCart->price = $request->price;
            $aCart->save();
Activity icon

Replied to How To Store Images ?

Yes , multiple images $aVals=["2-standard-binding_1567072524.png","3d-wallpapers-hd-65815-2754760_1567072524.png","Photobooks_1567072524.png"]

Activity icon

Started a new Conversation How To Store Images ?

controller: where $aVals is in json format

        $input = $request->all();
        $aCart = new Cart;
            $aCart->images = $aVals;
            $aCart->create($input);
            return response()->json(['msg'=>"Item added successfull", 'data'=>$input , 'status'=>true]);
Aug
09
3 months ago
Activity icon

Started a new Conversation How To Show Selected Item In Select Field

How show this list as selected ietm: Array ( [0] => Broccoli [1] => Carrot [2] => Banana ) view:

$aSelectedVeg = Array ( [0] => Broccoli [1] => Carrot [2] => Banana )
DATA:
@php
    $aSelectedVeg = json_decode($aRowData['title']);
@endphp 
    
Form:
{{Form::select('title',$aRowVegetable,$aSelectedVeg,['id'=>'vegSelect','class'=>'farmer-select2 form-control','required'=>'required','multiple'=>'multiple','onchange'=>'addVegitableDet($(this))'])}}
Jul
19
3 months ago
Activity icon

Replied to Using A Function From Another Controller

Use this one app('App\Jobs\Game\ActionJob')->activity();

Jul
17
3 months ago
Activity icon

Started a new Conversation I Facing (1/1) TokenMismatchException In VerifyCsrfToken.php Line 68 And If I Run Following Function {{session_status()}} Without Login So It Gives Me Session_id So If You Understand My Problem Then Help Me ?

when i submit any form it return 'TokenMismatchException in VerifyCsrfToken.php line 68' error ??

and at my local it work fine and on server it return TokenMismatchException error.

Jun
14
4 months ago
Activity icon

Replied to Can You Please Tell Me How To Get Transcript From Youtube Api?

// i get it but its working on some videos so if any one has another code to retrive so please share

            type: "POST",
            url: "https://video.google.com/timedtext?lang=en&v="+item.id.videoId
            }).done(function (response) {
                console.log(response);
            }).fail(function (response) {
                console.log();
            });
Activity icon

Replied to Can You Please Tell Me How To Get Transcript From Youtube Api?

through this i am getting only title and video_id and description

Activity icon

Started a new Conversation Can You Please Tell Me How To Get Transcript From Youtube Api?

//HERE IS MY CODE:

function tplawesome(e,t){res=e;for(var n=0;n<t.length;n++){res=res.replace(/\{\{(.*?)\}\}/g,function(e,r){return t[n][r]})}return res}

$(function(){
    $("form").on("submit", function(e) {
      e.preventDefault();
      // prepare the request
      var request = gapi.client.youtube.search.list({
            part: "snippet",
            type: "video",
            videoEmbeddable: true,
            videoCaption:"any",
            q: encodeURIComponent($("#search").val()).replace(/%20/g, "+"),
            maxResults: 1,
            order: "viewCount",
            publishedAfter: "2015-01-01T00:00:00Z"
      });
      //execute the request
      request.execute(function(response) {
          var results = response.result;
          console.log(results);
          var html = '';
          $.each(results.items, function(index, item){
            html += '<div class="youtubeid col-sm-3 col-md-3 col-lg-3"><div class="card"><div class="embed-responsive embed-responsive-16by9">';
            html += '<iframe custAttr="'+item.id.videoId+'" custtitle="'+item.snippet.title+'" class="embed-responsive-item" src="//www.youtube.com/embed/'+item.id.videoId+'" allowfullscreen></iframe>';
            html += '</div><div class="card-body ytcard-text">'+item.snippet.title+'</div></div></div>';  
            $("#results").css("display","block").html(html);
          });
          
          var singleVhtml = '';
          $(".youtubeid").click(function(){
            $(".hidesearchcontainer").css("display","none");
            var videoId = $(this).find("iframe").attr("custAttr");
            var videoTitle = $(this).find("iframe").attr("custtitle");
            
            singleVhtml+= '<div class="col-sm-8 col-md-8 col-lg-8 col-xl-8" ><div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" src="//www.youtube.com/embed/'+videoId+'" allowfullscreen></iframe></div>';
            singleVhtml+= '<div class="row"><div class="ytcard-text title col-sm-8 col-md-8 col-lg-8 col-xl-8">'+videoTitle+'</div><div class="icon col-sm-4 col-md-4 col-lg-4 col-xl-4">';
            singleVhtml+= '<i class="fa fa-thumbs-o-up"></i>12k<i class="fa fa-thumbs-o-down"></i>1k<i class="fa fa-share"></i>SHARE<i class="fa fa-list"></i>SAVE<i class="fa fa-ellipsis-h"></i></div></div></div>';
            $("#showvideodata").css("display","block").html(singleVhtml);
          });
          resetVideoHeight();
       });
    });
    
    $(window).on("resize", resetVideoHeight);
});

function resetVideoHeight() {
    $(".video").css("height", $(".results").width() * 9/16);
}

function init() { 
    //AIzaSyA7WkJ27_jWV03d_fb0w9mfa2lxfGIAtqU  AIzaSyB1l24kUu6gaBEjItEyvliG8sw6D2TEbVw
    gapi.client.setApiKey("AIzaSyA7WkJ27_jWV03d_fb0w9mfa2lxfGIAtqU");
    gapi.client.load("youtube", "v3", function() {
        // yt api is ready
    });
}
Jun
09
5 months ago
Activity icon

Replied to Help Me To Display Image

hii sir i try it but not working

Activity icon

Started a new Conversation Help Me To Display Image

//view page :
  <td><img src="{{asset('hotel/storage/app/'.$getData->image)}}"></td>

// Controller :
if($request->hasFile('image')){
            $image_path = $request->file('image')->store('public/hotel');
            $hotel->image = $image_path;
        }
//
May
30
5 months ago
Activity icon

Replied to I Just Want To Try Calculate Percentage

i want all game field with percentage field

Activity icon

Started a new Conversation I Just Want To Try Calculate Percentage

//THE FOLLOWING CODE IS NOT WORKING 
$startWeight = $gw->start_weight;
$endWeight = $gw->weight;
$act = GameActivityWet::where('game_id','=',$gw->game->id)->where('type','=',2)->where('status','=',1)->groupBy('creator_id')->select('*','weight($startWeight/$endWeight*100) as percentage')->get();