Sergiu17

Sergiu17

Member Since 2 Years Ago

Chisinau

Experience Points
347,370
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
1586
Lessons
Completed
Best Reply Awards
290
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 50
347,370 XP
Apr
02
15 hours ago
Activity icon

Replied to Eloquent ORM Database Query Error

// this
$user->organization-> ...
// instead of
$user->organization()-> ... 

When you call the method with parentheses - it returns query builder, so just remove the parentheses. The same with application() - remove parentheses, you will end up with

$user->organization->application->notifications()->save(['$organization', '$application', '$notifications']);
Activity icon

Replied to Session

@davy_yg no, view function returns View class, this is with method from View class - https://github.com/laravel/framework/blob/7.x/src/Illuminate/View/View.php#L181

Activity icon

Awarded Best Reply on Session

https://github.com/laravel/framework/blob/7.x/src/Illuminate/Http/RedirectResponse.php#L42

back() function returns RedirectResponse, and when you call with method from RedirectResponse - it flushes data to the session, hope it clarifies some things

Activity icon

Replied to Session

https://github.com/laravel/framework/blob/7.x/src/Illuminate/Http/RedirectResponse.php#L42

back() function returns RedirectResponse, and when you call with method from RedirectResponse - it flushes data to the session, hope it clarifies some things

Mar
31
2 days ago
Activity icon

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

