Sergiu17

Member Since 3 Years Ago

Chisinau

Experience Points
486,950
Total
Experience

0 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
1848
Lessons
Completed
Best Reply Awards
474
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 50
486,950 XP
May
06
2 days ago
Activity icon

Awarded Best Reply on Lodash Functions Not Working.

Your code looks OK, make sure that lodash is imported and it's last version,

try this with CDN

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
May
05
3 days ago
Activity icon

Awarded Best Reply on Div Background Colours Visible Past Rounded Corners

add to your div rounded-md

<div class="overflow-hidden flex bg-white shadow-lg rounded-md">
Activity icon

Replied to Div Background Colours Visible Past Rounded Corners

add to your div rounded-md

<div class="overflow-hidden flex bg-white shadow-lg rounded-md">
Activity icon

Awarded Best Reply on Errno: 150 Foreign Key Constraint Is Incorrectly Formed In Migration

try this

$table->unsignedBigInteger('user_id');

foreign key and reference key should have the same length and type

Activity icon

Replied to Errno: 150 Foreign Key Constraint Is Incorrectly Formed In Migration

try this

$table->unsignedBigInteger('user_id');

foreign key and reference key should have the same length and type

Activity icon

Replied to Tinker Error When Creating User Data

use Illuminate\Database\Eloquent\Factories\HasFactory;
class User {
	use HasFactory;
}

Add HasFactory Trait to your User model

Activity icon

Replied to Pay Via Debit Card

https://laracasts.com/paypal

You can use PayPal, to pay for one year

Activity icon

Replied to Lodash Functions Not Working.

Your code looks OK, make sure that lodash is imported and it's last version,

try this with CDN

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
May
04
4 days ago
Activity icon

Awarded Best Reply on Vue Axios .catch() Doesn't Stop The Method

