AliMalik

AliMalik

Member Since 4 Years Ago

Islamabad

Experience Points 9,980
Experience Level 2

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

21 Nov
1 year ago

AliMalik left a reply on Run Composer Commands With Different Php Versions

@helwieahmad Thanks for the link. But what I comprehended is this that it'll simply force Laravel to install even if it doesn't meet the requirements of local machine.

--ignore-platform-reqs: ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these. See also the platform config option.

11 May
3 years ago

AliMalik left a reply on Silly HTML Question.

@abhishek009 Oh missed that, CSS solution is perfect then.

AliMalik left a reply on Silly HTML Question.

Because you're using two separate form tags for both of these buttons. Include them in a single tag like this:

<form action="" method="POST">
    <a href="#" class="btn btn-primary"> <i class="fa fa-user-plus" aria-hidden="true"></i> Add as Friend</a>
    <a href="#" class="btn btn-success"> <i class="fa fa-envelope-o" aria-hidden="true"></i> Send Message</a>
</form>

AliMalik started a new conversation Run Composer Commands With Different Php Versions

I have two php versions installed on my system php 5.3 and php 5.6 When running commands in cmd for version check i got this :

php -v
PHP 5.3.28 (cli) (built: Dec 10 2013 22:27:36)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

and for php 5.6

php56 -v
PHP 5.6.17 (cli) (built: Jan  6 2016 13:28:21)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

I have path setup for both of these in my environment. Now while running composer create-project i get error because composer points to php 5.3 and laravel requires php >= 5.5

composer create-project laravel/laravel BlogSys
Installing laravel/laravel (v5.0.22)
  - Installing laravel/laravel (v5.0.22)
    Loading from cache

Created project in BlogSys
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for jeremeamia/superclosure 2.1.0 -> satisfiable by jeremeamia/SuperClosure[2.1.0].
    - jeremeamia/SuperClosure 2.1.0 requires php >=5.4 -> your PHP version (5.3.28) does not satisfy that requirement.
  Problem 2
    - Installation request for laravel/framework v5.0.16 -> satisfiable by laravel/framework[v5.0.16].
    - laravel/framework v5.0.16 requires php >=5.4.0 -> your PHP version (5.3.28) does not satisfy that requirement.
  Problem 3
    - Installation request for league/flysystem 1.0.2 -> satisfiable by league/flysystem[1.0.2].
    - league/flysystem 1.0.2 requires php >=5.4.0 -> your PHP version (5.3.28) does not satisfy that requirement.

When i want to run this composer command appending php or (php56) before composer i got this error

 php composer create-project laravel/laravel BlogSys
Could not open input file: composer

How can i impose composer to execute its command using specific version of php?

06 Jul
4 years ago

AliMalik left a reply on How To Check If An Array Is Not Null In Blade

@pmall Yes one less condition to handle this way, thanks

AliMalik left a reply on Notification Indicator

Yeah i have noticed it too

AliMalik started a new conversation How To Check If An Array Is Not Null In Blade

I can check for a variable if it exists or not in blade like {{ $Variable or 'Default' }}

But how can i check if an array exists or it is null. What i am doing is passing an array of values to blade to populate a select box. But the array can be completely null due to back-end logic so what is the best way to check and iterate if array have values then iterate and pass as a third argument to Form::select otherwise pass null to select.

<label class="select">
                {{ isset($alCities) ? $alCities : ' ' }}
                    @foreach($alCities as $city)
                     <?php $cts[] = $city->jobAdALCity; ?>
                        @endforeach
            
            {!! Form::select('jobAdALCity[]',$cityArray,null,['id'=>'alCity','multiple']) !!}
      </label>  
01 Jul
4 years ago

AliMalik left a reply on How To Prevent Users From Editing/viewing Other Users' Resources

Thank You @bestmomo. Authorize function seems a simple way of putting it together .

AliMalik left a reply on How To Prevent Users From Editing/viewing Other Users' Resources

Thank You @JoeDawson swift and accurate reply , i am going to give it a try.

AliMalik started a new conversation How To Prevent Users From Editing/viewing Other Users' Resources

In my app I have users with their resources like posts they own. To edit his/her specific post a user would visit the /user/edit/{postid} route (where postid is the ID).

Although I have an auth set up and only logged user can access this route but there is nothing to stop a use case, for example, user 1 from editing user 2's post by forging and accessing url with some other postid.

How to prevent this from happening.

18 Jun
4 years ago

AliMalik left a reply on Send Email On Registration

@LovelyBoy Double check if you have configured all configurations related to mail. You can find in config>mail.php. I think the problem is within your mail.php file , where credentials or configuration is not set properly. What SMTP Host are you using?? Does it require username etc?

AliMalik left a reply on Implement Database Queue And Process Text Sms And App Notification

if you have any problems you know where to find us ;) Awesome ...

17 Jun
4 years ago

AliMalik left a reply on Stopping Multiple Form Submission.

