tanveerkhanwd

tanveerkhanwd

Member Since 11 Months Ago

Experience Points 4,270
Experience Level 1

730 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 20
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.

07 Mar
2 weeks ago

tanveerkhanwd started a new conversation Find Out Days Between Two Dates

// here is the answer:
<?php
        $now  = \Carbon\Carbon::now();
       $end  = $results->start_date;
     print $now->diffInDays($end);
?>

tanveerkhanwd started a new conversation How I Get Only Day-mounth From Date

// iam trying to get date in this format: dd-mm only and it display on screen like this :  07-march
<p>
    <i class="far fa-calendar-alt"></i> 
        {{ $results->start_date}} - {{ $results->end_date }}
    </p>
05 Mar
2 weeks ago

tanveerkhanwd left a reply on How To Add 4 Weeks In Start_date And Store In End_date In Database

Its also working:
public function store(Request $request)
    {
        $this->validate($request,[
            'image' => 'required',
            'name' => 'required|unique:games',
            'type' => 'required',

        ]);
        $day =  new Carbon($request->start_date);
        $day = $day->addWeek(4);
        $end_date = $day->toDateString();
        
        if($request->hasFile('image')){
            $image_path = $request->file('image')->store('game');
        } 
        $game = new Game;
        $game->image = $image_path;
        $game->name = $request->name;
        $game->user_id = Auth::user()->id;
        $game->start_date = $request->start_date;
        $game->end_date =$end_date;
        $game->description = $request->description;
        $game->bet_amount = $request->bet_amount;
        $game->type = $request->type;
        $game->save();

        return redirect()->route('game.listing')->with('success','Game store successfully');
    }

tanveerkhanwd started a new conversation How To Add 4 Weeks In Start_date And Store In End_date In Database

public function store(Request $request) { $numDays = 28; $days = $request->start_date; $days = addDays($numDays); $this->validate($request,[ 'image' => 'required', 'name' => 'required|unique:games', 'type' => 'required',

    ]);

    if($request->hasFile('image')){
        $image_path = $request->file('image')->store('game');
    } 
    $game = new Game;
    $game->image = $image_path;
    $game->name = $request->name;
    $game->user_id = Auth::user()->id;
    $game->start_date = $request->start_date;
    $game->end_date = $days;
    $game->description = $request->description;
    $game->bet_amount = $request->bet_amount;
    $game->type = $request->type;
    $game->save();

    return redirect()->route('game.listing')->with('success','Game store successfully');
}
04 Mar
2 weeks ago

tanveerkhanwd started a new conversation How I Delete My Image Path When I Delete My Whole Field From Database

public function destroy($id)
    {
        $game = Game::find($id);
        $game->delete();
        return redirect()->route('game.listing')
                        ->with('success','Game delete successfully');
    }
26 Feb
3 weeks ago

tanveerkhanwd left a reply on How To Pass Argument To Middleware " I Pass Parameter 'admissions' In $type"

@MANELGAVALDA - i want to pass a parameter in my middleware controller and using that parameter in my middleware

tanveerkhanwd started a new conversation How To Pass Argument To Middleware

//My Middleware :
public function handle($request, Closure $next, $type)
    {
        if (Auth::User()->role_id!=1) {
            $currentUser = Auth::user()->role_id;
            $permissionData = Privilege::select('role_id','permission')->where('role_id','=',$currentUser)->first();
            $permissionData = json_decode($permissionData['permission'],true);
            if ($permissionData->$type) {
                return $next($request);   
               }
            else
            {
                return redirect()->back();   
            }   
        }
        else
        {
            return $next($request);
        }
    }


// My Controller:

public function __construct()
    {
        $this->middleware('permission:admissions');
    }
25 Feb
3 weeks ago

tanveerkhanwd started a new conversation How To Retrive Single Key Value From Array Stored In Database

