azhar_hussain

azhar_hussain

Member Since 7 Months Ago

Pakistan

Software Engineer at Lahore

Experience Points 500
Experience Level 1

4,500 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.

08 Apr
2 months ago

azhar_hussain started a new conversation Laravel Dynamic Input Field

hey everyone trying to add a dynamic input field which could be added more via add button and can deleted via minus button ,also add data to db via controller method if anyone have sample then share .will be thankful

05 Apr
2 months ago

azhar_hussain left a reply on Save To Laravel Polymorphic Relationship

@SABONZY - thanks you for your response error been solved

azhar_hussain started a new conversation Sore Data In Multiple Rows

hi everyone im trying to store data in multiple rows ,data is storing in parent row but when im trying to add data in new row added via plus button data in new row is not storing here is my blade

`` @include('layouts.header') @include('layouts.topbar') @include('layouts.side_bar')

Add Exercise Type Level

@csrf @if ($errors->any()) @endif Level Select Level @foreach($levels as $level) {{ $level->name }} @endforeach Strength Select Strength @foreach(App\Strength::all() as $item) {{ $item->name }} @endforeach No Of Sets Image Url Maximum Power Exercise Type Select Exercise Type @foreach(App\ExerciseType::all() as $item) {{ $item->title }} @endforeach Goal Select Gaol @foreach(App\Goal::all() as $item) {{ $item->name }} @endforeach @if(isset($detail['detail'])) @foreach($detail['detail'] as $k=>$item) Exercise No @foreach(App\ExerciseNo::all() as $item) {{ $item->name }} @endforeach {{$errors->first('date','message') }} Repetition {{ $errors->first('date', ':message') }} Rest Time {{ $errors->first('rest_time', ':message') }} @endforeach @else Exercise Choose Exercise @foreach(App\ExerciseNo::all() as $item) {{ $item->name }} @endforeach {{ $errors->first('date',':message') }} Repetition {{ $errors->first('date',':message') }} Rest Time {{ $errors->first('date','message') }} @endif Submit @include('layouts.footer') $(document).ready(function () { $('#addExerciseTypeLevel').bootstrapValidator({ fields: { no_of_sets: { validators: { notEmpty: { message: 'The No of Sets is required and can\'t be empty' } } }, max_power: { validators: { notEmpty: { message: ' Max Power is required and can\'t be empty' } } }, recommended_repetition: { validators: { notEmpty: { message: ' Recommended Repetition is required and can\'t be empty' }, } }, rest_time: { validators: { notEmpty: { message: ' Rest Time is required and can\'t be empty' }, } }, strength_id: { validators: { notEmpty: { message: 'Choose a Strength and can\'t be empty' } } }, level_id: { validators: { notEmpty: { message: 'Select a Level and can\'t be empty' } } }, image_url: { validators: { notEmpty: { message: 'Image url is required and can\'t be empty' } } }, goal_id: { validators: { notEmpty: { message: 'The Goal is required and can\'t be empty' } } }, } }).on('click', '.addButton', function() { var $template = $('#grand_child_0'), $clone = $template .clone() .removeClass('hide') .removeAttr('id') .insertAfter($template), $exercise_no = $clone.find('[name="exercise_no_id[]"]'); $recommended_repetition = $clone.find('[name="recommended_repetition[]"]'); $exercise_no_id = $clone.find('[name="exercise_no_id[]"]'); $clone.find('[id="remove_btn"]').removeClass('hide'); // Add new field $('#tryitForm').bootstrapValidator('addField', $exercise_no); $('#tryitForm').bootstrapValidator('addField', $recommended_repetition); $('#tryitForm').bootstrapValidator('addField', $exercise_no_id); }).on('click', '.removeButton', function() { var $row = $(this).parents('.grand_child'), $exercise_no = $row.find('[name="exercise_no_id[]"]'); $recommended_repetition = $row.find('[name="recommended_repetition[]"]'); $exercise_no_id = $row.find('[name="exercise_no_id[]"]');
            // Remove element containing the option
            $row.remove();
            $('#tryitForm').bootstrapValidator('addField', $exercise_no);
            $('#tryitForm').bootstrapValidator('addField', $recommended_repetition);
            $('#tryitForm').bootstrapValidator('addField', $exercise_no_id);
            // Remove field
        })
});

``

and here is my controlller