But this idea of "What if user have their JavaScript disabled " and stuff like that , is not it a safe idea to always implement server side logic and checks for web apps, after all there are chances that "Users will do something silly" with our app.

AliMalik left a reply on Stopping Multiple Form Submission.

Thank you guys @pmall @mstnorris . I have done it on front-end. i just disable the submit button and re-enable it if validation fails.

AliMalik left a reply on Stopping Multiple Form Submission.

@dfaux Thank you , but this is client side solution i.e disabling the submit button , but i still have problems with it like upon clicking submit button if form contains invalid data and validation jumps in to prompt , then submit button is already disabled. No chance for user to use it again after correcting input.

AliMalik started a new conversation Stopping Multiple Form Submission.

How can i check for if a form is already submitted (posted) and then disabling further submission requests on server side in laravel

AliMalik left a reply on Keep Getting TokenMismatchException VerifyCsrfToken.php On Line 46

@laraDev98 My problem vanished when i switched to my EasyPhp Dev server from laraveel development server, so it seems like a environment configuration issue i was having.Not sure but give it a try.

28 May
4 years ago

AliMalik started a new conversation Unique Name Of Uploaded Pictures With Time

I have a section where app user uploads his profile picture and if not uploaded a default avatar is selected for that user. To make the name of uploaded picture unique i am appending it with current date and time, but it throws file exception:

$picName = Input::file('profilePic')->getClientOriginalName();
$picName = Carbon::now().$picName;
Input::file('profilePic')->move($destinationPath, $picName);

While with appending date moving is working fine

This is working just fine
$picName = Input::file('profilePic')->getClientOriginalName();
Input::file('profilePic')->move($destinationPath, $picName);

I am getting this error:

FileException Could not move the file "C:\EasyPHP\binaries\tmp\phpCD77.tmp" to "upload/13\2015-05-28-16:57:59-ali.jpg" ()

AliMalik left a reply on How To Put Two Condition In A Query Scope .

I think you can also pass an array to where:

$conditions = ['field1' => 'value', 'field2' => 'value2', ...];
$results = $query->where($conditions);

AliMalik left a reply on No Validation On Laravel Form::Select

@bobbybouwmann Using This:

Form::select('degreelevel', ['' => 'Degree Level'] + DataList::$degreeLevelArray)

Also solved this issue , now client side validation is also back in game as intended..

AliMalik left a reply on Suggestion For Laravel 5.1 Docs

a basic, official, ACL package would be great Truly a must required for new comers

AliMalik left a reply on Disabling First <option> Value Using Form Builder In Select

Yeah, not unnecessary typing :-p

AliMalik left a reply on Disabling First <option> Value Using Form Builder In Select

@bobbybouwmann and @JarekTkaczyk Thank you , both of you expanded my vision and that is what i needed..

AliMalik left a reply on Disabling First <option> Value Using Form Builder In Select

@pmall yes , But for all possible options for all of select boxes, it will be so much of typing :-)

AliMalik left a reply on Disabling First <option> Value Using Form Builder In Select

@pmall Actually the levelArray is quite large , and i have 5 select drop down on this page , so that will expand Form::select with so much of code..

AliMalik started a new conversation Disabling First <option> Value Using Form Builder In Select

I created a select using form Builder like:

{!! Form::select('degreelevel',$levelArray,'0',[]) !!}

Where default value is 0 , i.e 0th index of array $levelArray , which i am passing to the view like:

