0 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
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
Awarded Best Reply on Changing Terminals Name Mac
you probably are using zsh
, if so, then instead of .bash_profile
use, .zshrc
Replied to Changing Terminals Name Mac
you probably are using zsh
, if so, then instead of .bash_profile
use, .zshrc
Replied to Call Forgot-password Route Via API
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
Awarded Best Reply on Route Not Defined
Route::get('/kontakt', function () {
return view('contact');
})->name('kontakt');
Replied to Route Not Defined
Route::get('/kontakt', function () {
return view('contact');
})->name('kontakt');
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'
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
Replied to API Routes Saying 405 Method Not Allowed
You send a GET request to a POST route, send a POST request instead
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'));
}
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'));
}
Replied to How To Do This With Relationship
$category = Category::where('slug',$categorySlug)->first();
$products = $category->products
Replied to How To Post Json Data Using Http
$data = [
'userid' = 'datapi1',
'apikey' = ' // ...',
'data' => base64_encode(),
];
you don't need to json_encode
Replied to Laravel : Keys And Values
Hi, go to the html and add
@php
dd(get_defined_vars());
@endphp
and see what you get
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
}
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
])
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
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
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
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
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
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
Replied to Preview Of Image Before Hitting Method
You don't need PHP or Laravel here, use JavaScript as is described on stackoverflow
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); // <-------
Replied to Angular GET API Passing In JWT Token
No, Angular is great, you could check weekly downloads of Angular on www.npmjs.com
Awarded Best Reply on Angular GET API Passing In JWT Token
new HttpHeaders().set('Authorization', `Bearer ${token}`);
this should do it
Replied to Angular GET API Passing In JWT Token
new HttpHeaders().set('Authorization', `Bearer ${token}`);
this should do it
Awarded Best Reply on Laravel Feature Tests Always Return 404
<server name="APP_URL" value="http://localhost"/>
This is how you url should look in phpunit.xml file
Replied to Laravel Feature Tests Always Return 404
<server name="APP_URL" value="http://localhost"/>
This is how you url should look in phpunit.xml file
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
Replied to How To Move Password Hashing To A Request Class?
@michaloravec didn't know that, thanks ;)
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
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
});
Replied to Redirect To Login Page If User Not Login
Route::group([
'prefix' => '',
'middleware' => ['auth', 'role:superadmin', 'admin', 'seller', 'telemarketer']
], function () {
// routes here
});
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
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');
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
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
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
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
Replied to File Upload
$file_name = $request->file('company_logo')->getClientOriginalName();
$request->file('company_logo')->move(public_path('logo'), $file_name);
like so
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
Replied to I Want Message Row From Room Instance.
if this worked, then
Room::with('recipients.messages')->find(1);
Awarded Best Reply on Eloquent Two Foreign Keys(I Don't Know Room->Recipient->Message)
try this
Room::with('recipients.messages')->get()';