`` public function saveNewExerciseTypeLevel(Request $request) { $request->validate([ 'goal_id'=> 'required', 'max_power'=> 'required', 'no_of_sets'=> 'required', 'level_id'=> 'required', 'strength_id'=> 'required', 'image_url'=> 'required', 'exercise_type_id'=>'required', 'recommended_repetition'=> 'required', 'rest_time'=> 'required',

    ]);
    $data=array(
        'goal_id'=> $request['goal_id'],
        'exercise_type_id'=> $request['exercise_type_id'],
        'max_power'=> $request['max_power'],
        'no_of_sets'=>$request['no_of_sets'],
        'level_id'=> $request['level_id'],
        'strength_id'=> $request['strength_id'],
        'image_url'=>$request['image_url'],
    );
    $share = new ExerciseTypeLevel();
    $share->fill($data)->save();
    if(count($request['exercise_no_id'])>0) {
        foreach ($request['exercise_no_id'] as $k => $item) {
            $exerciseWithLevel = new ExerciseWithLevel();
            $exerciseWithLevel->recommended_repetition = $request['recommended_repetition'][$k];
            $exerciseWithLevel->rest_time = $request['rest_time'][$k];
            $exerciseWithLevel->exercise_no_id = $request['exercise_no_id'][$k];
            $exerciseWithLevel->save();
        }

        return redirect('/dashboard')->with('success', 'Exercise with level has been added');
}    }

}

``

willl be rellay apreciated

27 Mar
2 months ago

azhar_hussain left a reply on Save To Laravel Polymorphic Relationship

~ "Call to undefined method App\ModelType::likes() 5~ i have defined relationship already but still facing the aboe error

azhar_hussain started a new conversation Save To Laravel Polymorphic Relationship

when im trying to submit then following error comes

"message": "Method Illuminate\Support\Collection::likes does not exist. 100"

my code looks like this

$type=ModelType::whereId($input['likeable_type'])->pluck('title'); $this->model=$type; $model=new $this->model; $model->likes()->create([ 'user_id'=>Auth::user()->id, 'likeable_id'=>$model['likeable_id'] ]);

willl be appriciated

25 Mar
3 months ago

azhar_hussain started a new conversation Laravel Youtube

how i can find the duration of youtube video in laravel . thank you Best regards Capt.Azhar

22 Mar
3 months ago

azhar_hussain left a reply on Laravel Eloquent

really appreciate thank u buddy it worked for me

azhar_hussain started a new conversation Laravel Eloquent

how i will write this sql query in laravel UPDATE user_levels SET complete_count = complete_count+1 WHERE is_completed=1 thank you every body

azhar_hussain started a new conversation Eloquent

i want to get the complete_count and value in complete_count increments by 1 when is_completed = 1 every time my db table structure is as following

23 Jan
5 months ago

azhar_hussain left a reply on Edit Column In Laravel

public function getProductCategoryList() {

    $productCategory=ProductCategory::select('product_categories.*');
    return DataTables::of($productCategory)




        ->editColumn('company_id',function($user)
        {
            return $user->user->company_name;
        })




    ->editColumn('status',function($productCategory)
    {



            if($productCategory->status == 1)



            {
                return 'Enabled';
            }
            else


            {
                return 'Disabled';
            }
    })->make(true);

}

azhar_hussain left a reply on Edit Column In Laravel

its working fine but same way when im trying to edit another column it fails

azhar_hussain left a reply on Edit Column In Laravel

public function getProductCategoryList() { $productCategory=ProductCategory::select('product_categories.*'); return DataTables::of($productCategory) ->editColumn('status',function($productCategory) { if($productCategory->status == 1) { return 'Enabled'; } else { return 'Disabled'; } })->make(true);

}

azhar_hussain left a reply on Edit Column In Laravel

public function getProductCategoryList() { $productCategory=ProductCategory::select('product_categories.*'); return DataTables::of($productCategory) ->editColumn('company_id',function($user) { return $user->user->company_name; }) ->editColumn('status',function($productCategory) { if($productCategory->status == 1) { return 'Enabled'; } else { return 'Disabled'; } })->make(true);

}

here is the code in controller

azhar_hussain started a new conversation Edit Column In Laravel

i want to edit column company_id and wanna show company_name instead ,without using relationship

13 Nov
7 months ago

azhar_hussain left a reply on 1048 Column 'post1' Cannot Be Null In Laravel

i dont want to pass a nullable value through post1 so where i should make changes?

azhar_hussain left a reply on 1048 Column 'post1' Cannot Be Null In Laravel

@TAKDW - let me check thanks for your responce

azhar_hussain started a new conversation 1048 Column 'post1' Cannot Be Null In Laravel

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'post1' cannot be null (SQL: insert into shares (share_name, share_price, share_qty, post1, name, f_name, cnic, mobile_no, email, dob, religion, gender, martial_status, district, blood_group, nationality, address, updated_at, created_at) values (sfkl, 344, 344, , , arif, 34301, 0315, azhr224@gmail.com, 2018-11-27, islam, male, unmarried, hafizabad, b+, pakistan, abc, 2018-11-14 07:37:44, 2018-11-14 07:37:44))