Flex

Flex

Member Since 3 Years Ago

Experience Points
12,020
Total
Experience

2,980 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
7
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 3
12,020 XP
Jul
05
2 months ago
Activity icon

Replied to 404 Not Found

@tray2 this is the output

App\User {#2622 ▼
  #fillable: array:3 [▶]
  #hidden: array:2 [▶]
  #casts: array:1 [▶]
  #connection: "mysql"
  #table: "users"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:8 [▶]
  #original: array:8 [▶]
  #changes: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #visible: []
  #guarded: array:1 [▶]
  #rememberTokenName: "remember_token"
}

Activity icon

Replied to 404 Not Found

@tray2 it is user collection

Activity icon

Replied to 404 Not Found

@jeroenvanrensen it is not sucess here

Activity icon

Replied to 404 Not Found

@tykus did you mean route?

Activity icon

Replied to 404 Not Found

@frankielee following error Undefined variable: user

Activity icon

Replied to 404 Not Found

@frankielee Not sucess here

Activity icon

Replied to 404 Not Found

@frankielee same result

Activity icon

Started a new Conversation 404 Not Found

working with Laravel 7 and I have user data edit options as UserController in following

public function update(Request $request, $id)
    {
        $this->validate($request,[
            'name' => 'required|max:225',
            'email' => 'required|email|unique:users,email,'.$id
        ]);

        $user = User::findOrFail($id);
      $user->name = $request->name;
      $user->email = $request->email;
      if ($request->password_options == 'auto') {
        $length = 10;
        $keyspace = '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
        $str = '';
        $max = mb_strlen($keyspace, '8bit') - 1;
        for ($i = 0; $i < $length; ++$i) {
            $str .= $keyspace[random_int(0, $max)];
        }
        $user->password = Hash::make($str);
      } elseif ($request->password_options == 'manual') {
        $user->password = Hash::make($request->password);
      }
      $user->save();

      $user->syncRoles(explode(',', $request->roles));
      return redirect()->route("users.show", $id);
   }

and edit form url is

<form action="{{route('users.update', $user->id)}}" method="POST">
      {{method_field('PUT')}}
      {{csrf_field()}}

web.php is like this

Route::resource('/users','UserController');

but when I click edit data link following error page is visible, but my data is edited 404 Not Found

how could I fix this problem?

Jun
30
2 months ago
Activity icon

Started a new Conversation Why My Users Table Do Not Seeds With Laratrust 6

I am using Laravel 7 and Laratrust 6 user authentication system. but when I try to seeding database some tables were seeded and user table did not seeding with data. My LaratrustSeeder is as folllowing

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Config;

class LaratrustSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return  void
     */
    public function run()
    {
        $this->command->info('Truncating User, Role and Permission tables');
        $this->truncateLaratrustTables();

        $config = config('laratrust_seeder.roles_structure');
        $mapPermission = collect(config('laratrust_seeder.permissions_map'));

        foreach ($config as $key => $modules) {

            // Create a new role
            $role = \App\Role::firstOrCreate([
                'name' => $key,
                'display_name' => ucwords(str_replace('_', ' ', $key)),
                'description' => ucwords(str_replace('_', ' ', $key))
            ]);
            $permissions = [];

            $this->command->info('Creating Role '. strtoupper($key));

            // Reading role permission modules
            foreach ($modules as $module => $value) {

                foreach (explode(',', $value) as $p => $perm) {

                    $permissionValue = $mapPermission->get($perm);

                    $permissions[] = \App\Permission::firstOrCreate([
                        'name' => $permissionValue . '-' . $module,
                        'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                        'description' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                    ])->id;

                    $this->command->info('Creating Permission to '.$permissionValue.' for '. $module);
                }
            }

            // Attach all permissions to the role
            $role->permissions()->sync($permissions);

            if(Config::get('laratrust_seeder.create_users')) {
                $this->command->info("Creating '{$key}' user");
                // Create default user for each role
                $user = \App\User::create([
                    'name' => ucwords(str_replace('_', ' ', $key)),
                    'email' => $key.'@app.com',
                    'password' => bcrypt('password')
                ]);
                $user->attachRole($role);
            }

        }
    }

 /**
     * Truncates all the laratrust tables and the users table
     *
     * @return    void
     */
    public function truncateLaratrustTables()
    {
        Schema::disableForeignKeyConstraints();
        DB::table('permission_role')->truncate();
        DB::table('permission_user')->truncate();
        DB::table('role_user')->truncate();
        if(Config::get('laratrust_seeder.truncate_tables')) {
            \App\Role::truncate();
            \App\Permission::truncate();
        }
        if(Config::get('laratrust_seeder.truncate_tables') && Config::get('laratrust_seeder.create_users')) {
            \App\User::truncate();
        }
        Schema::enableForeignKeyConstraints();
    }
}

how could I fix this problem?

Jun
29
2 months ago
Activity icon

Replied to Seeding Table Not Sucess In Laravel 7 And Laratrust 6

@tray2 I have followed above steps as well but not filled with data aboved mentioned tables

Activity icon

Replied to Seeding Table Not Sucess In Laravel 7 And Laratrust 6

@tray2 in Laratrust installtion guide did not mentioned to update config app file

Activity icon

Replied to Seeding Table Not Sucess In Laravel 7 And Laratrust 6

@tray2 No any error but not filling with data above mentioned tables

Activity icon

Started a new Conversation Seeding Table Not Sucess In Laravel 7 And Laratrust 6

using Laravel 7 and Laratrust 6 and need seeding the Table using the seed command but seeding only some tables only. not seeding following tables as well in the database users,role_user,permission_user my DataBaseSeeder.php

<?php
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
   public function run()
    {
        
        $this->call(LaratrustSeeder::class); 
        }
}

and LaratrustSeeder.php

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Config;

class LaratrustSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return  void
     */
    public function run()
    {
        $this->command->info('Truncating User, Role and Permission tables');
        $this->truncateLaratrustTables();

        $config = config('laratrust_seeder.roles_structure');
        $mapPermission = collect(config('laratrust_seeder.permissions_map'));

        foreach ($config as $key => $modules) {

            // Create a new role
            $role = \App\Role::firstOrCreate([
                'name' => $key,
                'display_name' => ucwords(str_replace('_', ' ', $key)),
                'description' => ucwords(str_replace('_', ' ', $key))
            ]);
            $permissions = [];

            $this->command->info('Creating Role '. strtoupper($key));

            // Reading role permission modules
            foreach ($modules as $module => $value) {

                foreach (explode(',', $value) as $p => $perm) {

                    $permissionValue = $mapPermission->get($perm);

                    $permissions[] = \App\Permission::firstOrCreate([
                        'name' => $permissionValue . '-' . $module,
                        'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                        'description' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                    ])->id;

                    $this->command->info('Creating Permission to '.$permissionValue.' for '. $module);
                }
            }

            // Attach all permissions to the role
            $role->permissions()->sync($permissions);

            if(Config::get('laratrust_seeder.create_users')) {
                $this->command->info("Creating '{$key}' user");
                // Create default user for each role
                $user = \App\User::create([
                    'name' => ucwords(str_replace('_', ' ', $key)),
                    'email' => $key.'@app.com',
                    'password' => bcrypt('password')
                ]);
                $user->attachRole($role);
            }

        }
    }

    /**
     * Truncates all the laratrust tables and the users table
     *
     * @return    void
     */
    public function truncateLaratrustTables()
    {
        Schema::disableForeignKeyConstraints();
        DB::table('permission_role')->truncate();
        DB::table('permission_user')->truncate();
        DB::table('role_user')->truncate();
        if(Config::get('laratrust_seeder.truncate_tables')) {
            \App\Role::truncate();
            \App\Permission::truncate();
        }
        if(Config::get('laratrust_seeder.truncate_tables') && Config::get('laratrust_seeder.create_users')) {
            \App\User::truncate();
        }
        Schema::enableForeignKeyConstraints();
        
    }
}

how could I fix this problem?

Jun
28
2 months ago
Activity icon

Started a new Conversation Not Sucessfully Seeding Tables When Seeding In Laravel 7 With Laratrust

working with Laravel 7 and authenticating system Laratrust 6 and have tried seeding the tables. it has executed with some data tables with data but 3 tables did not seed. users,role_user,permission_user how could I fix this problem? my DatabaseSeeder.php file is like this

<?php
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
   public function run()
    {
        
        $this->call(LaratrustSeeder::class); 
        }
}
Jun
26
2 months ago
Activity icon