//1. I have this array that stored in my Privilege table  in permission column:
//  2.i want to access only [admission] key  data  
// 3. Which query  help me. 
stdClass Object
(
    [admission] => stdClass Object
        (
            [listing] => on
            [delete] => on
            [print] => on
            [pdf] => on
        )

    [image] => stdClass Object
        (
            [listing] => on
            [print] => on
            [pdf] => on
        )

    [events] => stdClass Object
        (
            [listing] => on
            [delete] => on
            [add] => on
            [print] => on
            [pdf] => on
        )
20 Feb
1 month ago

tanveerkhanwd started a new conversation How To Check Or Uncheck All Checkbox From One Button

// Here is my Js:

<script>
    // v1
function checkAll1() {

  var inputs = document.querySelectorAll('.check1');
  for (var i = 0; i < inputs.length; i++) {
    inputs[i].checked = true;
  }

  this.onclick = uncheckAll1;
}

function uncheckAll1() {
  var inputs = document.querySelectorAll('.check1');
  for (var i = 0; i < inputs.length; i++) {
    inputs[i].checked = false;
  }

  this.onclick = checkAll1; //function reference to original function
}
  </script>


Here Is My View Html page :
<form>
        <legend>Version 1<small>Single buttons</small></legend>
        <div class="checkbox">
          <input type="button" id="checkall1" onclick="checkAll1()" class="btn btn-link" value="Un/check All">
        </div>
        <div class="checkbox">
          <label>
            <input type="checkbox" class="check1"> Check me out
          </label>
        </div>
        <div class="checkbox">
          <label>
            <input type="checkbox" class="check1"> Check me out
          </label>
        </div>
        <div class="checkbox">
          <label>
            <input type="checkbox" class="check1"> Check me out
          </label>
        </div>
      </form>

tanveerkhanwd started a new conversation How I Set Checked Or Uncheked Using Jquery

      {{ csrf_field() }}
      <table id="" class="table table-bordered table-striped">
        <thead>
          <tr>
            <th style="width: 15%" class="center">#</th>
            <th style="width: 15%" class="center" colspan="6">permissions</th>
          </tr>
          <tr>
            <th style="width: 15%" class="center"></th>
            @foreach($allowPermission as $result)
            <th style="width: 15%" class="center">{{$result}}<br> 
              <input type="checkbox" name="" id="{{$result}}">
            </th>
            @endforeach
          </tr>
        </thead>
        <tbody>
         
          @foreach($aRolePermission as $results)
          <tr>
            <th>
              {{$results}}
              <input type="checkbox" name="" class="right" id="{{$results}}" >
            </th>
              @foreach($allowPermission as $result)
            <td class="center">
              <input type="checkbox" name="permission[{{$results}}][{{$result}}]" class="{{$results}} {{$result}}" checked="checked">
            </td>
            @endforeach
          </tr>
          @endforeach  
                  
        </tbody>             
      </table>
      <div class="box-footer">
        {!! Form::submit('Update',['class'=>'btn btn-primary']); !!}
      </div><!-- /.box-footer -->
      {!! Form::close() !!}

tanveerkhanwd started a new conversation How To Use Json Encode On Following Data

(
    [_method] => PATCH
    [_token] => pp7bjIqWRL8hatrNyh4ZPtNeb8i6lpjD51QCzFMw
    [permission] => Array
        (
            [Admission] => Array
                (
                    [listing] => on
                    [Edit] => on
                    [Delete] => on
                    [Add] => on
                    [Print] => on
                    [Pdf] => on
                )

            [Announcement] => Array
                (
                    [listing] => on
                    [Edit] => on
                    [Delete] => on
                    [Add] => on
                    [Print] => on
                    [Pdf] => on
                )

            [Blogs] => Array
                (
                    [listing] => on
                    [Edit] => on
                    [Delete] => on
                    [Add] => on
                    [Print] => on
                    [Pdf] => on
                )
19 Feb
1 month ago

tanveerkhanwd started a new conversation How Can I Print Array Data Into My View Table

<?php print_r($aRolePermission);die(); ?>

In $aRolePermission i got this array:

Array ( [0] => Admission [2] => Announcement [3] => Blogs [4] => Category [5] => ContactUs [6] => Enquiry [7] => Events [8] => Faq [9] => JobPosition [10] => JobVacancy [11] => ManageRole [12] => Media [13] => Menu [14] => News [15] => NewsLetter [16] => Pages [17] => Profile [18] => ProgramWeOffer [19] => RolePermission [20] => Slider [21] => StaticPage [22] => Testimonials [23] => University ) 

how can i print all data into table
15 Feb
1 month ago

tanveerkhanwd left a reply on How To Search Data From Database Using Array

Right Answer is Here:
public function index(Request $request)
    {
        $search = \Request::get('search');
        $records = config('constant.displayPageRecords');
        
        $query = Admission::whereNotNull('name');
        $aCon=array();
        if (!empty($search)) {
            $query = $query->where(function ($qry) use($search){
                return $qry->where('name','like','%'.$search.'%')
                   ->orwhere('city','like','%'.$search.'%')
                   ->orwhere('dob','like','%'.$search.'%')
                   ->orwhere('present_school','like','%'.$search.'%');
                });
        }
        
        $admission = $query->paginate($records)->appends($request->except('page'));
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);
    }
14 Feb
1 month ago

tanveerkhanwd left a reply on How To Search Data From Database Using Array

help me to get out from this problem please

tanveerkhanwd started a new conversation How To Search Data From Database Using Array

    {
        $search = \Request::get('search');
        $records = config('constant.displayPageRecords');
        
        
        
        $aCon=array();
        if (!empty($search)) {
            $aCon = array
             (
                array('name','like',$search),
                array('city','like',$search),
                array('type','like',$search)
                
             );
        }
        
        $admission = Admission::where($aCon)->paginate($records);
        print_r($aCon);
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);
    }

tanveerkhanwd left a reply on How I Search Data From Multiple Colunm In Database Using Array

@SAURABHD - i want all the data into array format sir

tanveerkhanwd started a new conversation How I Search Data From Multiple Colunm In Database Using Array

my controler:

        
        $aCon= array();
        if (!empty($request->input('search'))) {
            $aCon['name'] = $search;
            $aCon['city'] = $search;
            $aCon['present_school'] = $search;
        }
        $records = config('constant.displayPageRecords');
        $admission = Admission::where($aCon,'like','%'.$search.'%')->paginate($records);
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);

