matheenulla

matheenulla

junior web developer at Bangalore

Member Since 6 Months Ago

bangalore

Experience Points
6,970
Total
Experience

3,030 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
35
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
6,970 XP
Feb
17
1 week ago
Activity icon

Replied to Call To A Member Function AssignRole() On Bool

@click thank you very very much. It is working now. Very nice explanation thank you once again.

Activity icon

Started a new Conversation Call To A Member Function AssignRole() On Bool

Hi

I am using Spatie laravel roles and permission package. While updating roles I am getting an error.

Call to a member function assignRole() on bool

blade file

  <div class="col-lg-8">
                <div class="form-group">
                    @foreach($role as $role)
                     <input type="checkbox" name="role[]" id="{{ $role->id}}" value="{{ $role->id }}" 
                     @if($role->name == preg_replace('/[^A-Za-z0-9\-]/', '', \App\User::find($user->id)->getRoleNames()))
                     checked
                     @endif> &nbsp;{{$role->name}}
                    <br/>
                    @endforeach
                </div>
            </div>

controller file

 public function edit($id)
    {
        $role = Role::all();
        $user = User::find($id);
        return view('users.edit',compact('user','role'));
    }


 public function update(Request $request,$id)
    {
        $user =  User::find($id)->update([

            'name' => $request->fullname,
            'email' => $request->email,
            'password' => Hash::make($request->mobile),
            'mobile' => $request->mobile,
            'gender' => $request->gender,
            'city' => $request->city,
            'state' => $request->state,
            'pincode' => $request->pincode,
            'address' => $request->address

        ]);

        DB::table('model_has_roles')->where('model_id',$id)->delete();

        //dd($request->input('role'));

        $user->assignRole($request->input('role'));


        return redirect('users')->with('success','User Updated Successfully');

    }

thank you

Feb
12
1 week ago
Activity icon

Replied to How To Create Single Mutator For Multple Fields Using Laravel

@sti3bas @ahkeravi thank you very much for helping not it's working

Feb
10
2 weeks ago
Activity icon

Replied to How To Create Single Mutator For Multple Fields Using Laravel

@ahkeravi the result which I am getting.

"10-02-2020"

according to me, I have made a mistake in the model. I am not understanding what is $key and $value in __set($key, $value) function

public function __set($key, $value)
    {
         if(in_array($key, ['project_startdate', 'project_enddate'])){
            $this->attributes[$key] = Carbon::createFromFormat('d-m-Y', $value)->format('Y-m-d');
        } 
    }
Activity icon

Replied to How To Create Single Mutator For Multple Fields Using Laravel

@matheenulla my controller code

 public function store(Request $request)
    {
         Project::create([
            'project_type' => $request->project_type,
            'customer_name' => $request->customer_name,
            'project_name' => $request->projectname,
            'project_description' => $request->project_description,
            'project_startdate' => $request->project_startdate,
            'project_enddate' => $request->project_enddate,
            'project_budget' => $request->project_budget,
        ]); 

        return redirect('projects')->with('success','Project Created Successfully');

    }
Activity icon

Replied to How To Create Single Mutator For Multple Fields Using Laravel

@ahkeravi Yes Added, getting same error. I think I have made a mistake in model.

Activity icon

Replied to How To Create Single Mutator For Multple Fields Using Laravel

@ahkeravi I tried this but not working. For single mutators it is working fine. for multiple fields mutators, it is not working.

 public function setProjectStartDateAttribute($input)
    {
       $this->attributes['project_startdate'] = \Carbon\Carbon::createFromFormat('d-m-Y', $input)->format('Y-m-d');
    }

    public function getProjectStartDateAttribute($value)
    {
       return \Carbon\Carbon::parse($value)->format('d-m-Y');
    }

But the above code will take time. For each attribute, I need a create a mutator.

Activity icon

Replied to How To Create Single Mutator For Multple Fields Using Laravel

@ahkeravi Hey thanks for helping. But it is not working showing the same error.

Activity icon

Started a new Conversation How To Create Single Mutator For Multple Fields Using Laravel

Hi