Replied to Not Working Laravel Seed

@tykus I have monitored that In my terminal it is displaying this one Truncating User, Role and Permission tables

Jun
25
2 months ago
Activity icon

Replied to Not Working Laravel Seed

@tykus it is not success for me same problem here. please check my LaratrustSeeder.php and wether is it correct or not?

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Config;

class LaratrustSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return  void
     */
    public function run()
    {
        $this->command->info('Truncating User, Role and Permission tables');
        $this->truncateLaratrustTables();

        $config = config('laratrust_seeder.roles_structure');
        $mapPermission = collect(config('laratrust_seeder.permissions_map'));

        foreach ($config as $key => $modules) {

            // Create a new role
            $role = \App\Role::firstOrCreate([
                'name' => $key,
                'display_name' => ucwords(str_replace('_', ' ', $key)),
                'description' => ucwords(str_replace('_', ' ', $key))
            ]);
            $permissions = [];

            $this->command->info('Creating Role '. strtoupper($key));

            // Reading role permission modules
            foreach ($modules as $module => $value) {

                foreach (explode(',', $value) as $p => $perm) {

                    $permissionValue = $mapPermission->get($perm);

                    $permissions[] = \App\Permission::firstOrCreate([
                        'name' => $permissionValue . '-' . $module,
                        'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                        'description' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                    ])->id;

                    $this->command->info('Creating Permission to '.$permissionValue.' for '. $module);
                }
            }

            // Attach all permissions to the role
            $role->permissions()->sync($permissions);

            if(Config::get('laratrust_seeder.create_users')) {
                $this->command->info("Creating '{$key}' user");
                // Create default user for each role
                $user = \App\User::create([
                    'name' => ucwords(str_replace('_', ' ', $key)),
                    'email' => $key.'@app.com',
                    'password' => bcrypt('password')
                ]);
                $user->attachRole($role);
            }

        }
    }

    /**
     * Truncates all the laratrust tables and the users table
     *
     * @return    void
     */
    public function truncateLaratrustTables()
    {
        Schema::disableForeignKeyConstraints();
        DB::table('permission_role')->truncate();
        DB::table('permission_user')->truncate();
        DB::table('role_user')->truncate();
        if(Config::get('laratrust_seeder.truncate_tables')) {
            \App\Role::truncate();
            \App\Permission::truncate();
        }
        if(Config::get('laratrust_seeder.truncate_tables') && Config::get('laratrust_seeder.create_users')) {
            \App\User::truncate();
        }
        Schema::enableForeignKeyConstraints();
    }
}

Jun
24
2 months ago
Activity icon

Replied to Not Working Laravel Seed

@tykus now I am using following seeding file

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(DatabaseTableSeeder::class);
        $this->call(LaratrustSeeder::class); 
        
    }
}

now My seeding is working with filling only some tables. but the following tables are not filling with data. users,role_user,permission_user, what is the problem?

Activity icon

Started a new Conversation Not Executing Laravel Laratrust Seed

I am going to executing Laravel 7 with Laratrust with following seeder files Databaseseed.php

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(DatabaseTableSeeder::class);
        $this->call([
        DatabaseSeeder::class,
        LaratrustSeeder::class,
       
 ]);
        
    }
}

and Laratrust.php

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Config;

class LaratrustSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return  void
     */
    public function run()
    {
        $this->command->info('Truncating User, Role and Permission tables');
        $this->truncateLaratrustTables();

        $config = config('laratrust_seeder.roles_structure');
        $mapPermission = collect(config('laratrust_seeder.permissions_map'));

        foreach ($config as $key => $modules) {

            // Create a new role
            $role = \App\Role::firstOrCreate([
                'name' => $key,
                'display_name' => ucwords(str_replace('_', ' ', $key)),
                'description' => ucwords(str_replace('_', ' ', $key))
            ]);
            $permissions = [];

            $this->command->info('Creating Role '. strtoupper($key));

            // Reading role permission modules
            foreach ($modules as $module => $value) {

                foreach (explode(',', $value) as $p => $perm) {

                    $permissionValue = $mapPermission->get($perm);

                    $permissions[] = \App\Permission::firstOrCreate([
                        'name' => $permissionValue . '-' . $module,
                        'display_name' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                        'description' => ucfirst($permissionValue) . ' ' . ucfirst($module),
                    ])->id;

                    $this->command->info('Creating Permission to '.$permissionValue.' for '. $module);
                }
            }

            // Attach all permissions to the role
            $role->permissions()->sync($permissions);

            if(Config::get('laratrust_seeder.create_users')) {
                $this->command->info("Creating '{$key}' user");
                // Create default user for each role
                $user = \App\User::create([
                    'name' => ucwords(str_replace('_', ' ', $key)),
                    'email' => $key.'@app.com',
                    'password' => bcrypt('password')
                ]);
                $user->attachRole($role);
            }

        }
    }

    /**
     * Truncates all the laratrust tables and the users table
     *
     * @return    void
     */
    public function truncateLaratrustTables()
    {
        Schema::disableForeignKeyConstraints();
        DB::table('permission_role')->truncate();
        DB::table('permission_user')->truncate();
        DB::table('role_user')->truncate();
        if(Config::get('laratrust_seeder.truncate_tables')) {
            \App\Role::truncate();
            \App\Permission::truncate();
        }
        if(Config::get('laratrust_seeder.truncate_tables') && Config::get('laratrust_seeder.create_users')) {
            \App\User::truncate();
        }
        Schema::enableForeignKeyConstraints();
    }
}

executing with following commands 'php artisan db:seed --class=UsersSeeder' and 'php artisan db:seed --class=LaratrustSeeder'

but some database tables not filled with data. how could I fix this problem?

Jun
23
2 months ago
Activity icon

Replied to Not Working Laravel Seed

@tykus my existing database seeder is

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Seed the application's database.
     *
     * @return void
     */
    public function run()
    {
        // $this->call(UsersTableSeeder::class);
    }
}

Activity icon

Replied to Not Working Laravel Seed

@tykus I did not used seeder class

Activity icon

Started a new Conversation Not Working Laravel Seed

working with laravel 7 and using php artisan db:seed command to table seed. then in terminal displayed database seed succesfully message. but not data table filled with data. how could I fix this problem?

Activity icon

Started a new Conversation How To Rollback Laratrust Migration

working with laravel 7 and did migration with laratrust. but now I need to rollback migration and how could I do this?

Jun
22
3 months ago
Activity icon

Started a new Conversation Laratrust Installation For Laravel 7

Hi, I am going to install laratrust for laravel 7. so, according to there installation documentation https://laratrust.santigarcor.me/docs/6.x/installation.html we do not need add providers and aliases to the app.php file? but older vertions need add both to the app.php file. wchich is the correct way?

Jun
20
3 months ago
Activity icon

Replied to Laravel Mix Build Error

no body any idea about this matter?

Activity icon

Replied to Laravel Mix Build Error

@robin7331 I could not understand what did you mean dear.

Activity icon

Replied to Laravel Mix Build Error

@michaloravec I do it but same error here

Jun
19
3 months ago
Activity icon

Started a new Conversation Laravel Mix Build Error

working with Laravel 7 and my resources->sass->app.scss is like this

@import "variables";

@import "node_modules/font-awesome/scss/font-awesome";

@import "node_modules/bulma/bulma";

@import "node_modules/buefy/src/scss/buefy";

but got Laravel mix build error here like 'ModuleBuild Error Module build faild (from./node module /saas-loader/dist/cjs.js);\rSaasError:cant find stylesheet to import.\r' @import "variables";

how could I fix this problem?