// this
Route::delete('/profileshow/{id}'
// instead of
Route::delete('/profileshow.{id}'

add / before {id} not a . ( dot )

// like so
Route::delete('/profileshow/{id}', '[email protected]')->name('pres.destroy');
Activity icon

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

Not a button, a form,

<form method="POST" action="{{ route('pres.destroy',$prescription->idd) }}">
@csrf
@method('delete')

<button type='submit' class="text-inverse" data-toggle="tooltip">
  <i class="fa fa-trash"></i>
</button>
</form>

something like this

Activity icon

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

You have to send a DELETE request to this route, not a GET request.

<form method="POST" action="">
@csrf
@method('delete')
</form>
Activity icon

Replied to How Can I Use The Terminal/tinker Using Laravel On Hostgator?

Because you are not in the root of your project

cd /proect-name

ls #make sure you see your laravel project structure

php artisan tinker
Activity icon

Awarded Best Reply on Error When Using A Factory For A Foreign Key

Do you have 150 records in your news table and 35 records in categories table?

Activity icon

Replied to Error When Using A Factory For A Foreign Key

Do you have 150 records in your news table and 35 records in categories table?

Mar
30
3 days ago
Activity icon

Awarded Best Reply on Laravel - Take 20 Rows Of The Latest Posts And Then Order By Column2

App\Post::latest()->limit(20)->get()->sortByDesc('views');

sortByDesc comes from collection class

Activity icon

Replied to Pulling All Uploaded Photos From Database

Hi, iterate over them and print every individual image

@foreach( $row->photos as $photo )
	<img src="{{ $photo->name }}" /> 
@endforeach
Activity icon

Replied to Property [name] Does Not Exist On This Collection Instance.

@niyo what is the relationship between User and Graphic Models?

Activity icon

Replied to Laravel - Take 20 Rows Of The Latest Posts And Then Order By Column2

@shez1983 latest()->latest('views') this will not work, I tried

Activity icon

Replied to Laravel - Take 20 Rows Of The Latest Posts And Then Order By Column2

App\Post::latest()->limit(20)->get()->sortByDesc('views');

sortByDesc comes from collection class

Activity icon

Replied to Property [name] Does Not Exist On This Collection Instance.

@niyo the code in first comment leads to the error.

https://laravel.com/docs/7.x/blade#loops

while you have many $graphics, you need to iterate over them

// this is the 'correct' way
@foreach($graphics as $graphic)
  {{ $graphic->name }}
@endforeach
Mar
29
4 days ago
Activity icon

Replied to Property [name] Does Not Exist On This Collection Instance.

What do you have in your view?

{{ $graphics->name }} ?
Activity icon

Replied to Laravel - Use The Following JQuery Script Inside View

Did you add jquery to your project

<script scr="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
<script>
$("#critical_btn").click(function() { $(this).toggleClass('btn-default btn-success'); });
</script>
Activity icon

Awarded Best Reply on How To Check Vue Is Loaded Correctly

composer create-project --prefer-dist laravel/laravel vue-project

composer require laravel/ui

php artisan ui vue

npm install && npm run dev
<div id='app'>
	<example-component></example-component>
</div>
<script src='/js/app.js'></script> // this is important step
Activity icon

Replied to How To Check Vue Is Loaded Correctly

composer create-project --prefer-dist laravel/laravel vue-project

composer require laravel/ui

php artisan ui vue

npm install && npm run dev
<div id='app'>
	<example-component></example-component>
</div>
<script src='/js/app.js'></script> // this is important step
Mar
28
5 days ago
Activity icon

Replied to How To Get Comments And Ratings Of Post In One Api Route

You could create a separate folder for controllers related to API App\Http\Controllers\API\PostsController.php

and in your api.php define your route

Activity icon

Awarded Best Reply on How To Get Comments And Ratings Of Post In One Api Route

Assuming you have Post Comment and Rating Models, and relationships between

Post::with(['comments', 'ratings'])->get();
Activity icon

Replied to How To Get Comments And Ratings Of Post In One Api Route

Assuming you have Post Comment and Rating Models, and relationships between

Post::with(['comments', 'ratings'])->get();
Mar
27
6 days ago
Activity icon

Awarded Best Reply on Undefined Variable In Foreach Loop In Laravel Blade Template

@shoaibzartash probably this is happening when you hit the create method, you return education.study view but without $qualification

public function create()
{
  return view('education.study'); // this view needs $qualification variable
}
Activity icon

Replied to Undefined Variable In Foreach Loop In Laravel Blade Template

@shoaibzartash probably this is happening when you hit the create method, you return education.study view but without $qualification

public function create()
{
  return view('education.study'); // this view needs $qualification variable
}
Activity icon

Replied to Unable To Set Up PHPStorm Correctly

@culeaalex I don't know any other solutions, and I'd say that it is not ugly at all, people use it, you just use it when you are in development mode

Activity icon

Replied to Unable To Set Up PHPStorm Correctly

Hi, add this package to your dev dependencies - https://github.com/barryvdh/laravel-ide-helper

composer require --dev barryvdh/laravel-ide-helper
Activity icon

Awarded Best Reply on Vue Push

Hi, like so

this.unavailable['29.02.2020'].push({});
Mar
26
1 week ago
Activity icon

Replied to Page 404 After New Installation !

php artisan route:list

do you have /login route?

Activity icon

Replied to Page 404 After New Installation !

after cloning Laravel I have this issue :

Update your PHP and Laravel versions

Activity icon

Replied to Page 404 After New Installation !

@mostafalaravel yes, this package will add auth routes, views, migrations and controllers

Activity icon

Replied to Page 404 After New Installation !

did you install ui package? composer require laravel/ui

Activity icon

Replied to "SQLSTATE[HY000]: General Error: 1364 Field 'images' Doesn't Have A Default Value (SQL: Insert Into `products` (`category_id`, `name_ar`, `name_en`, `shortDetail ▶"

// remove this
 $product = Product::create([
        'category_id'=> $request->category,
        'name_ar'=> $request->name_ar,
        'name_en'=> $request->name_en,
        'shortDetails_ar'=> $request->shortDetails_ar,
        'shortDetails_en'=> $request->shortDetails_en,
        'quantity'=> $request->quantity,
        'size'=> $request->size,
        'color'=> $request->color,
        'ref'=> $request->ref,
        'description_ar'=> $request->description_ar,
        'description_en'=> $request->description_en,
        'additionalInfo_ar'=> $request->additionalInfo_ar,
        'additionalInfo_en'=> $request->additionalInfo_en,
        'price'=> $request->price,
        'images'=> $request->images,


        ]);
Activity icon

Replied to "SQLSTATE[HY000]: General Error: 1364 Field 'images' Doesn't Have A Default Value (SQL: Insert Into `products` (`category_id`, `name_ar`, `name_en`, `shortDetail ▶"

No but i did it below in the request because when i do it in create method it gave me error in array

and this is why you get the error

Activity icon

Replied to "SQLSTATE[HY000]: General Error: 1364 Field 'images' Doesn't Have A Default Value (SQL: Insert Into `products` (`category_id`, `name_ar`, `name_en`, `shortDetail ▶"

$product = new Product();
$product->category_id = $request->category_id;
// and so on for every single attribute
$product->images = ''; // an empty string
// or make it nullable, or add default value in your migration file



if($request->file('images')) {
  $images = [];

  foreach ($request->file('images') as $key => $value) {
    $fileName = date('YmdHis') . "." . $products->getClientOriginalExtension();

    $images[] = $fileName;
  }

  $product->images = implode('|', $images);
}

$product->save();
Activity icon

Awarded Best Reply on Laravel Eloquent Problem

It's because of orWhere, change it to andWhere

// this is translation of your query
Give me all tasks where status is 0 OR where id in ( given array )
Activity icon

Replied to Laravel Eloquent Problem

It's because of orWhere, change it to andWhere

// this is translation of your query
Give me all tasks where status is 0 OR where id in ( given array )
Mar
25
1 week ago
Activity icon

Replied to Redirect Not Working

You forgot the if statement

if ( Auth::attempt($credentials) ) {
	return . . . 
}
Activity icon

Replied to How To Use Mp3 File In Laravel+vue Application

@sinon too many arrows but hope it will help you - https://i.imgur.com/xsSABPi.png

I just tested it and it works

Activity icon

Replied to How To Use Mp3 File In Laravel+vue Application

@sinon understood, show your component code please, and also inspect element and make sure that you see the right path to the song.mp3 file in src attribute

Activity icon

Replied to Laravel Record Doesn't Return It's Children

Ok, just eager load the relationship

$post = Post::with('photos')->find($id); // this is the response you expect 

$post->photos;
Activity icon

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

Hi, you send a GET request to a POST route

Activity icon

Replied to Laravel Record Doesn't Return It's Children

Hi, show us migration of the photos table, and defined relationship in your model