tanveerkhanwd left a reply on How Can I Search Anything From Database This Code Is Work But Only For Name

how to search data from more then one field in laravel

tanveerkhanwd left a reply on How To Add Search Box

it is a question

tanveerkhanwd started a new conversation How To Add Search Box

my view:

        <div class="box-body">
          {{ csrf_field() }}
          <!-- text input -->
          <div class="form-group">
            <div class="col-sm-3">
              {!! Form::text('search','',['class'=>'form-control','placeholder'=>'Search','required'=>'required']); !!}
              <span class="text-danger">{{ $errors->first('search') }}</span>
            </div>
            <div class="col-sm-2">
              {!! Form::submit('search',['class'=>'btn btn-primary']); !!}
              <span class="text-danger">{{ $errors->first('status') }}</span>
            </div>
          </div>
      {!! Form::close() !!} 

My Controller:

public function index(Request $request)
    {
        //print_r(input::get('search'));die();
        $aCon= array();
        if (isset($request->input('search')) && !empty($request->input('search'))) {
            
        }
        
        //$admission= $request->search;
        //$search = Admission::all();
        $records = config('constant.displayPageRecords');
        $admission = Admission::where($aCon)->orderBy('id','DESC')->orWhere('name', 'like', '%')->paginate($records);
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);
    }

tanveerkhanwd left a reply on How To Use Constant Value In Laravel Controller

i found write answer :

        $admission = Admission::paginate($records);
        return view('admin.admission.index',['admission'=>$admission,'records'=>$records]);

tanveerkhanwd left a reply on How To Use Constant Value In Laravel Controller

i got this error message :

Class 'App\Http\Controllers\Admin\Config' not found

tanveerkhanwd started a new conversation How To Use Constant Value In Laravel Controller

i have this code and i want to use it in my controller:

        echo Config::get('constant.displayPageRecords');
        $records = 20;
        $newsLetter = NewsLatterData::orderBy('updated_at','DESC')->paginate($records);
        return view('admin.newsletter.index',['newsLetter'=>$newsLetter,'records'=>$records]);
    }
12 Feb
1 month ago

tanveerkhanwd left a reply on Update Into Multiple Tables 'admission' And 'admission_details'

