bimalshah72

bimalshah72

Member Since 4 Years Ago

Ahmedabad

Experience Points 25,060
Experience Level 6

4,940 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 47
Lessons
Completed
Best Reply Awards 25
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.

18 Feb
3 years ago

bimalshah72 left a reply on Vue Router History Option True

Yes I did the same and working fine,

Thank you

16 Feb
3 years ago

bimalshah72 started a new conversation Vue Router History Option True

Hello,

while using Vue router with history = false, and if I load url - "providers/home#!/providers/list" it is working fine with me. But if I keep history on, and try to load above url, it automatically switches to "providers/home" and giving me loading of my not_found_component.

here is my code ...

// modules/providers/app.js

// Telling Vue to use the router
Vue.use(VueRouter)

// Initializing the router with options
var router = new VueRouter({
  history: true
});


// Redirect certain routes to other routes
router.redirect({
  '/': '/providers/list',
  
})

// Define your routes here.  
// NOTE: You'd normally do something
// like require('./home/index.vue') for the component
router.map({
  // Not found handler
  '*': {
    component: not_found_component
  },
  '/providers': { 
    component: providers_index,

    subRoutes: {
      '/list': {
        component: providers_list,
      },
     
      '/:id/details': {
        component: provider_details,
        subRoutes: {
          '/demographics': {
              component: provider_demographics,
            },
          '/schedule': {
            component: provider_schedule
          }
        }
      }
    }
  },
  
});

// Declaring the app itself
var App = Vue.extend({
  
      
});

// Initializing the whole thing together
router.start(App, '#app')

Please help me

05 Jan
3 years ago

bimalshah72 started a new conversation Single Sign On Between Magento And Laravel - Both Different Domain

Hello,

I have a Magento site and Laravel solution - both with different domain. User normally registers on Magento site, How do I implement Single Sign On so that user has to log in any one of the site?

25 Aug
3 years ago

bimalshah72 started a new conversation Laravel Installer - Not Able To Create New Project - Windows

I am on WIndows 8.1, just installed homestead and laravel installer. But when I try to create new project, I am getting following error...



C:\Users\bimal\Code>laravel new blog
Crafting application...



  [GuzzleHttp\Exception\RequestException]
  cURL error 7: Failed to connect to cabinet.laravel.com port 80: Network unreachable






  [GuzzleHttp\Exception\AdapterException]
  cURL error 7: Failed to connect to cabinet.laravel.com port 80: Network unreachable



new name



C:\Users\bimal\Code>
24 Aug
3 years ago

bimalshah72 left a reply on Foreach On With Toarray

@FutureWeb

As per your statement, it seems that you always want first phone and it's all reviews (Single or more)

I think, so when you get first(), it always returns Object of phone, instead of collection. Hence instead of getting array, it should be,

$phone = Phone::with('reviews','specifications','retailers')->first(); 

and then

 @foreach($phone->reviews as $r) //this will take care whether it is single or more records.
            // html - 
   @endforeach
23 Aug
3 years ago

bimalshah72 left a reply on Laravel With Wamp

@lifesound

I am running laravel in wamp only.

I am doing following....

  1. create laravel project in wamp\www
  2. uncomment following line in \bin\apache\apache2.4.9\conf\httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

  1. set virtual host in -\bin\apache\apache2.4.9\conf\extra\httpd-vhost.conf
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:\wamp\www\doc2door\public"
    ServerName local.doctodoor.com
    ServerAlias www.local.doctodoor.com
    ErrorLog logs/localhost
    CustomLog logs/localhost-access_log common
    
    <Directory "C:\wamp\www\doc2door\public">
    AllowOverride all
    Require all granted
    </Directory>
    
</VirtualHost>
  1. C:\Windows\System32\drivers\etc\hosts file, enter host entry
22 Aug
3 years ago

bimalshah72 left a reply on Model Not Being Saved After AJAX Call

@bobbybouwmann

I think he is not doing any mass assignment - still $fillable matters?

bimalshah72 left a reply on Can't Access My Model In Listener?

@andrew.malinnikov

I think 'post' property belongs to child class (ThingHappenedEvent) , which extends Event class, and hence using Event class you can not access 'post' property. While reverse is true, it any public / protected property in parent class, it is accessible from child class

21 Aug
3 years ago

bimalshah72 left a reply on Laravel 5.1 And SweetAlert Ajax Token For Deleting A Product

@heizenberg

oh! I think I made some mistake .. try this

$("[name='_token']")[0].value;