I want to create a single mutator for multiple fields for date format. I have tried different ways but it is not working. I am getting an error. I am not understanding where I am making a mistake.

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect date value: '10-02-2020' for column `usermanagement`.`projects`.`project_startdate` at row 1 (SQL: insert into `projects` (`project_type`, `customer_name`, `project_name`, `project_description`, `project_startdate`, `project_enddate`, `project_budget`) values (Web Application Development, 3, renovation homecenter, sfdf, 10-02-2020, 03-02-2020, 10000))

My model


protected $fillable = [
        'project_type',
        'customer_name',
        'project_name',
        'project_description',
        'project_startdate',
        'project_enddate',
        'project_budget',
    ];


public function __set($key, $value)
    {
         if(in_array($key, ['project_startdate', 'project_enddate'])){
            $this->attributes[$key] = Carbon::createFromFormat('d-m-Y', $value)->format('Y-m-d');
        } 
    }

    public function __get($name) 
    {
        return Carbon::parse($name)->format('d-m-Y');
    }

thank you

Jan
30
3 weeks ago
Activity icon

Replied to Laravel Adldap2/adldap2-laravel Package

@jove I tried But not working.

Jan
29
3 weeks ago
Activity icon

Replied to Laravel Adldap2/adldap2-laravel Package

@jove thanks for helping. I try with that.

What I want is I just want to see whether the user present in the LDAP server. If the user is present then I need to check in my local database. If the user is present then I need to allow to view my application. The main thing is I cannot correct the configuration setting.

If you have, Can you please share your configuration settings it will be very very helpful.

Thank you

Activity icon

Started a new Conversation Laravel Adldap2/adldap2-laravel Package

Hi

I am implementing LDAP authentication in laravel app. I am not getting LDAP users when I run this code I am getting an empty collection.

 protected function attemptLogin(Request $request)
    {
       $ldap = new Adldap;
       $data = Adldap::getDefaultProvider()->search()->users()->get();
   
       dd($data);

    }

I got LDAP credential from clients but I am not understanding how to add in .env files.

the credential which I got

User Name: username
 Password: password
 IP:172.16.xx.xx
 Port: 389
 Attributes: CN=user.admin,CN=Users,DC=UATADSRV,DC=COM

my .env file

LDAP_HOSTS=172.16.xx.xx
LDAP_BASE_DN=CN=user.admin,CN=Users,DC=UATADSRV,DC=COM
LDAP_USER_ATTRIBUTE=samaccountname
LDAP_CONNECTION=default
LDAP_USERNAME=username
LDAP_PASSWORD=password

ldap.php

return [

    'logging' => env('LDAP_LOGGING', false),

    'connections' => [

        'default' => [
   'auto_connect' => env('LDAP_AUTO_CONNECT', true),

            'connection' => Adldap\Connections\Ldap::class,
       
            'settings' => [
    'schema' => Adldap\Schemas\ActiveDirectory::class,


                'account_prefix' => env('LDAP_ACCOUNT_PREFIX', ''),

                'account_suffix' => env('LDAP_ACCOUNT_SUFFIX', ''),   

                'hosts' => explode(' ', env('LDAP_HOSTS', 'corp-dc1.corp.acme.org corp-dc2.corp.acme.org')),

         'port' => env('LDAP_PORT', 389),

                'timeout' => env('LDAP_TIMEOUT', 5),

                'base_dn' => env('LDAP_BASE_DN', 'dc=corp,dc=acme,dc=org'),

                'username' => env('LDAP_USERNAME'),
                'password' => env('LDAP_PASSWORD'),

                'follow_referrals' => false,


                'use_ssl' => env('LDAP_USE_SSL', false),
                'use_tls' => env('LDAP_USE_TLS', false),

            ],

        ],

    ],

];


ldap_auth.php