// Make a request for a user with a given ID
axios.get('/user?ID=12345')
  .then(function (response) {
    // handle success
    console.log(response);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .then(function () {
    // always executed
  });

code above is from documentation, last then is always executed

so, to fix your problem

axios.post()
	.then()
	.catch()
Activity icon

Replied to Vue Axios .catch() Doesn't Stop The Method

// Make a request for a user with a given ID
axios.get('/user?ID=12345')
  .then(function (response) {
    // handle success
    console.log(response);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .then(function () {
    // always executed
  });

code above is from documentation, last then is always executed

so, to fix your problem

axios.post()
	.then()
	.catch()
May
01
1 week ago
Activity icon

Replied to How Do You Access The Loop Index On A Foreach Loop Outside The Blade Template?

foreach($collection as $index => $item)

you mean this?

Apr
24
2 weeks ago
Activity icon

Replied to Do Not Display Posts Related To A Category

and you don't have Category model

Activity icon

Replied to Do Not Display Posts Related To A Category

{categori:slug}

should be

{category:slug}
Apr
23
2 weeks ago
Activity icon

Replied to Admin Blog Post Editor - Format Text ?

Hi, here are few

https://ckeditor.com/

https://quilljs.com/

https://www.tiny.cloud/blog/rich-text-editor/

If you need more, google for rich text editor laravel

Apr
21
2 weeks ago
Activity icon

Replied to Select All Record From Table Where Requested Value Is One Of The Multiple Values In A Cell

DB::table('table')
                ->where('languages', 'like', '%python%')
                ->get();

use like statement

Apr
15
3 weeks ago
Activity icon

Replied to Dropzone With Laravel

I had the same issue, I just added some styles

.dropzone {
  border: 2px dashed #0087F7 !important;
  border-radius: 5px !important;
  background: white;
  min-height: 150px !important;
  padding: 20px 20px !important;
}
Activity icon

Replied to Concatenate String On Blade

add one more condition, if count($items) > 0

Activity icon

Replied to Concatenate String On Blade

@if (!$loop->last) | @endif
{{ !$loop->last ? '|' : '' }}

https://laravel.com/docs/8.x/blade#the-loop-variable

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: PATCH.

Looks like your action is incorrect

<form method="POST" action="/update_comment/{{$value->id}}">
Activity icon

Replied to Laracasts Profile

gravatar.com create an account on this site and make sure to add Laracasts to Websites https://en.gravatar.com/profiles/edit#your-links

Laracasts takes your avatar from GitHub first, and if you don't have a linked GitHub account, then Laracasts takes your avatar from Gravatar.

Activity icon

Awarded Best Reply on Creating New Record To Table After Defining Relationship?

You could create a migration for this, populate_profiles_table

public function up()
{
	$users = User::doesntHave('profile')->get();

	$users->each(function($user) {
		$user->profile->save(new Profile());
	});
}
Activity icon

Replied to Creating New Record To Table After Defining Relationship?

You could create a migration for this, populate_profiles_table

public function up()
{
	$users = User::doesntHave('profile')->get();

	$users->each(function($user) {
		$user->profile->save(new Profile());
	});
}
Apr
14
3 weeks ago
Activity icon

Replied to Laravel8 Errors

any log errors? in storage/logs folder

Apr
12
3 weeks ago
Activity icon

Replied to Foreach Loop

{{ $result }} - is enough , without ['id']

Activity icon

Awarded Best Reply on Return Of XML With Only One Result, Doesn't Group Into Index

Hi, you could add an if statement, in your case array_key_first($array) will return eitherID or 0

$array = $xml['diffgram']['NewDataSet']['Table'];

if(array_key_first($array) === 0) {
	foreach($array as $item) {
		$this->store($item);
	}
} else {
	$this->store($array);
}
Activity icon

Replied to Return Of XML With Only One Result, Doesn't Group Into Index

Hi, you could add an if statement, in your case array_key_first($array) will return eitherID or 0

$array = $xml['diffgram']['NewDataSet']['Table'];

if(array_key_first($array) === 0) {
	foreach($array as $item) {
		$this->store($item);
	}
} else {
	$this->store($array);
}
Apr
09
4 weeks ago
Activity icon

Awarded Best Reply on Laravel Markdown Email Render Issue.

https://laravel.com/docs/8.x/mail#writing-markdown-messages

Do not use excess indentation when writing Markdown emails. Per Markdown standards, Markdown parsers will render indented content as code blocks.

this may be the problem

Activity icon

Replied to Laravel Markdown Email Render Issue.

https://laravel.com/docs/8.x/mail#writing-markdown-messages

Do not use excess indentation when writing Markdown emails. Per Markdown standards, Markdown parsers will render indented content as code blocks.

this may be the problem

Apr
08
1 month ago
Activity icon

Awarded Best Reply on What's Wrong With This

Did you try to add ability to the $fillable array?

Activity icon

Replied to What's Wrong With This

Did you try to add ability to the $fillable array?

Apr
07
1 month ago
Activity icon

Awarded Best Reply on Sanctum Personal Access Tokens Schema

-- auto-generated definition
create table personal_access_tokens
(
    id             bigint unsigned auto_increment
        primary key,
    tokenable_type varchar(255)    not null,
    tokenable_id   bigint unsigned not null,
    name           varchar(255)    not null,
    token          varchar(64)     not null,
    abilities      text            null,
    last_used_at   timestamp       null,
    created_at     timestamp       null,
    updated_at     timestamp       null,
    constraint personal_access_tokens_token_unique
        unique (token)
)
    collate = utf8mb4_unicode_ci;

create index personal_access_tokens_tokenable_type_tokenable_id_index
    on personal_access_tokens (tokenable_type, tokenable_id);

this?

Activity icon

Replied to Sanctum Personal Access Tokens Schema

-- auto-generated definition
create table personal_access_tokens
(
    id             bigint unsigned auto_increment
        primary key,
    tokenable_type varchar(255)    not null,
    tokenable_id   bigint unsigned not null,
    name           varchar(255)    not null,
    token          varchar(64)     not null,
    abilities      text            null,
    last_used_at   timestamp       null,
    created_at     timestamp       null,
    updated_at     timestamp       null,
    constraint personal_access_tokens_token_unique
        unique (token)
)
    collate = utf8mb4_unicode_ci;

create index personal_access_tokens_tokenable_type_tokenable_id_index
    on personal_access_tokens (tokenable_type, tokenable_id);

this?

Activity icon

Replied to Boolean

$product->status ? 'present' : 'not present';

use ternary, or an if statement

Activity icon

Awarded Best Reply on UnsignedDecimal Vs Decimal Database

https://dev.mysql.com/doc/refman/5.6/en/integer-types.html

You can store much bigger numbers by using unsigned

Activity icon

Replied to UnsignedDecimal Vs Decimal Database

https://dev.mysql.com/doc/refman/5.6/en/integer-types.html

You can store much bigger numbers by using unsigned

Activity icon

Replied to Passing PHP Functions Into ->map() Method In Collection ?

You have to use long form, here the code

https://github.com/laravel/framework/blob/8.x/src/Illuminate/Collections/Collection.php#L636

so basically

$array = ['Alex', 'JOHN'];
$keys = array_keys($array);
array_map('strtolower', $array, $keys);

but strtolower accepts only one parameter

Activity icon

Replied to Non-static Method App\User::hasPermissionTo() Should Not Be Called Statically

User::permission('teacher')->latest()->paginate(9);

this should do

Activity icon

Awarded Best Reply on Vue <router-view>

home.blade.php should contain only <router-view></router-view>, and move code related to products in appropriate component

Activity icon

Replied to Vue <router-view>

home.blade.php should contain only <router-view></router-view>, and move code related to products in appropriate component

Apr
06
1 month ago
Activity icon

Awarded Best Reply on Better Way To Use ModelResource In Laravel

Check this https://laravel.com/docs/8.x/eloquent-resources#relationships

// example 
public function toArray($request)
{
    return [
        'id' => $this->id,
        'posts' => PostResource::collection($this->posts),
    ];
}
Activity icon

Replied to Better Way To Use ModelResource In Laravel

Check this https://laravel.com/docs/8.x/eloquent-resources#relationships

// example 
public function toArray($request)
{
    return [
        'id' => $this->id,
        'posts' => PostResource::collection($this->posts),
    ];
}
Apr
05
1 month ago
Activity icon

Replied to Syntax Error, Unexpected '}', Expecting ')'

<div class="carousel-item active"
style='background-image: url({{ asset("storage/$md->id/$md->file_name") }})'>
Activity icon

Awarded Best Reply on Ajax Throtthle ?

Yes it works with AJAX request

your error is related to JavaScript

Activity icon

Replied to Ajax Throtthle ?

Yes it works with AJAX request

your error is related to JavaScript

Apr
04
1 month ago
Activity icon

Awarded Best Reply on Laravel Field Doesn't Have A Default Value

SingleImage model, add those fields to $fillable array,

protected $fillable = ['title, 'description', 'user_id', 'team_id', 'image'];