return view('js.wizard.jsacademicinfo',
    ['levelArray' => array_merge(['Degree Level'], DataList::$degreeLevelArray),

Now Select Box is populated with values from array with default selected as:

--Degree Level--
               |---->Other drop down options here....

Now i am having this issue where validation is not taking effect because default value is in fact a value and validator's required rule is not capturing it and i am getting a 0 value inserted into database, rather than making user to select an option from drop down.. How can i achieve this mark-up using form builder Where an option is disabled:

<select name="degreelevel">
      <option value="0"selected="selected"disabled="disabled">Degree Level</option>
      <option value="phd">PHD</option>
      <option value="master">Master</option>
</select>

Or any other better way of making validation work as intended.

27 May
4 years ago

AliMalik left a reply on Keep Getting TokenMismatchException VerifyCsrfToken.php On Line 46

I am having the same issue for every post request on laravel development server. But running my project from EasyPhp local server i didn't get any mismatch error. This is the post i encountered while trying to solve the issue : https://github.com/laravel/framework/issues/8172

AliMalik started a new conversation Package For Laravel Client Side Validation

Is there a good package for client side validation to work with L5. I have used jqueryValidation but it seems to be not working with laravel Form builder , but working fine for simple html markup https://laracasts.com/discuss/channels/laravel/no-validation-on-laravel-formselect

AliMalik left a reply on How CsrfToken Works

That's what i was thinking of it, environment / configuration specific issue, Thanks for guidance.

AliMalik left a reply on Guidelines For Posting On Laracasts.com

Very good guidelines , there must be a top two or so posts that always remain at the top. good for reference.

AliMalik left a reply on Which Laravel Admin Panel Should I Use?

@sajib007 I am also working on a job portal app , with multiauth and stuff like that, i have used https://github.com/sboo/multiauth for authentication and it is working for me.. You may also want to see this gist to get you going if you need to..https://gist.github.com/sboo/10943f39429b001dd9d0

AliMalik left a reply on How CsrfToken Works

After so much of testing and tries to solve it, i cannot solve the issue, but when i switched from laravel dev server to my EasyPhp local server it stopped throwing me those annoying mismatch errors. Any note on that..??

25 May
4 years ago

AliMalik left a reply on No Validation On Laravel Form::Select

@usman This is my form:

 {!! Form::open(['method'=>'POST','url'=>'wizard/js/professional','novalidate'=>'novalidate','id'=>'jsProfessional-form','class'=>'ali-form']) !!}

And i removed default value as directed by you.. still no effect

AliMalik left a reply on No Validation On Laravel Form::Select

Yes @Usman Id is there, if i use simple markup it is infect working as it should, but not with form::select

AliMalik left a reply on No Validation On Laravel Form::Select

Well no , console is clean, with no errors

AliMalik left a reply on No Validation On Laravel Form::Select

jquery validation actually works with name of the filed , but i have assigned id as suggested by you, still no effect

AliMalik left a reply on No Validation On Laravel Form::Select

Html by using simple markup:

<select name="fieldexperience">
           <option value="0" selected="selected" >Field Experience</option>
           <option value="1">Beginner</option>
           <option value="2">Intermediate</option>
           <option value="3">Advanced</option>
 </select>

Html generated by form builder:

<select id="fieldexperience" name="fieldexperience">
         <option value="0" selected="selected" >Field Experience</option>
         <option value="1">Beginner</option>
        <option value="2">Intermediate</option>
        <option value="3">Advanced</option>
</select>

AliMalik left a reply on No Validation On Laravel Form::Select

@pmall Nope , still not working

AliMalik left a reply on DUPLICATE The Default Laravel 5 Auth Component

Well i have seme issue and i ended up using Sboo multiauth for L5 https://github.com/sboo/multiauth

AliMalik started a new conversation No Validation On Laravel Form::Select

I am using jqueryValidation plugin for client side validation. If i use simple html markup, validation is working fine as expected :

<select name="fieldexperience">
    <option value="0" selected="selected" disabled="disabled">Field Experience</option>
    <option value="1">Beginner</option>
        <option value="2">Intermediate</option>
        <option value="3">Advanced</option>
</select>

And script for this select is :

<script language="javascript" type="text/javascript">
        $(function()
        {
            $("#jsProfessional-form").validate(
                    {
                        // Rules for form validation
                        rules:
                        {
                            fieldexperience:
                            {
                                required: true
                            }
            },
            // Messages for form validation
                        messages:
                        {
                            fieldexperience:
                            {
                                required: 'Field is Required'
                            },
            }

And this is taking effect.. Now If i replace my select element with Laravel form builder, it is not working:

{!! Form::select('fieldexperience',$experienceArray,'0',[]) !!}

Any suggestion??

AliMalik left a reply on PHPStorm + New Laravel 5.1 Install - Multiple Definitions?

I am also having these weird squiggles for multiple definitions exist . I am using IDE helper.

AliMalik started a new conversation Eloquent Relationships , Request

I am trying to save personal info of user that is provided through form The relation i defined is

public function JsPersonalInfo()
    {
        return $this->hasOne('App\Models\JsModels\TblJsPersonalInfo','pkJsPersonalInfoId');
    }

Post method to store is

public function postPersonal(Request $request)
    {
         //Auth::js()->get(); //Current authenticated user
    //JsPersonalInfo() // Relation between Account Model and Personal info model
        Auth::js()->get()->JsPersonalInfo()->save(new TblJsPersonalinfo($request->get(['firstname','lastname','dateofbirth','cnic','location','gender','aboutme'])));

Now if i use $request ->get i am getting :

array_key_exists(): The first argument should be either a string or an integer

if i use $request ->input i am getting :

Illegal offset type in isset or empty

And manully setting everthing works fine..

24 May
4 years ago

AliMalik left a reply on Laracasts I Love You

Agreed !! will never stop learning...

AliMalik started a new conversation Laracasts I Love You

I am new to laravel and Learning it, trying to comprehend complicated concepts and implementing them, getting errors trying to solve them seeking help and so on. Firstly i must say laravel is really an elegant framework. Secondly the laravel community in general and specifically laracasts community is so awesome. You guys are really helpful. I have seen people asking a vast range of questions (professional to even silly), and all guys here are helping to the best of their potential.. @JeffreyWay is an excellent teacher, all of these guys who helped me directly or indirectly i found thier posts usefull are (and of course There are many more of you) @bashy @bestmomo @pmall @nolros @RachidLaasri @jimmck @bobbybouwmann @Kryptonit3 Hats off to you guys.. Thanks