return [

    'connection' => env('LDAP_CONNECTION', 'default'),

    'provider' => Adldap\Laravel\Auth\DatabaseUserProvider::class,

    'model' => App\User::class,
    'rules' => [

        // Denys deleted users from authenticating.

        Adldap\Laravel\Validation\Rules\DenyTrashed::class,

        // Allows only manually imported users to authenticate.

        // Adldap\Laravel\Validation\Rules\OnlyImported::class,

    ],

    /*
    |--------------------------------------------------------------------------
    | Scopes
    |--------------------------------------------------------------------------
    |
    | Scopes allow you to restrict the LDAP query that locates
    | users upon import and authentication.
    |
    | All scopes must implement the following interface:
    |
    |   Adldap\Laravel\Scopes\ScopeInterface
    |
    */

    'scopes' => [

        // Only allows users with a user principal name to authenticate.
        // Suitable when using ActiveDirectory.
        // Adldap\Laravel\Scopes\UpnScope::class,

        // Only allows users with a uid to authenticate.
        // Suitable when using OpenLDAP.
        // Adldap\Laravel\Scopes\UidScope::class,

    ],

    'identifiers' => [

    'rules' => [

        // Denys deleted users from authenticating.

        Adldap\Laravel\Validation\Rules\DenyTrashed::class,

        // Allows only manually imported users to authenticate.

        // Adldap\Laravel\Validation\Rules\OnlyImported::class,

    ],

    /*
    |--------------------------------------------------------------------------
    | Scopes
    |--------------------------------------------------------------------------
    |
    | Scopes allow you to restrict the LDAP query that locates
    | users upon import and authentication.
    |
    | All scopes must implement the following interface:
    |
    |   Adldap\Laravel\Scopes\ScopeInterface
    |
    */

    'scopes' => [

        // Only allows users with a user principal name to authenticate.
        // Suitable when using ActiveDirectory.
        // Adldap\Laravel\Scopes\UpnScope::class,

        // Only allows users with a uid to authenticate.
        // Suitable when using OpenLDAP.
        // Adldap\Laravel\Scopes\UidScope::class,

    ],

    'identifiers' => [

 'ldap' => [

         //   'locate_users_by' => 'userprincipalname',
             'locate_users_by' => 'samaccountname',

            'bind_users_by' => 'distinguishedname',

        ],

        'database' => [

            'guid_column' => 'objectguid',
           'username_column' => 'username',

        ],
  'windows' => [

            'locate_users_by' => 'samaccountname',

            'server_key' => 'AUTH_USER',

        ],

    ],

    'passwords' => [

     

        'sync' => env('LDAP_PASSWORD_SYNC', false),

      

        'column' => 'password',
  ],


    'login_fallback' => env('LDAP_LOGIN_FALLBACK', false),

  

    'sync_attributes' => [

        'email' => 'userprincipalname',
        'username' => 'samaccountname',
        'name' => 'cn',

    ],

  'logging' => [

        'enabled' => env('LDAP_LOGGING', true),

        'events' => [

            \Adldap\Laravel\Events\Importing::class                 => \Adldap\Laravel\Listeners\LogImport::class,
            \Adldap\Laravel\Events\Synchronized::class              => \Adldap\Laravel\Listeners\LogSynchronized::class,
            \Adldap\Laravel\Events\Synchronizing::class             => \Adldap\Laravel\Listeners\LogSynchronizing::class,
            \Adldap\Laravel\Events\Authenticated::class             => \Adldap\Laravel\Listeners\LogAuthenticated::class,
            \Adldap\Laravel\Events\Authenticating::class            => \Adldap\Laravel\Listeners\LogAuthentication::class,
            \Adldap\Laravel\Events\AuthenticationFailed::class      => \Adldap\Laravel\Listeners\LogAuthenticationFailure::class,
            \Adldap\Laravel\Events\AuthenticationRejected::class    => \Adldap\Laravel\Listeners\LogAuthenticationRejection::class,
            \Adldap\Laravel\Events\AuthenticationSuccessful::class  => \Adldap\Laravel\Listeners\LogAuthenticationSuccess::class,
            \Adldap\Laravel\Events\DiscoveredWithCredentials::class => \Adldap\Laravel\Listeners\LogDiscovery::class,
            \Adldap\Laravel\Events\AuthenticatedWithWindows::class  => \Adldap\Laravel\Listeners\LogWindowsAuth::class,
            \Adldap\Laravel\Events\AuthenticatedModelTrashed::class => \Adldap\Laravel\Listeners\LogTrashedModel::class,

        ],
    ],

];


I don't whether it is correct or not. Please help me out @Sinnbeck how to test LDAP connection using this credential.

Jan
28
3 weeks ago
Activity icon

Replied to How To Use Multiple Database Connection In Laravel (mysql And Oracle)

@manelgavalda thank you for helping. Today I solved this bug.

Jan
23
1 month ago
Activity icon

Replied to How To Use Multiple Database Connection In Laravel (mysql And Oracle)

@manelgavalda thanks for replying. I just go through that link. I am getting this error in .env file

DB_CONNECTION=oracle_db
DB_HOST_ORA=127.0.0.1
DB_PORT_ORA=1531
DB_DATABASE_ORA=SID
DB_USERNAME_ORA=username
DB_PASSWORD_ORA=password
Activity icon

Started a new Conversation How To Use Multiple Database Connection In Laravel (mysql And Oracle)

Hi

In my laravel project, I want to use multiple database connections that is MySQL and oracle. My default database is MySQL and I need the oracle database only to get the details.

I successfully installed this package for oracle https://github.com/yajra/laravel-oci8.

But now I am getting an error

Use of undefined constant OCI_CRED_EXT - assumed 'OCI_CRED_EXT' (this will throw an Error in a future version of PHP)

my configuration settings

database.php file

 'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

        'oracle_db' => [
            'driver'        => 'oracle',
            'tns' => env('SID', '( DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = lsprodappsapdb.lmggi.com)(PORT = 1531))
            (CONNECT_DATA =
              (SID=ILPRD)
            )
            )'),
            'host'          => env('DB_HOST_ORA', ''),
            'port'          => env('DB_PORT_ORA', '1531'),
            'database'      => env('DB_DATABASE_ORA', ''),
            'username'      => env('DB_USERNAME_ORA', ''),
            'password'      => env('DB_PASSWORD_ORA', ''),
            'charset'       => env('DB_CHARSET', 'AL32UTF8'),
            'prefix'        => env('DB_PREFIX', ''),
           'prefix_schema' => env('DB_SCHEMA_PREFIX', ''),
           'edition'       => env('DB_EDITION', 'ora$base'),
      ],

.envfile

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=landmarklaisa
DB_USERNAME=username
DB_PASSWORD=password

DB_CONNECTION=oracle_db
DB_HOST_ORA=127.0.0.1
DB_PORT_ORA=1531
DB_DATABASE_ORA=SID
DB_USERNAME_ORA=username
DB_PASSWORD_ORA=password

thank you

Jan
15
1 month ago
Activity icon

Replied to Unable To Login In Laravel Using LDAP Package Adldap2-Laravel

@jove ok, thank you for helping I will try that one.

Activity icon

Replied to Unable To Login In Laravel Using LDAP Package Adldap2-Laravel

@jove I didn't get any reply for that Post. And it's related to that only

Activity icon

Replied to Unable To Login In Laravel Using LDAP Package Adldap2-Laravel

@jove Thanks for replying. I followed the documentation and this link https://jotaelesalinas.github.io/laravel-simple-ldap-auth/ But I am unable to login

Jan
14
1 month ago
Activity icon

Started a new Conversation Unable To Login In Laravel Using LDAP Package Adldap2-Laravel

Hi

I am using the Adldap2-Laravel package for authentication. I am testing using the LDAP test forum. I followed this tutorial https://jotaelesalinas.github.io/laravel-simple-ldap-auth/ But I am unable to login. I am not getting any errors. In the below code always else block is executing.

I think I have made mistake in configuration Please help me

Thank You

login controller

  protected function attemptLogin(Request $request)
    {
        
        $credentials = $request->only($this->username(), 'password');
        $username = $credentials[$this->username()];
        $password = $credentials['password'];

        $user_format = env('LDAP_USER_FORMAT', 'cn=%s,'.env('LDAP_BASE_DN', ''));
        $userdn = sprintf($user_format, $username);


        if(Adldap::auth()->attempt($userdn, $password, $bindAsUser = true)) {

            dd('working'); 
        }
        else
        {
            dd('not working');

        }  
    }

env file

LDAP_SCHEMA=OpenLDAP
LDAP_HOSTS=ldap.forumsys.com
LDAP_BASE_DN=dc=example,dc=com
LDAP_USER_ATTRIBUTE=uid
LDAP_USER_FORMAT=uid=%s,dc=example,dc=com
LDAP_CONNECTION=default

# Change from mysql to sqlite:

DB_CONNECTION=sqlite  

ldap.php

return [

    'logging' => env('LDAP_LOGGING', false),
    
    'connections' => [
        'default' => [
       'auto_connect' => env('LDAP_AUTO_CONNECT', false),

            'connection' => Adldap\Connections\Ldap::class,
            'settings' => [

                'schema' => env('LDAP_SCHEMA', '') == 'OpenLDAP' ?
                Adldap\Schemas\OpenLDAP::class :
                ( env('LDAP_SCHEMA', '') == 'FreeIPA' ?
                    Adldap\Schemas\FreeIPA::class :
                    Adldap\Schemas\ActiveDirectory::class ),

                'account_prefix' => env('LDAP_ACCOUNT_PREFIX', ''),
                'account_suffix' => env('LDAP_ACCOUNT_SUFFIX', ''),
                'hosts' => explode(' ', env('LDAP_HOSTS', 'corp-dc1.corp.acme.org corp-dc2.corp.acme.org')),
                'port' => env('LDAP_PORT', 389),
                'timeout' => env('LDAP_TIMEOUT', 5),
                'base_dn' => env('LDAP_BASE_DN', 'dc=corp,dc=acme,dc=org'),
                'username' => env('LDAP_ADMIN_USERNAME', ''),
                'password' => env('LDAP_ADMIN_PASSWORD', ''),
                'follow_referrals' => env('LDAP_FOLLOW_REFERRALS', false),
                'use_ssl' => env('LDAP_USE_SSL', false),
                'use_tls' => env('LDAP_USE_TLS', false),

            ],

        ],

    ],

];

ldap_auth.php

 'identifiers' => [
        'ldap' => [
            'locate_users_by' => env('LDAP_USER_ATTRIBUTE', 'userprincipalname'),
            'bind_users_by' => env('LDAP_USER_ATTRIBUTE', 'distinguishedname'),
        ],
    
        'database' => [
            'guid_column' => 'objectguid',
            'username_column' => 'username',
        ],
    ],

    'passwords' => [


        'sync' => env('LDAP_PASSWORD_SYNC', false),

        'column' => 'password',

    ],

  

    'login_fallback' => env('LDAP_LOGIN_FALLBACK', false),


    'sync_attributes' => [
        // 'field_in_local_db' => 'attribute_in_ldap_server',
        'username' => 'uid',
        'name' => 'cn',
        'phone' => 'telephonenumber',
    ],
Jan
10
1 month ago
Activity icon

Awarded Best Reply on Unable To Install Adldap2/adldap2-laravel Package

@sinnbeck Now I can install that package. My problem was I was using XAMPP server. So In php.ini file I need to un-comment the following line by removing semi-colon.

extension=ldap

Thank you once again

Activity icon

Replied to Unable To Install Adldap2/adldap2-laravel Package

@sinnbeck Now I can install that package. My problem was I was using XAMPP server. So In php.ini file I need to un-comment the following line by removing semi-colon.

extension=ldap

Thank you once again

Activity icon

Replied to Unable To Install Adldap2/adldap2-laravel Package

@sinnbeck I just run composer install not working. Again I will create a new project and try to install that package. Thank you for helping

Activity icon

Replied to Unable To Install Adldap2/adldap2-laravel Package

@sinnbeck No, this is the new project I have created. when I run this command

 composer require adldap2/adldap2-laravel

I am getting an error.

and I tried do it like this by adding in composer.json

"adldap2/adldap2-laravel": "^6.0",

composer update

but getting same error

Activity icon

Started a new Conversation Unable To Install Adldap2/adldap2-laravel Package

Hi

I just created a new project in laravel. When I tried installing this package (adldap2/adldap2-laravel) I am getting an error.

 Problem 1
    - adldap2/adldap2-laravel v6.0.8 requires adldap2/adldap2 ^10.1 -> satisfiable by adldap2/adldap2[v10.1.0, v10.1.1, v10.2.0, v10.2.1, v10.2.2].
    - adldap2/adldap2-laravel v6.0.0 requires adldap2/adldap2 ^10.0 -> satisfiable by adldap2/adldap2[v10.0.0, v10.0.1, v10.0.10, v10.0.11, v10.0.2, v10.0.3, v10.0.4, v10.0.5, v10.0.6, v10.0.7, v10.0.8, v10.0.9, v10.1.0, v10.1.1, v10.2.0, v10.2.1, v10.2.2].
    - adldap2/adldap2-laravel v6.0.1 requires adldap2/adldap2 ^10.0 -> satisfiable by adldap2/adldap2[v10.0.0, v10.0.1, v10.0.10, v10.0.11, v10.0.2, v10.0.3, v10.0.4, v10.0.5, v10.0.6, v10.0.7, v10.0.8, v10.0.9, v10.1.0, v10.1.1, v10.2.0, v10.2.1, v10.2.2].
    - adldap2/adldap2-laravel v6.0.2 requires adldap2/adldap2 ^10.0 -> satisfiable by adldap2/adldap2[v10.0.0, v10.0.1, v10.0.10, v10.0.11, v10.0.2, v10.0.3, v10.0.4, v10.0.5, v10.0.6, v10.0.7, v10.0.8, v10.0.9, v10.1.0, v10.1.1, v10.2.0, v10.2.1, v10.2.2].

composer.json file

"require": {
        "php": "^7.2",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "^6.2",
        "laravel/tinker": "^2.0"
    },
Jan
05
1 month ago
Activity icon

Replied to How To Check A Variable Has Some Value Or Not

@fylzero I solved this using the above method which you have told me thank you very much

Jan
04
1 month ago
Activity icon

Replied to How To Check A Variable Has Some Value Or Not

@fylzero not working, one more thing my collection file is located in App\Imports\StaffImport and controller is App\Http\Controller Now I got the point how to do. I am trying now bypassing parameter to the collection.

Thank for helping

Activity icon

Replied to How To Check A Variable Has Some Value Or Not

@fylzero thank you for replying. where do I need to initialize in controller or staffImport?

Activity icon

Started a new Conversation How To Check A Variable Has Some Value Or Not

Hi

I am importing data from excel to the database. I am using maat website 3.1 packages. I am checking first whether the excel sheet contains the same header or not. If it has the same header then I am inserting otherwise I am passing an error message in a variable. But I am unable to check the variable has some value or not.

controller file

public function import(Request $request)
    {
        $extension = $request->file('staffimport')->getClientOriginalExtension();
        if($extension=='xls' || $extension=='xlsx' || $extension=='csv')
        {
            Excel::import(new StaffImport, $request->file('staffimport'));
            if(!empty(isset($notploaded)))  //not working  only else block is executing
            {
                $staff = Staff::all();
                $message = 2;
                return view('staff.index',compact('staff','message'));

            }
            else
            {
                return redirect('staff')->with('success','Staff Added Successfully');

            }

                
        }
        else
        {
            $staff = Staff::all();
            $message = 1;
            return view('staff.index',compact('staff','message'));
        }
    }

staffimport file

       public function collection(Collection $rows)
      {
        $firstrow = $rows->first()->toArray();
        if(isset($firstrow['fullname']))
        {
            foreach ($rows as $row) 
            { 
    
                if($row['fullname'] != '' )
                {
    
                    Staff::create([
                        'full_name' => $row['fullname'],
                    ]);
    
                } 
               
            }

        }
        else
        {
            return $notploaded = 'not uploaded';
        }   
    }

thank you

Dec
31
1 month ago
Activity icon

Started a new Conversation How To Create A JWT Token With A Role Of A User ( Spatie JWT Web Token)

Hi

I want to pass the role of a user after login. Instead of passing like below

 return response()->json([  
            'success' => true, 
            'access_token' => $token,
            'token_type' => 'bearer',
             'role' => auth('api')->user()->getRoleNames()
            /* 'expires_in' => auth('api')->factory()->getTTL() * 60 */
        ]);

I want to encode a role of a user with a JWT token. what I have tried

    public function login()
    {
        $credentials = request(['email', 'password']);

        if (! $token = auth()->guard('api')->attempt($credentials)) {
            return response()->json(['errors' => 'In-valid username and Password'], 401);
        }
        return $this->respondWithToken($token);
    }

  protected function respondWithToken($token)
    {

        $role =auth('api')->user()->getRoleNames();
        $payload = JWTFactory::make($role); 
        $token = JWTAuth::encode($payload);

        return response()->json([  
            'success' => true, 
            'access_token' => $token,
            'token_type' => 'bearer',
            /* 'role' => auth('api')->user()->getRoleNames() */
            /* 'expires_in' => auth('api')->factory()->getTTL() * 60 */
        ]);
    }

when I tried this I am not getting a token by seeing this documentation https://github.com/tymondesigns/jwt-auth/wiki/Creating-Tokens

Dec
27
1 month ago
Activity icon

Replied to [Vue Warn]: Error Compiling Template:

@nakov I am using left fixed sidebar so I am not closing that div. But Now I got the error why it is coming thank you very much

Activity icon

Replied to [Vue Warn]: Error Compiling Template:

@nakov If I closed div than sidebar will not work

Activity icon

Replied to [Vue Warn]: Error Compiling Template:

yes I am using <router-link> in body tag

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="
viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Admiin Panel</title>
    
</head>
<body id="page-top">
        <div id="wrapper">
        <ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">

      <li class="nav-item active">
        <router-link  to="/dashboard" class="nav-link" exact>
          <i class="fas fa-fw fa-tachometer-alt"></i>
          <a>Dashboard</a>
        </router-link>
      </li>
     <li class="nav-item active">
        <router-link  to="/dashboard" class="nav-link" exact>
          <i class="fas fa-fw fa-tachometer-alt"></i>
          <a>Dashboard</a>
        </router-link>
      </li>
</ul>
</body>
</html>
Activity icon

Replied to [Vue Warn]: Error Compiling Template:

@nakov no this is my first component and I am not using anything like this.

this is my component

<template>

<div class="container">
    <h1>This is dashboard</h1>
</div>


</template>

<script>

export default {

        mounted() {
            console.log('loaded');
           
        }
    }


</script>
Activity icon

Started a new Conversation [Vue Warn]: Error Compiling Template:

Hi

I just started with VueJs Everything is working fine but I am getting an error in console like this

app.js:41046 [Vue warn]: Error compiling template:

Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <script>, as they will not be parsed.

189|    <script src="http://127.0.0.1:8000/js/sb-admin-2.min.js"></script>
191|    <script src="http://127.0.0.1:8000/vendor/chart.js/Chart.min.js"></script>
192|    <script src="http://127.0.0.1:8000/js/demo/chart-area-demo.js"></script>
193|    <script src="http://127.0.0.1:8000/js/demo/chart-pie-demo.js"></script>
194|    <script src="http://127.0.0.1:8000/js/app.js"></script></div></div></div>

my form

home.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Admin Panel</title>
    <link href="{{ url('vendor/fontawesome-free/css/all.min.css')}}" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">

  <!-- Custom styles for this template-->
  <link href="{{ url('css/sb-admin-2.min.css') }}" rel="stylesheet">

</head>
<body>

<div id="app">
   @include('layouts.sidebar')
    <router-view></router-view>
</div>



  @include('layouts.footer')

  <script src="{{ url('vendor/jquery/jquery.min.js') }}"></script>
  <script src="{{ url('vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>

  <script src="{{ url('vendor/jquery-easing/jquery.easing.min.js') }}"></script>

  <script src="{{ url('js/sb-admin-2.min.js') }}"></script>

  <script src="{{ url('vendor/chart.js/Chart.min.js') }}"></script>
  <script src="{{ url('js/demo/chart-area-demo.js') }}"></script>
  <script src="{{ url('js/demo/chart-pie-demo.js') }}"></script>
  <script src="{{ url('js/app.js') }}"></script> 
    
</body>
</html>
Dec
22
2 months ago
Activity icon

Replied to Laravel Checkbox Problem

@snapey @tray2 thank you very very much for helping. Thanks @snapey for giving me a nice idea

Dec
21
2 months ago
Activity icon

Started a new Conversation Laravel Checkbox Problem

Hi

I want to assign new permission for different users using the checkbox. So what I am doing is getting all permission first and checking if the user already has that permission. if user has that permission then the checkbox is checked otherwise un-checked.

My code is working fine but first permission is coming as un-checked please check my below code.

controller

 public function edit($id)
    {

        $role = Role::find($id);

        $data = $role->permissions; 
        
        $json = json_decode($data,true);
        $permission = Permission::get();

        return view('roles.edit',compact('role','permission','json'));


    }

view file

 @foreach($permission as $perm)

               <input type="checkbox" name="permission[]"  id="{{ $perm->id}}" value="{{$perm->name}}" 
                      @if(array_search($perm->name,array_column($json, 'name'))) 
                      checked="checked"
                      @endif > &nbsp; {{$perm->name}}
               <br/>
 @endforeach

I have attached a file for better understanding

https://drive.google.com/open?id=1r3BKL7bM5u24Mc9_PdsyVf_fzrNlfl5N

Dec
20
2 months ago
Activity icon

Replied to Can I Use Where() With Relation Like HasMany Or HasOne In Laravel.

@usman_shaheen yes, you can have where clause for hasMany relation. Show your models so we can give some examples

Dec
18
2 months ago
Activity icon

Replied to How To Use Spatie Permission In Laravel Yajra Datatables

@nakov @sujancse thank you very much it is working now

Activity icon

Replied to How To Use Spatie Permission In Laravel Yajra Datatables

@sujancse I also need to do the same thing. How you are passing ID?

Activity icon

Replied to How To Use Spatie Permission In Laravel Yajra Datatables

@nakov oh ok, thank you I will try this now I let you know

Activity icon

Replied to How To Use Spatie Permission In Laravel Yajra Datatables

@jlrdw I tried writing in the controller like this


$user = Auth()->user();

  ->addColumn('View',function($outlet,$user){
                if($user->can('view')){

                            return  '<a target="_blank" href="ViewOutlet/'.$outlet->id.'" class="btn btn-primary">View</a>';

            }
              
            })
            ->addColumn('Edit',function($outlet,$user){
                 if($user->can('edit')){
        return  '<a target="_blank" href="editoutlet/'.$outlet->id.'" class="btn btn-success">Edit</a>';

        }
        
                
            })
            ->addColumn('Delete',function($outlet,$user){
        if($user->can('edit')){
                   return  '<a target="_blank" href="deleteoutlet/'.$outlet->id.'" class="btn btn-danger">Delete</a>';

        }
            
            })
            ->rawColumns(['View','Edit','Delete'])
            ->addIndexColumn()
            ->make(true);

but it is not working

Activity icon

Started a new Conversation How To Use Spatie Permission In Laravel Yajra Datatables

Hi

I am using Laravel yajra datatables package. It is working fine but I don't understand how to add permission for tables. For example, some user may have view permission and some have edit permission etc...

In blade I was using

@can('edit)
<button>Edit</button>
@endcan

now buttons are coming from controller in datatables like this

  ->addColumn('View',function($outlet){
                return  '<a target="_blank" href="ViewOutlet/'.$outlet->id.'" class="btn btn-primary">View</a>';
            })
            ->addColumn('Edit',function($outlet){
                return  '<a target="_blank" href="editoutlet/'.$outlet->id.'" class="btn btn-success">Edit</a>';
            })
            ->addColumn('Delete',function($outlet){
                return  '<a target="_blank" href="deleteoutlet/'.$outlet->id.'" class="btn btn-danger">Delete</a>';
            })
            ->rawColumns(['View','Edit','Delete'])
            ->addIndexColumn()
            ->make(true);

here how I can assign permission?

Dec
17
2 months ago
Activity icon

Replied to Laravel Query For Getting Top 10 Records With Maximum Amount

@sujancse thank you very much. after changing to integer type it is working now

Activity icon

Replied to Laravel Query For Getting Top 10 Records With Maximum Amount

@sujancse ok now I am changing column type now

Activity icon

Replied to Laravel Query For Getting Top 10 Records With Maximum Amount

@sujancse one more thing that I have same estimated loss amount for 3 different records but I am getting only one record

Activity icon

Replied to Laravel Query For Getting Top 10 Records With Maximum Amount

@sujancse I am getting the same result

my estimated loss data is like this

10000000
25000000
1500000
1200000
8000000

based on this I need top 10 records with the highest estimated loss

Activity icon

Replied to Laravel Query For Getting Top 10 Records With Maximum Amount

@sujancse but the result is not coming in order like

first record = 10,
second = 9,
third = 8


the result I am getting is 

first record = 9,
second = 10,
third = 8