bimalshah72 left a reply on Laravel 5.1 And SweetAlert Ajax Token For Deleting A Product

@heizenberg

Since you have used Form::open - it already adds CSRF token and adds hidden fields behind the scene

<input name="_token" type="hidden" value="somelongvalue">

Hence no need to add any code for csrf token, only you need to access in your javascript

$("[name='_token']:first").value()
20 Aug
3 years ago

bimalshah72 left a reply on Multi Auth From Single Table

@netcore

I don't think you need two separate authentication or login. Simply you need to implement Authorization - if logged in user level is 1 i.e. Admin, he/she can do all what he/she can only do + all the things which normal user can do.

Hence Admin can see all his menu / toolbar etc + user's menu and tolbar.

bimalshah72 left a reply on Managing Assets In Laravel 5

@Hibt

In a simplest form assets means - JavaScript, CSS, and images -while lies directly under public directory and publically accessible using URL.

Laravel provides helper function - asset() which generates URL for your assets. (which you can use in blade syntax, e.g.

{% raw %}

{% endraw %}

bimalshah72 left a reply on Laravel Login/Logout Multiple Authentication

@Hardie

This should make trick..

After logout at present you might redirecting your login page again,

instead redirect to your dashborad or home page.. Basically you have redirect twice ..first you are redirecting your home page where really login needs, but since now you are logged out (home page or dash board needs authenticated user), it again redirects to Login page. in my case

public function getLogout(){

        //Responsible for logout
        $this->userRepository->doLogout();
             flash()->success('Your are now logged out!');
        return redirect('/Logout');

    }
``
I have changed to 

public function getLogout(){

    //Responsible for logout
    $this->userRepository->doLogout();
         flash()->success('Your are now logged out!');
    return redirect('/');

}

It worked.

bimalshah72 left a reply on Set Input Directory For Less Function

@ojthejuice

By default source paths in elixir is 'resources/assets' and destination path is 'public' directory.

e.g. if you consider less ..then

source = resources/assets/less directory and destination is public/css directory.

You can override this, and also you can use .mix number of time, even chaining also

elixir(function(mix) {
    mix.less( [ // for more than one less, this should be an array
        'style.less',                                  
        'public/frontend-less/style.css' 
    ]); // default source and destination path

   //second less task 
    mix.less([
        "thirdparty/normalize.less",
        "app/main.less"
    ], 'public/build/css/everything.css', // destination file name with path - if you provide only dir - it creates app.css
 'resources/less' // relative directory for source - both less files are in resources/less/thirdparty/normalize.less , resources/less/app/main.less
);

});
19 Aug
3 years ago

bimalshah72 left a reply on Creating REST API With More Actions Other Than Usual CRUD.

@andfelzapata @Francismori7

What about Route Controller? Hence in future if you add more methods in controller, no need to touch Routes.php

Route::controller('lead', 'LeadController');
Route::resource('lead', 'LeadController');

This type works for me - but if I put resource first, it didn't work.

bimalshah72 left a reply on Relationship Between Users And Roles

Could you try I think if here are only 3 roles and for 2 roles needs to move further then best is

public function handle($request, Closure $next)
    {
        if(!$this->auth->guest())
        {
            if(!$this->auth-->user()->hasRole('user')) {
                return $next($request);
            }
        }

        return redirect('admin/auth/login');
    }

bimalshah72 left a reply on Relationship Between Users And Roles

@general

@thomaskim is saying

  1. Remove pivot table and its relation ship from models
  2. Add foreign key - role_id in the users table
  3. in Role model add
public function users()
{
    return $this->hasMany('App\User');
}
  1. in User model add
public function role()
{
    return $this->belongsTo('App\Role');
}

The reason is..Single user has single role but single role can be have many users and hence hasmany relationship.

Now when you say

$users = User::with('role')->get();

It gets all Users with their role - as in User model we have added role() relationship method.

bimalshah72 left a reply on Can't Access My Model In Listener?

@isaackearl

At a first glance, isn't it issue of typehint class in listener?

class ThingHappenedListener
{

    /**
     * Handle the event.
     *
     * @param Event $event
     */
    public function handle(Event $event)
    {
        dd($event->post);
    }

it should be

  public function handle(ThingHappened $event)
    {
        dd($event->post);
    }

as post property is in ThingHappened class not in Event class ??

bimalshah72 left a reply on Autocomplete Field With Vue.js

@socieboy

Also this might be useful http://vuejs.org/guide/forms.html

read Input Debounce

bimalshah72 left a reply on Mass Assignment Update Gives No Feedback

@Qlic

great! then accept my answer :)

bimalshah72 left a reply on Mass Assignment Update Gives No Feedback

@Qlic

Above solution is - provided that logged in user or authenticaed user is of type studen

bimalshah72 left a reply on Mass Assignment Update Gives No Feedback

@Qlic

Since it is one to one relationship, I think this should work

Auth::user()->student()->update($request->all());
dd('sadsada');

bimalshah72 left a reply on Mass Assignment Update Gives No Feedback

@Qlic

What is your table structure? do you have two different table, student and user?

Could you paste here your model classes?

bimalshah72 left a reply on Mass Assignment Update Gives No Feedback

@Qlic

Auth::user()->student returns collection - hence you need to iterate collection and then take id -- you should never have id - user()->student->id never work as user()->student is collection

bimalshah72 left a reply on Prevent SASS And LESS From Overwriting Each Other?

@mikebronner

mix.sass('app.scss',
        '/resources/assets/css/appsass.css', {
            includePaths: [
                paths.bootstrap + 'stylesheets',
                paths.fontawesome + 'scss'
            ]
        })
        .less('app.less',
            '/resources/assets/css/appless.css', {
            paths: [
                paths.bootstrap_select + 'less'
            ]
        })
    .styles(['appsass.css','appless.css']);
        .coffee('app.coffee');

bimalshah72 left a reply on Autocomplete Field With Vue.js

@socieboy

Best oprions would be register twitter typeahead in your vue ready function

 ready: function () {
    // register on the same element where you added v-model for field - with twitter typeahead
  }
18 Aug
3 years ago

bimalshah72 left a reply on Laravel And Vue - AJAX Post Request Error

@JoerJoers

<meta id="token" name="token" value="{{csrf_token()}}">

bimalshah72 left a reply on User Hash Password Displaying When Updating Profile

@dilfdo

Yes it is possible.

If you passing whole user model from controller to view, keeping password hidden as I shown before, it will not pass password back to edit view.

bimalshah72 left a reply on User Hash Password Displaying When Updating Profile

@dilfdo

I would suggest remove password field from edit form at all and hence password validator and manage it separately

bimalshah72 left a reply on Phpstorm & Autocomplete - Database Table Columns

@Komayo

Simple, you could't.

First of all User::all() (no need to call get()) returns you collection, not the User model. Also there is not still such support for finding property of database.

If you want to get such help, you need to define explicitly public property on User model class

bimalshah72 left a reply on User Hash Password Displaying When Updating Profile

@dilfdo

First of let me know - Do you have both add User and Edit user screen same? - I mean same blade / php page? If yes that means you are enforcing same validation password rule, and you are facing issue of password mandatory and no of characters.

Best option is remove Password input field at all from edit form and hence no validation error, but if you still want to keep password field there (of course with empty field - as you have already done hidden from server side) - for entering new password (hence editing) - then this validation stops to edit name only and submit the form.

That's the reason I told you to implement one javascript function say isEditMode which returns boolean and put it as depends attribute of rule section (conditionally enforcing validation) - now you can edit only user name and submit the form

bimalshah72 left a reply on User Hash Password Displaying When Updating Profile

@dilfdo

Yes best option is - avoid change password in user details update screen.

But if your client needs on the same page .. you need to apply conditionally validato rules, e.g.

create a javascript function which returns false if mode is edit

function isEditMode(){
    //some logic to check whether mode is edit and return boolean
}
 password: {

                    validators: {
                        notEmpty: {
               depends: isEditMode, //call this to conditionally execute
                            message: 'The Password field is required.'
                        },
                        stringLength: {
               depends: isEditMode,// call this to conditionally execute
                            min: 5,
                            max: 15,
                            message: 'The Password must be more than 5 and less than 15 characters long'
                        }

                    }
                }

17 Aug
3 years ago

bimalshah72 left a reply on User Hash Password Displaying When Updating Profile

@dilfdo

When you store password using Bcrypt - you could not get orifinal one. Hence ideally update user details should not contain password field to update. There should be separate form for updating password.

Also while updating password, you should ask some secret question etc, and straight ways there might be two empty fields - password and confirm password - You should not get back original password from the database - you need to just throw away that old password.

In the user model you need to do

class User extends Model
{
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = ['password'];
}

hence it never comes to client side

bimalshah72 left a reply on How Do You Parameterize WhereRaw() In The Query Builder?

@tag - yes

If you visit Illuminate\Database\Query\Builder you would find method This might help you

public function whereRaw($sql, array $bindings = [], $boolean = 'and')
    {
        $type = 'raw';

        $this->wheres[] = compact('type', 'sql', 'boolean');

        $this->addBinding($bindings, 'where');

        return $this;
    }

bimalshah72 left a reply on How Do You Parameterize WhereRaw() In The Query Builder?

@tag Did you try this?

 ->whereRaw("(CONCAT(clans.name,' ',ibf_members.members_display_name) like '%?%')",$searchString);

bimalshah72 left a reply on Many To Many Relationships With Eloquent

namespace App\Models;

use Illuminate\Database\Eloquent\Model;


class Album extends Model {

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'album';
    protected $primaryKey = 'album_id';

    public function userImage() {
        return $this->belongsToMany('\App\Models\UserImage', 'albumxuser_image','album_id','user_image_id');
    }
}

and

namespace App\Models;

use Illuminate\Database\Eloquent\Model;


class UserImage extends Model {

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'user_image';
    protected $primaryKey = 'user_image_id';

    protected $fillable = ['value', 'type', 'size', 'importance', 'date'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */

    public function album() {
        return $this->belongsToMany('\App\Models\Album', 'albumxuser_image','user_image_id','album_id');
    }

}

Only two models you need

$userImages = \App\Models\UserImage::with('album')->all();
    foreach ($userImages as $userImage) {
        echo $userImage->album[0]->name; // here ideally $userImage->album again collection and hence ideally you need to iterate with nested foreach loop
    }
});

