netcore

netcore

Member Since 4 Years Ago

Experience Points 42,650
Experience Level 9

2,350 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 468
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.

31 Aug
3 years ago

netcore left a reply on Update User Last_seen_at If User Is Authenticated

I have to create new middleware (or use old one) and if user is igged in, then update profile data and redirect to next? And this middleware needs to be attached to route group, right?

30 Aug
3 years ago

netcore started a new conversation Update User Last_seen_at If User Is Authenticated

Hello. How can I update user last_seen_at on every page load?

Where I have to execute update command to update user data, if he is logged in? I have route group with middleware for user login check.

thanks

21 Aug
4 years ago

netcore started a new conversation Create Data Without Having Column In $fillable

Hello

How can I use Model::create() to insert data without having fillable column?

For example, table structure

data
    - name
    - level

In model (look, i have't added level in fillable array)

/* ... */
protected $fillable = [ 'name' ];
/* ... */

Controller

public function process (  Request $request ) {
    
    /*
    data given in request:
    'name' => 'something'
    */

    $data = $request->all();
    $data['level'] = 5,     
    Model::create ($data);
}

when create method is issued, level is not inserted, because i don't have added it to fillable

If i will add it to fillable, users will be able to inspect-element my frontend code to add level manally.

How to fix this?

netcore left a reply on Multi Auth From Single Table

Thank you all for replies, I solved this with MultiAuth package - https://github.com/Kbwebs/MultiAuth

Just created model Admin and returned same user table.

20 Aug
4 years ago

netcore left a reply on Multi Auth From Single Table

Admins and clients have seperate accounts. I need build something like support system, where admins can log into client accounts and do w/e they need.

netcore started a new conversation Multi Auth From Single Table

Hello. Is this possible to create multiple authentications from single user tabe?

For example, i have users table and it have column called level. If level is 1 user is admin, if 2, then client.

I need to create option to log in from two user accounts at the same time. For example, i have logged in from my admin account (/admin/auth/login) and i go to /client/auth/login and i log in from client profile. I am successfully logged in, but my admin session is no longer active. How can i fix this?

16 Aug
4 years ago

netcore left a reply on SQLSTATE[HY000]: General Error: 1215 Cannot Add Foreign Key Constraint

I solved this problem with creating another migration and adding this key.

But when I delete record with HelpParent::findOrFail($id)->delete() it is not deleting parent childs.

netcore left a reply on SQLSTATE[HY000]: General Error: 1215 Cannot Add Foreign Key Constraint

Thank you for your reply.

My code looks like this:

        Schema::create('help', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('shortname');
            $table->integer('parent');
            $table->text('content');
            $table->integer('position');
            $table->timestamps();

            $table->foreign('parent')
                ->references('id')->on('help_parents')
                ->onDelete('cascade');
        });

When I run artisan migrate, it returns this anyway

  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `help` add constraint help_parent_foreign foreign key (`parent`) references `help_parents` (`id`) on delete cascade)






  [PDOException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint



netcore left a reply on SQLSTATE[HY000]: General Error: 1215 Cannot Add Foreign Key Constraint

Thank you for your reply. I can't use same table for help and help parent.

Are there any option to delete records on eloquent relationship, when I delete parent? I have hasMany relationship

netcore started a new conversation SQLSTATE[HY000]: General Error: 1215 Cannot Add Foreign Key Constraint

Hello. This is my code.

class CreateHelpParentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('help_parents', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('shortname');
            $table->integer('position');
            $table->timestamps();

            $table->foreign('id')
                ->references('parent')->on('help')
                ->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('help_parents');
    }
}

class CreateHelpTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('help', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('shortname');
            $table->integer('parent');
            $table->text('content');
            $table->integer('position');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('help');
    }
}

When I run php artisan migrate I get this:

  [Illuminate\Database\QueryException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `help_parents` add constraint help_parents_id_foreign foreign key (`id`) references `help` (`parent`) on delete cascade)






  [PDOException]
  SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

Please help

03 Aug
4 years ago

netcore started a new conversation HasMany Undefined Property

Hello. I have problem in my code.

Table structure

articles
  -id
  -title
  -category

categories
  -id
  -title
  -slug

This is code method on Category model - http://prntscr.com/80i0zx

This is code in controller -

$category = Category::all()->articles;
return dd($category);

After return I get this ErrorException in ArticlesController.php line 108: Undefined property: Illuminate\Database\Eloquent\Collection::$articles

What is wrong there? Please help me