Sergiu17

Member Since 3 Years Ago

Chisinau

Experience Points
462,360
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
1762
Lessons
Completed
Best Reply Awards
448
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
462,360 XP
Feb
26
2 days ago
Activity icon

Replied to Catching Laravel Errors?

Try this

.catch(e => {
	console.log(e);
}

and see what you get, you may need this.errors = e.errors; only, without.data

Feb
24
4 days ago
Activity icon

Awarded Best Reply on Changing Terminals Name Mac

you probably are using zsh, if so, then instead of .bash_profile use, .zshrc

Activity icon

Replied to Changing Terminals Name Mac

you probably are using zsh, if so, then instead of .bash_profile use, .zshrc

Feb
22
6 days ago
Activity icon

Replied to Call Forgot-password Route Via API

https://github.com/laravel/framework/blob/8.x/src/Illuminate/Auth/Notifications/ResetPassword.php#L69

Here's the reference to the password.reset route, this link is attached to the email, and when user clicks on, he/she is redirected to password reset page..you could overwrite it, by

ResetPassword::createUrlUsing(function ($notifiable, $token) {
    return 'http://spa-url.com/' . $token . '/' . '?email=' . $notifiable->getEmailForPasswordReset();
});

this should do the work..next using JS in your SPA, grab token and email from URL and send a post request to reset password

Feb
21
1 week ago
Activity icon

Awarded Best Reply on Route Not Defined

Route::get('/kontakt', function () {
    return view('contact');
})->name('kontakt');
Activity icon

Replied to Route Not Defined

Route::get('/kontakt', function () {
    return view('contact');
})->name('kontakt');
Activity icon

Replied to How To Get All Consumer Data ?

Sale::with('customer')->where('user_id', 2)->get();
Feb
19
1 week ago
Activity icon

Replied to API Routes Saying 405 Method Not Allowed

what is base_uri equals to?

route in api.php are prefixed with api

so, your request should to to app_url + '/api/register'

Activity icon

Replied to API Routes Saying 405 Method Not Allowed

He's using Laravel as an API, so not sure if he needs a GET route to the register page

Activity icon

Replied to API Routes Saying 405 Method Not Allowed

You send a GET request to a POST route, send a POST request instead

Feb
18
1 week ago
Activity icon

Awarded Best Reply on How To Do This With Relationship

class Category extends Model
{
    public function getRouteKeyName()
    {
        return 'slug';
    }
}
Route::get(
	'/categories/{category}/products',
	'[email protected]'
);

// ..

public function findProductBasedOnCategory(Category $category)
{
	$products = $category->products

	return view('product.category',compact('products'));
}
Activity icon

Replied to How To Do This With Relationship

class Category extends Model
{
    public function getRouteKeyName()
    {
        return 'slug';
    }
}
Route::get(
	'/categories/{category}/products',
	'[email protected]'
);

// ..

public function findProductBasedOnCategory(Category $category)
{
	$products = $category->products

	return view('product.category',compact('products'));
}
Activity icon

Replied to How To Do This With Relationship

$category = Category::where('slug',$categorySlug)->first();

$products = $category->products
Feb
17
1 week ago
Activity icon

Replied to How To Post Json Data Using Http

$data = [
	'userid' = 'datapi1',
	'apikey' = ' // ...',
	'data' => base64_encode(),
];

you don't need to json_encode

https://laravel.com/docs/8.x/http-client#request-data

Feb
16
1 week ago
Activity icon

Replied to Laravel : Keys And Values

Hi, go to the html and add

@php
	dd(get_defined_vars());
@endphp

and see what you get

Activity icon

Replied to Argument 1 Passed To App\Jobs\SendEmail::__construct() Must Be An Instance Of App\User, String Given,

SendEmail::dispatch($ticket->user , $reply->ticket);

remove ->email, and adjust your send method from EmailProvider

    public function send()
    {
        return Mail::to($this->user->email)->send($this->mailable); // add ->email
    }
Activity icon

Replied to How To Modify Login Api So Users Can Also Login With Registration?

Auth::attempt([
	'email' => request('email'),
	'password' => request('password')
])

You probably hash passwords before you store them in your data base, if so, then

Auth::attempt([
	'email' => request('email'),
	'password' => bcrypt(request('password')) // hash the password, then try to login
])
Activity icon

Awarded Best Reply on SQLSTATE[HY000] [2002] Connection Refused Laravel Docker

oh, sorry

docker-compose stop
docker-compose up -d

// or

docker-compose restart

restart the containers

Activity icon

Replied to SQLSTATE[HY000] [2002] Connection Refused Laravel Docker

oh, sorry

docker-compose stop
docker-compose up -d

// or

docker-compose restart

restart the containers

Activity icon

Replied to SQLSTATE[HY000] [2002] Connection Refused Laravel Docker

Try to stop local installed mysql

service mysqld stop
// or
service mysql stop

then

sail down
sail up -d
Activity icon

Awarded Best Reply on API Error On Live Server

This could be related to PHP version from the live server. check your composer.json file for minimum required php version, and upgrade your PHP on the sever

Activity icon

Replied to API Error On Live Server

This could be related to PHP version from the live server. check your composer.json file for minimum required php version, and upgrade your PHP on the sever

Feb
15
1 week ago
Activity icon

Replied to Blade Directive On Vue Component.

Hi, you probably use axios too, if so then

logout() {
    axios.post('/logout')
        .then(() => {
            window.location.replace('/');
        })
        .catch((error) => {
            console.log(error);
        })
}

if you don't like this approach, then a common way is to add a meta tag in your header

<head>
	<meta name="csrf_token" content="{{ csrf_token() }}">
</head>

next, when Nav component in mounted, get token an assign to the form in your template

<template>
	<button class="leading-6 ml-2" @click="logout">Log out</button>
            <form method="POST" id="logoutForm" action="/logout">
				<input type="hidden" name="_token" :value="token" />
            </form>
</template>

// ..

date() {
	return {
		token: '',
	}
}

mounted() {
	this.token = document.querySelector('meta[name="csrf_token"]').content
}

something like this

Activity icon

Replied to Preview Of Image Before Hitting Method

You don't need PHP or Laravel here, use JavaScript as is described on stackoverflow

https://developer.mozilla.org/en-US/docs/Web/API/FileReader

Activity icon

Replied to Laravel Uploaded File Name Change Is Not Working

$custom_name = 'logo_{{Auth::user()->firstName}}_{{Auth::user()->lastName}}'.$file->getClientOriginalExtension();


$file->move('uploads  ', $custom_name); // <-------
Feb
13
2 weeks ago
Activity icon

Replied to Angular GET API Passing In JWT Token

No, Angular is great, you could check weekly downloads of Angular on www.npmjs.com

Activity icon

Awarded Best Reply on Angular GET API Passing In JWT Token

new HttpHeaders().set('Authorization', `Bearer ${token}`);

this should do it

Activity icon

Replied to Angular GET API Passing In JWT Token

new HttpHeaders().set('Authorization', `Bearer ${token}`);

this should do it

Activity icon

Awarded Best Reply on Laravel Feature Tests Always Return 404

@jacynoadam

<server name="APP_URL" value="http://localhost"/>

This is how you url should look in phpunit.xml file

Activity icon

Replied to Laravel Feature Tests Always Return 404

@jacynoadam

<server name="APP_URL" value="http://localhost"/>

This is how you url should look in phpunit.xml file

Activity icon

Replied to Laravel Feature Tests Always Return 404

What is sunny-camping?

GET http://localhost/sunny-camping/welcome

it tries to load route specified above, and you don't have one

Feb
12
2 weeks ago
Activity icon

Replied to How To Move Password Hashing To A Request Class?

https://laravel.com/docs/8.x/eloquent-mutators#defining-a-mutator

public function setPasswordAttribute($value)
{
        $this->attributes['password'] = bcrypt($value);
}

add this to your User model,

edit* and remove completely if statement

Activity icon

Awarded Best Reply on Redirect To Login Page If User Not Login

Route::group([
	'prefix' => '',
	'middleware' => ['auth', 'role:superadmin', 'admin', 'seller', 'telemarketer']
], function () {
	// routes here
});
Activity icon

Replied to Redirect To Login Page If User Not Login

Route::group([
	'prefix' => '',
	'middleware' => ['auth', 'role:superadmin', 'admin', 'seller', 'telemarketer']
], function () {
	// routes here
});
Activity icon

Awarded Best Reply on Is There A Way To Reference Root Folder Using Import?

https://webpack.js.org/configuration/resolve/

const mix = require('laravel-mix');

mix.webpackConfig({
    resolve: {
        alias: {
            '@': __dirname + '/resources/js',
        }
    }
});
<script>
import RadioButtons from '@/components/events/subcomponents/RadioButtons.vue';
</script>

Create an alias

Activity icon

Replied to Redirect To Login Page If User Not Login

Hi, use auth middleware

Route::resource('pages', 'PageController')
	->only(['index', 'create', 'store', 'edit', 'update', 'destroy'])
	->middleware('auth');
Activity icon

Replied to Is There A Way To Reference Root Folder Using Import?

https://webpack.js.org/configuration/resolve/

const mix = require('laravel-mix');

mix.webpackConfig({
    resolve: {
        alias: {
            '@': __dirname + '/resources/js',
        }
    }
});
<script>
import RadioButtons from '@/components/events/subcomponents/RadioButtons.vue';
</script>

Create an alias

Feb
11
2 weeks ago
Activity icon

Awarded Best Reply on Flexbox Positioning

http://jsbin.com/nuvisanawu/edit?html,css,output

Fake it till till you make it, hope this is what you want

Edit*

justify-content: space-between; can be removed

Activity icon

Replied to Flexbox Positioning

http://jsbin.com/nuvisanawu/edit?html,css,output

Fake it till till you make it, hope this is what you want

Edit*

justify-content: space-between; can be removed

Activity icon

Awarded Best Reply on File Upload

$file_name = $request->file('company_logo')->getClientOriginalName();

$request->file('company_logo')->move(public_path('logo'), $file_name);

like so

Activity icon

Replied to File Upload

$file_name = $request->file('company_logo')->getClientOriginalName();

$request->file('company_logo')->move(public_path('logo'), $file_name);

like so

Activity icon

Replied to File Upload

check storage/app/logo folder

Activity icon

Replied to Trying To Get Property 'firstBackground' Of Non-object

@if(\App\Setting::first() && \App\Setting::first()->firstBackground)
\App\Setting::first() // returns null if there are no recoreds
Feb
09
2 weeks ago
Activity icon

Awarded Best Reply on Eloquent Two Foreign Keys(I Don't Know Room->Recipient->Message)

try this

Room::with('recipients.messages')->get()';