bimalshah72 left a reply on Loop Through A Collection

@JSolorzano

In above link

@foreach ($products->chunk(3) as $chunk)
    <div class="row">
        @foreach ($chunk as $product)
            <div class="col-xs-4">{{ $product->name }}</div>
        @endforeach
    </div>
@endforeach

bimalshah72 left a reply on Loop Through A Collection

@JSolorzano

Could you able run manually passing parameter,

say

 $chunks = $menu->opciones->chunk(3);

Otherwise all seems ok ..http://laravel.com/docs/5.1/collections#method-chunk

bimalshah72 left a reply on Model Class Not Found (Beginner Question)

@razerdeathadder

I think this might conflict if in some other namespace have User class, otherwise it is ok.

Best to use after importing (use) class

bimalshah72 left a reply on Timezone Config Change On The Fly

@jeevan628

This works me perfectly

 \App::setLocale('Europe/London');
var_dump(\Carbon\Carbon::now());

bimalshah72 left a reply on Gulp Watch Compiling All Files

@EliasSoares

I am facing same issue.

What if implementing extension and/or custom watchers?

http://laravel.com/docs/5.1/elixir#writing-elixir-extensions

bimalshah72 left a reply on Loop Through A Collection

@JSolorzano

what is the result of intval($half)?

Also I think before iterating collection try to convert it in array