public function update(Request $request, $id) { $admission = Admission::find($id); $admission->name = $request->name; $admission->dob = $request->dob; $admission->address = $request->address; $admission->city = $request->city; $admission->state = $request->state; $admission->country = $request->country; $admission->pincode = $request->pincode; $admission->present_school = $request->present_school; $admission->grade = $request->grade; $admission->join_grade = $request->join_grade; $admission->year = $request->year; $admission->nationality = $request->nationality; $admission->type = $request->type; $admission->save();

    //Insert data into admission Details
    $aryData['father_details'] = json_encode($request->fval);
    $aryData['mother_details']= json_encode($request->mval);
    $aryData['passport_type'] = $request->passport_type;
    $aryData['heard_from'] = $request->heard_from;
    AdmissionDetail::where(['admission_id'=>$id])->update($aryData);

    return redirect()->route('admin.admission.index')->with('success','Admission Updated successfully');
}

tanveerkhanwd started a new conversation Update Into Multiple Tables 'admission' And 'admission_details'

my controller: public function update(Request $request, $id) { $fval = (json_encode($_POST['fval'])); $mval = (json_encode($_POST['mval'])); $admission = Admission::find($id); $admission->name = $request->name; $admission->dob = $request->dob; $admission->address = $request->address; $admission->city = $request->city; $admission->state = $request->state; $admission->country = $request->country; $admission->pincode = $request->pincode; $admission->present_school = $request->present_school; $admission->grade = $request->grade; $admission->join_grade = $request->join_grade; $admission->year = $request->year; $admission->nationality = $request->nationality; $admission->type = $request->type; $admission->admissionDetail->father_details = $request->fval; $admission->admissionDetail->mother_details = $request->mval; $admission->admissionDetail->passport_type = $request->passport_type; $admission->admissionDetail->heard_from = $request->heard_from; $admission->save(); return redirect()->route('admin.admission.index')->with('success','Admission Updated successfully'); }

my Admission model:

public function admissionDetail() { return $this->hasone('App\Models\AdmissionDetail', 'admission_id'); }

08 Feb
1 month ago

tanveerkhanwd started a new conversation How To Join Two Table And Display Data In Laravel

where i have to make change

07 Feb
1 month ago

tanveerkhanwd started a new conversation How Make A Clone For Single Input Box In Laravel Using Js

here is my code:

<div class="form-group">{!! Form::label('university', 'University', ['class' => 'col-sm-2 control-label']); !!}{!! Form::text('university','',['class'=>'form-control add-form','placeholder'=>'university']); !!}{{ $errors->first('university') }} </div> <div class="col-sm-1"> {!! Form::button('Add More',['class'=>'btn btn-success','id'=>'but_add']); !!} </div>

06 Feb
1 month ago

tanveerkhanwd left a reply on How To Get Multiple Images

Answer bshould be: @php ($aImageUrl=json_decode($results->media)) @foreach($aImageUrl as $allImage) @php ($aryExp = explode('/',$allImage))

{!! Form::open(['route' =>['singleImage.destroy'],'method' => 'delete']) !!} {!! Form::button('delete',['class'=>'btn btn-danger','onclick'=>'return confirm("Are you sure you want delete !!!")']); !!}

@endforeach

tanveerkhanwd started a new conversation How To Get Multiple Images

This is my view:

@if($results->type==1) <div class="form-group"> {!! Form::label('media', 'Upload Image', ['class' => 'col-sm-2 control-label']); !!} <div class="col-sm-6"> {{Form::file('media[]',['multiple'=>true],'$results->media')}} </div> </div> @if($results->media!="") @php ($aImageUrl=json_decode($results->media)) @foreach($aImageUrl as $allImage) @php ($aryExp = explode('/',$aImageUrl[0])) <div class="form-group"> <img src="{{ asset('storage/uploads/'.$aryExp[2]) }}" class="img img-responsive img-thumbnail">

tanveerkhanwd started a new conversation How I Delete Data

