Sergiu17

Member Since 3 Years Ago

Chisinau

Experience Points
445,010
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
1730
Lessons
Completed
Best Reply Awards
425
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
445,010 XP
Jan
20
1 day ago
Activity icon

Replied to Getting All Comments Of All Posts Of A User

I'm talking about comments on your posts from other users.

Activity icon

Replied to Getting All Comments Of All Posts Of A User

You also need ->where('user_id', auth()->id())->get() to the Comment model, because, your post may have two comments from two different users, with id 1 and 2, and in your example, you will get a collection of two items, while you need only one.

Activity icon

Replied to Getting All Comments Of All Posts Of A User

I want to get all Comments from all Posts belonging to a user.

user may write comments to posts that doesn't belong to him

Activity icon

Replied to Getting All Comments Of All Posts Of A User

Comment::whereHas('posts', function($q) {
	return $q->where('user_id', auth()->id());
})->where('user_id', auth()->id())->get()

I think this should work

Jan
19
2 days ago
Activity icon

Awarded Best Reply on How Can I Fix The Following Error When Updating My Image?

$avatar = $request->file('image');

$profile = Perfil::find($request->id);

if ($avatar) {
	$avatarName = time().'.'.$avatar->extension();
	$avatar->move(public_path('storage/profile-photos'), $avatarName);

	$profile->profile_photo_path = $avatarName;
}

$profile->save();
Activity icon

Replied to How Can I Fix The Following Error When Updating My Image?

$avatar = $request->file('image');

$profile = Perfil::find($request->id);

if ($avatar) {
	$avatarName = time().'.'.$avatar->extension();
	$avatar->move(public_path('storage/profile-photos'), $avatarName);

	$profile->profile_photo_path = $avatarName;
}

$profile->save();
Activity icon

Replied to Error: Src Refspec Master Does Not Match Any

do you have any files in your folder?

run

git log

check if you have some commits, if not, then add a file or something, and start from git add ., then commit, then push

Activity icon

Awarded Best Reply on Dusk Not Finding New Method Name

Method name should start with test

try: testLoginPage()

Activity icon

Replied to Dusk Not Finding New Method Name

Method name should start with test

try: testLoginPage()

Jan
18
3 days ago
Activity icon

Replied to Integrity Constraint Violation: 1451 Cannot Delete Or Update A Parent Row: A Foreign Key Constraint Fails

Looks like in your bookings table you have some records where room_id = 3, first you have to delete records from bookings table, then delete everything from rooms table. Or learn about https://www.techonthenet.com/sql_server/foreign_keys/foreign_delete.php add a constraint to cascade delete

Jan
16
5 days ago
Activity icon

Awarded Best Reply on Laravel Cache

You need a different unique key, if second person hits the url within 1000 seconds, he will see articles of the author with id 2

Jan
14
1 week ago
Activity icon

Replied to DELETE Method Is Not Supported For This Route. Supported Methods: GET, HEAD, POST.

you send the request to the wrong endpoint

delete(this.baseUrl + '/category/' + $id)
Jan
13
1 week ago
Activity icon

Replied to Blade Checkbox Returns Null When Unchecked

This is how input checkbox works

Note: If a checkbox is unchecked when its form is submitted, there is no value submitted to the server to represent its unchecked state (e.g. value=unchecked); the value is not submitted to the server at all.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox

Activity icon

Replied to Laravel Cache

You need a different unique key, if second person hits the url within 1000 seconds, he will see articles of the author with id 2

Jan
12
1 week ago
Activity icon

Replied to Dealing With External API Responses

Hi, you could use a trait for it, parent class or a helper function globally registered

Activity icon

Awarded Best Reply on TDD: InvalidArgumentException: Unknown Formatter "sentence"

Remove use PHPUnit\Framework\TestCase;

Add use Tests\TestCase;

Pay attention to details! You have 10 lines of code, try to solve on your own

Activity icon

Replied to TDD: InvalidArgumentException: Unknown Formatter "sentence"

Remove use PHPUnit\Framework\TestCase;

Add use Tests\TestCase;

