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 Getting All Comments Of All Posts Of A User
I'm talking about comments on your posts from other users.
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.
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
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
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();
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();
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
Awarded Best Reply on Dusk Not Finding New Method Name
Method name should start with test
try: testLoginPage()
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
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
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)
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
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
Replied to Dealing With External API Responses
Hi, you could use a trait for it, parent class or a helper function globally registered
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
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
Awarded Best Reply on TDD: Failed Asserting That A Row In The Table [tasks] Matches The Attributes
try $task->update(
instead of $task->updated(
Replied to TDD: Failed Asserting That A Row In The Table [tasks] Matches The Attributes
try $task->update(
instead of $task->updated(
Awarded Best Reply on How To Mix Blade And Php?
@php
// php
@endphp
you could use @php
blade directive
Replied to Target Class [Illuminate\Auth\Middleware\adminpermission] Does Not Exist.
'adminpermission' => App\Http\Middleware\adminpermission::class,
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?
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
Replied to Laravel Mix & Vue : Module Parse Failed: Unexpected Token
What's your node version? node -v
Awarded Best Reply on TDD: Error: Class 'http\Client\Curl\User' Not Found
add this use Illuminate\Support\Collection;
at the top
Replied to TDD: Error: Class 'http\Client\Curl\User' Not Found
add this use Illuminate\Support\Collection;
at the top
Replied to TDD: Error: Class 'http\Client\Curl\User' Not Found
use http\Client\Curl\User;
namespace is incorrect
should be, App\Models\User
Replied to Error When Running Npm Install && Npm Run Dev
@snackpack you have an old version of node, update it and try again
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);
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);
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
Replied to Can't Access My Homepage
{{ asset($Freshtrack->ImageUpload->filename) }}
Object $Freshtrack
doesn't have ImageUpload
property, or it is NULL
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;
}
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
Event::create($request->input());
You don't have to wrap request->input()
into another array
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
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
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
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
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
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
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