$chunksArray = $chunks-toArray();

and then use $chunksArray in foreach

bimalshah72 left a reply on Loop Through A Collection

@JSolorzano

It was an example, please use direct array instead of array_chunk

@foreach ($courses as $courseRow)

bimalshah72 left a reply on Loop Through A Collection

@JSolorzano

e.g.

@foreach (array_chunk($courses->all(), 4) as $courseRow)
    <div class="row-fluid">
        @foreach ($courseRow as $course)
            <div class="span3 learn">...</div>
        @endforeach
    </div>
@endforeach

bimalshah72 left a reply on Is Laravel Haveing A Problem With My Css Scrolling Class?

@raygun

I think this is the issue as you have used bootstrap

<div class="container">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">

here, you are wrapping content in container - browser width - and also in row div - you are using only 8 - lg column or 10 - md column depending upon screen size.

Moreover your scroll div and video div both are in the same row...

Did you try removing bootstrap related all above 3 divs?

bimalshah72 left a reply on Split An Eloquent Collection By Half

@JSolorzano

Best options is use splice - http://laravel.com/docs/5.1/collections#method-splice

$collection = collect([1, 2, 3, 4, 5]);

$chunk = $collection->splice(0,ceil($collection->count() / 2));

hence there are two collection - $chunk = first one and $collection remaining one

bimalshah72 left a reply on Model Class Not Found (Beginner Question)

@razerdeathadder

Since you are using name space App\Models for all your models. you need to Have path from root name space, e.g. \App\Models\User.

You can also use I think latest PHP syntax ..

use \App\Models\User
....
    return $this->belongsTo(User::class);
...