Pay attention to details! You have 10 lines of code, try to solve on your own

Activity icon

Awarded Best Reply on TDD: Failed Asserting That A Row In The Table [tasks] Matches The Attributes

try $task->update( instead of $task->updated(

Activity icon

Replied to TDD: Failed Asserting That A Row In The Table [tasks] Matches The Attributes

try $task->update( instead of $task->updated(

Jan
11
1 week ago
Activity icon

Awarded Best Reply on How To Mix Blade And Php?

@php
	// php 
@endphp

you could use @php blade directive

Activity icon

Replied to How To Mix Blade And Php?

@php
	// php 
@endphp

you could use @php blade directive

Activity icon

Replied to Target Class [Illuminate\Auth\Middleware\adminpermission] Does Not Exist.

'adminpermission' => App\Http\Middleware\adminpermission::class,
Activity icon

Replied to Getting My Products To Split Accordingly

How can product with id 2 be in the oldProducts and in the newProducts at the same time?

Activity icon

Replied to Getting My Products To Split Accordingly

$contains[] = $product; // add a pair if brackets to append to array instead of overwrite entire array

$doesntContain[] = $product; // same here
Activity icon

Replied to Laravel Mix & Vue : Module Parse Failed: Unexpected Token

What's your node version? node -v

Activity icon

Awarded Best Reply on TDD: Error: Class 'http\Client\Curl\User' Not Found

add this use Illuminate\Support\Collection; at the top

Activity icon

Replied to TDD: Error: Class 'http\Client\Curl\User' Not Found

add this use Illuminate\Support\Collection; at the top

Activity icon

Replied to TDD: Error: Class 'http\Client\Curl\User' Not Found

use http\Client\Curl\User; namespace is incorrect

should be, App\Models\User

Jan
10
1 week ago
Activity icon

Replied to Error When Running Npm Install && Npm Run Dev

@snackpack you have an old version of node, update it and try again

Activity icon

Awarded Best Reply on Can't Access My Homepage

@hackroot you have two options, you either check if there's an image

@if($Freshtrack->ImageUpload)
<img class="uk-border-rounded-medium"
	src="{{ asset($Freshtrack->ImageUpload->filename) }}"
	 alt="{{ $Freshtrack->meta_description }}">
@endif

or, fetch records that have an image attached

$Freshtracks =  Post::has('ImageUpload')->oldest()->paginate(12);
Activity icon

Replied to Can't Access My Homepage

@hackroot you have two options, you either check if there's an image

@if($Freshtrack->ImageUpload)
<img class="uk-border-rounded-medium"
	src="{{ asset($Freshtrack->ImageUpload->filename) }}"
	 alt="{{ $Freshtrack->meta_description }}">
@endif

or, fetch records that have an image attached

$Freshtracks =  Post::has('ImageUpload')->oldest()->paginate(12);
Activity icon

Replied to Delete Method Is Not Supported For The Route

Delete method is not supported for the route

this means that you have a route, for example Route::get, or Route::post and you try to submit a DELETE request to it, and it won't work. To fix this, first, open web.php adjust your Route definition, then run php artisan route:clear, and that's it

Activity icon

Replied to Can't Access My Homepage

{{ asset($Freshtrack->ImageUpload->filename) }}

Object $Freshtrack doesn't have ImageUpload property, or it is NULL

Activity icon

Replied to Display Products Of Each Category In Laravel

You have few options, you need to send somehow the id of the id of the category, then get courses of given category id

@foreach ($categories as $category)
	<a href="{{ route('courses.list') . '?category=' . $category->id }}">{{ $category->name }}</a>
@endforeach
public function courseList()
{
	$category = $request->input('category');

	$courses = Course::filter()
		>when($category, function ($query, $category) {
			return $query->where('category_id', $category);
		})
		->where('status' , Course::STATUS_ACCEPT)
		->latest()
		->paginate(10);

}

Another option is to create new endpoint

Route::get('/categories/{category}', '[email protected]');

public function show(Category $category)
{
	return $category->courses;
}
Jan
09
1 week ago
Activity icon

Awarded Best Reply on Laravel 5.5. Illuminate \ Database \ QueryException (HY000) SQLSTATE[HY000]: General Error: 1364 Field 'name' Doesn't Have A Default Value

Event::create($request->input());

You don't have to wrap request->input() into another array

Activity icon

Replied to Laravel 5.5. Illuminate \ Database \ QueryException (HY000) SQLSTATE[HY000]: General Error: 1364 Field 'name' Doesn't Have A Default Value

Event::create($request->input());

You don't have to wrap request->input() into another array

Activity icon

Awarded Best Reply on Vue-Router - Failure To Pull Data From The Database

Hi again, in this ( https://laracasts.com/discuss/channels/vue/the-vue-router-doesnt-work-as-i-want-it-to ) thread I told you to read an article, and mentioned that every other round should go in api.php file

and every other endpoint goes to api.php file

// api.php
Route::get('/employee-get-by-id/{id}',[SpaController::class,"getData"]);
// api prefix
var url="api/mployee-get-by-id/"+this.id;

https://laravel-news.com/building-vue-spa-laravel-part-2/ - this is part two of the article

And also there's part 3, and 4 and 5, you can find the links at the end of every article

Jan
08
1 week ago
Activity icon

Replied to Vue-Router - Failure To Pull Data From The Database

Hi again, in this ( https://laracasts.com/discuss/channels/vue/the-vue-router-doesnt-work-as-i-want-it-to ) thread I told you to read an article, and mentioned that every other round should go in api.php file

and every other endpoint goes to api.php file

// api.php
Route::get('/employee-get-by-id/{id}',[SpaController::class,"getData"]);
// api prefix
var url="api/mployee-get-by-id/"+this.id;

https://laravel-news.com/building-vue-spa-laravel-part-2/ - this is part two of the article

And also there's part 3, and 4 and 5, you can find the links at the end of every article

Activity icon

Replied to Validation Error Not Working Laravel

return
 [
	//
],
[
	//
]

you can't do this

Activity icon

Replied to Permission Denied : Storage/logs

Okay, then sudo chmod 764 should work, or 774

Activity icon

Replied to Permission Denied : Storage/logs

Yes, sudo chmod 664 storage/logs should fix

Jan
07
2 weeks ago
Activity icon

Awarded Best Reply on The Vue-router Doesn't Work As I Want It To

https://laravel-news.com/using-vue-router-laravel

read article above

I give you a hint

// web.php
Route::get('/{any}', '[email protected]')->where('any', '.*');

and every other endpoint goes to api.php file

Jan
06
2 weeks ago
Activity icon

Replied to The Vue-router Doesn't Work As I Want It To

https://laravel-news.com/using-vue-router-laravel

read article above

I give you a hint

// web.php
Route::get('/{any}', '[email protected]')->where('any', '.*');

and every other endpoint goes to api.php file

Activity icon

Replied to Error When Running Npm Run Dev

Update Node, looks like you have an old version

Activity icon

Awarded Best Reply on Load Echo.js

composer create-project laravel/laravel Echo

cd Echo

npm install

npm install --save-dev laravel-echo pusher-js

// open resources/js/boostrap.js file and uncomment code below
import Echo from 'laravel-echo';

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    forceTLS: true
});

// next run
npm run dev

this worked for me, make sure to that laravel echo is installed

npm list --depth=0

also, try to update your npm version

I'm on 6.14.10 version

Jan
05
2 weeks ago
Activity icon

Awarded Best Reply on This.$http.get - TypeError: Cannot Read Property 'get' Of..

Install the package - https://github.com/pagekit/vue-resource

But I recommend you to switch to axios, it comes with Laravel by default, if you don't use Laravel, then npm install axios

https://github.com/axios/axios

Read this article - https://medium.com/the-vue-point/retiring-vue-resource-871a82880af4

Activity icon

Awarded Best Reply on Routes Middlware On Specific Methods

Hi, move the middleware inside constructor of the CarsController class

class CarsController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth')->only(['store', 'destroy', 'update');
    }

https://laravel.com/docs/8.x/controllers#controller-middleware