Fajar

Member Since 3 Years Ago

Bekasi

Experience Points
5,160
Total
Experience

4,840 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
1
Lessons
Completed
Best Reply Awards
1
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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 2
5,160 XP
Apr
11
2 days ago
Activity icon

Started a new Conversation Get Data Schedule

hey, I'm having some confusion..to pull data with the conditions I asked for like this

when a user with the teacher role logs in he can see the schedule according to the field he teaches

for my database schema

schedules

-> lesson_id
->user_id
->room_id

rooms

->user_id

teachers

->user_id

for roles I use a packages, namely easy roles and permissions in laravel

Apr
08
5 days ago
Activity icon

Replied to What's Wrong With This

@sergiu17 and @michaloravec

thank you..

I think if it is nullable without adding in the fillable it can be filled

Activity icon

Started a new Conversation What's Wrong With This

pay attention to this row, I have 1 column that is nullable this column is named ability, when I do a store procedure the value of this skill is not stored, but when we dd this skill has a value

function store


$this->validate($request, [
           'user_id'    => 'required',
           'nama'       => 'required',
       ]);


       $kelas = Room::create([
           'user_id'    => $request->input('user_id'),
           'name'       => $request->input('name'),
           'ability'   => $request->input('ability')
       ]);

in model

protected $fillable = ['name','user_id'];

but when I update this skill data, the data is stored

Thank you for the help

Apr
06
1 week ago
Activity icon

Replied to Get Data

@silencebringer

from what you suggest I have to delete the user line when I call be

 $kelas = Kela::with('wala')->get();

in blade

@foreach($kelas as $kela)
    @if ($kela->wala)
        {{ $kela->wala->user ? $kela->wala->user->name : 'Kela with id ' . $kela->id . ' and wala_id ' . $kela->wala_id . ' has wrong user_id ' . $kela->wala->user_id }}
    @else
        {{ 'Kela with id ' . $kela->id . ' has wrong wala_id ' . $kela->wala_id }}
    @endif
@endforeach

thx

Activity icon

Replied to Get Data

@silencebringer

i get this

Call to undefined relationship [user] on model [App\Kela].
Activity icon

Replied to Get Data

@silencebringer

i get this

Call to undefined relationship [user] on model [App\Kela].

user model

public function walas()
    {
        return $this->hasMany(Wala::class);
    }

kela Model

public function wala()
    {
        return $this->belongsTo(Wala::class);
    }

wala Model

public function user()
    {
        return $this->belongsTo(User::class);
    }

public function kelas()
    {
        return $this->hasMany(Kela::class);
    }

Activity icon

Started a new Conversation Get Data

how to call data with a data structure like this

users
id

walas
user_id
guru_id


gurus
user_id

kelas
wala_id


if I want to call class data and user name how do I call it i try this code

$kelas = Kela::with('wala')->get();

@foreach($kelas as $kela)

	{{$kela->wala->user->name}}
@endforeach


and i get this error

trying to get property 'user'

Activity icon

Replied to Get Single Role From User

@esorone


 public function up()
    {
        $tableNames = config('permission.table_names');
        $columnNames = config('permission.column_names');

        Schema::create($tableNames['permissions'], function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('guard_name');
            $table->timestamps();
        });

        Schema::create($tableNames['roles'], function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('guard_name');
            $table->timestamps();
        });

        Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
            $table->unsignedInteger('permission_id');

            $table->string('model_type');
            $table->unsignedBigInteger($columnNames['model_morph_key']);
            $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_permissions_model_id_model_type_index');

            $table->foreign('permission_id')
                ->references('id')
                ->on($tableNames['permissions'])
                ->onDelete('cascade');

            $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
                    'model_has_permissions_permission_model_type_primary');
        });

        Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
            $table->unsignedInteger('role_id');

            $table->string('model_type');
            $table->unsignedBigInteger($columnNames['model_morph_key']);
            $table->index([$columnNames['model_morph_key'], 'model_type', ], 'model_has_roles_model_id_model_type_index');

            $table->foreign('role_id')
                ->references('id')
                ->on($tableNames['roles'])
                ->onDelete('cascade');

            $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
                    'model_has_roles_role_model_type_primary');
        });

        Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
            $table->unsignedInteger('permission_id');
            $table->unsignedInteger('role_id');

            $table->foreign('permission_id')
                ->references('id')
                ->on($tableNames['permissions'])
                ->onDelete('cascade');

            $table->foreign('role_id')
                ->references('id')
                ->on($tableNames['roles'])
                ->onDelete('cascade');

            $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
        });

        app('cache')
            ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
            ->forget(config('permission.cache.key'));
    }

Activity icon

Replied to Get Single Role From User

i get this

Column not found: 1054 Unknown column 'roles.user_id' in 'where clause' (SQL: select * from `roles` where `roles`.`user_id` = 1 and `roles`.`user_id` is not null) (View: /Users/fajardev/Sites/projects/smait/resources/views/layouts/app.blade.php) (View: /Users/fajardev/Sites/projects/smait/resources/views/layouts/app.blade.php)
Activity icon

Replied to Get Single Role From User

@chaudigv I refer to easy roles and permission packages

Apr
05
1 week ago
Activity icon

Started a new Conversation Get Single Role From User

how do I take the role of a user who has more than one role

example

I have two users with roles like this

John has a role => student

and

Doe has a role => student and teacher

How do I get user data with the roles teacher, while there is one user who has more than one role

Activity icon

Replied to Filltering Roles

@deep88 not work for me

Apr
04
1 week ago
Activity icon

Replied to Filltering Roles

@deep88 the result is the same as my code above..this does not separate arratic roles

Activity icon

Replied to Filltering Roles

@tykus according to the example above, example windi has the role of admin and cashier

then I want the data that contains the cashier only

if i try this code

$cashirs = User::whereHas('roles', function($role){
                $role->where('roles.name','=','cashirs');
        })->get();

and call

@foreach($cashirs as $get)
                                    <option value="{{$get->id}}">{{$get->roles->implode('name',',')}}</option>
                                @endforeach

and the result

admin,cashirs
Activity icon

Started a new Conversation Filltering Roles

I am experiencing a problem where I have to introduce each user, the problem is that one user has more than one role, how do I get one of the roles of a user who has more than one role ... for example, Windi has roles as admin and cashier, well here I want to take the data that is the role of the cashier .. please help

Mar
15
4 weeks ago
Activity icon

Replied to Some Laracasts Captchas Cannot Be Easilly Bypassed

So what is the answer to this question? What would a programmer say to the "world"?