my view: {!! Form::open(['route' =>['media.destroy',$results->id],'method' => 'delete']) !!} my Route: ` Route::get('media_destroy/{media}','[email protected]')->name('media.destroy');'

my Controller: public function destroy(Media $media) { $media=delete(); return redirect()->route('media.index') ->with('success','Media deleted successfully'); }

and it gives error: Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

tanveerkhanwd left a reply on How To Pass Multiple Variable Throuth Route

My Error: Missing required parameters for [Route: media.edit] [URI: admin/media_edit/{media}/{type}].

tanveerkhanwd left a reply on How To Pass Multiple Variable Throuth Route

my route is correct or incorrect

tanveerkhanwd started a new conversation How To Pass Multiple Variable Throuth Route

my blade.php file

my Route.php Route::get('media_edit/{media}/{type}','[email protected]')->name('media.edit');

05 Feb
1 month ago

tanveerkhanwd started a new conversation Code For Upload Multiple Images In Laravel

{{Form::file('file')}}

tanveerkhanwd started a new conversation Javascript To Change On Click Input Type

if 'tyoe = image' then show a upload input box otherwise url input box here is my view:

{!! Form::label('type', 'Type', ['class' => 'col-sm-2 control-label']); !!} {!! Form::select('type', ['1' => 'image', '2' => 'video'], null, ['placeholder' => 'Select Type','class'=>'form-control select2']); !!} {{ $errors->first('type') }}

tanveerkhanwd left a reply on In My '$type' There Are To Parameter 1.image,2.video And I Want To Access Both Variable As If I Select Image Then It Give Me All Images From Media Table And Else Give All Video

here is my controller:

public function index($type="") { if ($type='video') { $media = Media::where(['type'=>2])->get(); return view('admin.media.index',compact('media')); } else{ $media = Media::where(['type'=>1])->get(); return view('admin.media.index',compact('media')); } }

tanveerkhanwd started a new conversation In My '$type' There Are To Parameter 1.image,2.video And I Want To Access Both Variable As If I Select Image Then It Give Me All Images From Media Table And Else Give All Video

HERE IS MY CONTROLLER:

public function index($type="") { $media = Media::all(); return view('admin.media.index',compact('media')); }

tanveerkhanwd left a reply on How To Get Name From Category Id

how i access data from media model This is my controller:

public function index() { $media = Media::all(); return view('admin.media.index',compact('media')); }

this is my model: public function category() { return $this->belongsTo('App\Models\Category', 'category_id'); } this is my view: insted of category id i want category name @foreach ($media as $results) {{ ++$cnt }} {{ $results->category_id }} {{ $results->title }} {{ $results->url }} {{ $results->type }}

04 Feb
1 month ago

tanveerkhanwd started a new conversation How To Get Name From Category Id

@foreach ($media as $results) {{ ++$cnt }} {{ $results->category_id }} {{ $results->title }} {{ $results->url }} {{ $results->type }}

30 Sep
5 months ago

tanveerkhanwd left a reply on HOW UPDATE IN LARAVEL

i found error its variable mistake

tanveerkhanwd left a reply on HOW UPDATE IN LARAVEL

is this visible

tanveerkhanwd started a new conversation HOW UPDATE IN LARAVEL

MY CONTROLLER: public function update(Request $request) { if($request->hasFile('image')){ $filename = $request->image->getClientOriginalName(); $request->image->storeAs('public/ImportentJob',$filename); $teachers = ImpJob::find($request->$id); $ImportentJob->J_name = $request->J_name; $ImportentJob->J_image = $filename; $ImportentJob->url= $request->url; $ImportentJob->save(); $ImportentJob = ImpJob::all(); return view('admin.listImpJob',compact('ImportentJob'))->with('message',' SUCCESSFULLY UPDATED'); } return redirect()->back()->with('message1','NOT! UPDATED TRY AGAIN'); }

17 Sep
6 months ago

tanveerkhanwd started a new conversation MY DISTINCT KEYWORD NOT WORKING

$coachingCity = Coaching::select('id','C_city')->orderBy('C_city')->distinct()->get(['C_city']);

27 Jul
7 months ago

tanveerkhanwd started a new conversation HOW CAN I USE RADIO BUTTON IN MY QUIZ PAGE

MY VIEW PAGE:

" @foreach($gk as $g)

  • Q.{{$loop->index+1}} {{$g->question}}
  • A): {{$g->option1}}
  • B): {{$g->option2}}
  • C): {{$g->option3}}
  • D): {{$g->option4}}
@endforeach "