880 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 Livewire Version Of Vue Dev Tools Or Networ
Hey,
If you are already familiar with Vue devtools, you can actually use livewire-devtools
: https://github.com/beyondcode/livewire-devtools , as they have the same functionallity
Commented on Comments Component
You can also use $this->post->refresh()
to re-hydrate the Post
model using fresh data from the database.
Docs: https://laravel.com/docs/8.x/eloquent#retrieving-models
Replied to Form Request Cannot Be Sent Using POST.
I think the /{user}
route is overwriting your /create
route, you need to change the order:
Route::prefix('users')->group(function () {
Route::get('/', '[email protected]')->name('admin.users');
Route::get('/{user}', '[email protected]_user')->name('admin.users.view');
Route::post('/create', '[email protected]_user')->name('admin.users.create');
Route::post('/{user}/edit', '[email protected]_user')->name('admin.users.edit');
Route::post('/{user}/delete', '[email protected]_user')->name('admin.users.delete');
});
Awarded Best Reply on Add A Global Method To All Eloquent Models.
// Your custom model.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model as EloquentModel;
class Model extends EloquentModel
{
public function customMethod()
{
//
}
}
Your models
<?php
namespace App;
class ExampleModel extends Model
{
}
Replied to How To Assert Paginations In Laravel?
I would create 2 categories, and then just make sure that you can only see the first one (because the pagination):
$category1 = factory(Category::class)->create();
$category2 = factory(Category::class)->create();
$response = $this->get(route('categories.index'));
$response
->assertSee($category1->name)
->assertDontSee($category2->name);
Just updated the example with categories.
Awarded Best Reply on PDOExcetion('Could Not Find Driver')
I think you just need to install the dbal
driver now:
composer update
composer require doctrine/dbal
Replied to MIgration Issue
That's weird. I just copied the code, and it's working for me, which MySql version are you using?
Replied to MIgration Issue
Hey, you have a typo on ->refrences
in the 2 foreign
lines:
$table->foreign('contact_user_id')->references('id')->on('contact_users');
Replied to User In Laravel Controllers
Hey, If you want to eager load the relationships everywhere, I would suggest using the $with
property in your User
model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* The relationships that should always be loaded.
*
* @var array
*/
protected $with = ['author'];
/**
* Get the author that wrote the book.
*/
public function author()
{
return $this->belongsTo('App\Author');
}
}
Docs: https://laravel.com/docs/7.x/eloquent-relationships#eager-loading
Replied to PDOExcetion('Could Not Find Driver')
I think you just need to install the dbal
driver now:
composer update
composer require doctrine/dbal
Replied to PDOExcetion('Could Not Find Driver')
Are you sure you have the mysql_pdo
driver installed?
Check your extensions file and make sure that it isn't commented and that it's installed.
In your php.ini
:
extension=php_pdo_mysql.dll
Replied to Problem With PHPUnit + SQLite DropColumn()
Is the configuration inside .env.testing
/.env
correct?
Replied to PDOExcetion('Could Not Find Driver')
Hey, maybe you are missing the dbal
driver:
composer require doctrine/dbal
Awarded Best Reply on Difference Between Session::get And {!!
I understand now.
The redirect with
and the view with
, don't do the same.
with
puts the variable in the session.with
passes the variable to the view.You have some options here. Instead of passing the variable to the view, you can put it in the session, so the redirect and the view will work :
// Passing to session and returning the view.
session(['param1' => $param1]);
return view('Page1');
// Passing to session and redirecting.
return Redirect::back()->with('Param1', $Param1);
Then in your javascript access it like:
var Param1={!! Session::get("Param1") ?? '' !!};
Replied to Difference Between Session::get And {!!
I understand now.
The redirect with
and the view with
, don't do the same.
with
puts the variable in the session.with
passes the variable to the view.You have some options here. Instead of passing the variable to the view, you can put it in the session, so the redirect and the view will work :
// Passing to session and returning the view.
session(['param1' => $param1]);
return view('Page1');
// Passing to session and redirecting.
return Redirect::back()->with('Param1', $Param1);
Then in your javascript access it like:
var Param1={!! Session::get("Param1") ?? '' !!};
Replied to Difference Between Session::get And {!!
Hey, with
passes the variable to the view, not to the session, that's why the first option works.
You can also use this to access the variable in your javascript:
var Param1 = @json($Param1);
Replied to How To Prevent Trimming Of Spaces While Creating A Record In Db
That's weird, I don't really know what else to do then, sorry.
Replied to How To Prevent Trimming Of Spaces While Creating A Record In Db
You should put the name of the attribute in this array. In case you don't want to trim the name
of the user:
protected $except = [
'name'
];
Replied to How To Prevent Trimming Of Spaces While Creating A Record In Db
Hey, in the TrimStrings
middleware there's a property $except
where you can add all the fields you want to save without being trimmed. If you want to do this for all the fields you can remove the TrimStrings
middleware from Http/Kernel
.
Awarded Best Reply on Download Laracast Videos
Hey skino, Yeah sure, you have a Download button on the episode link page, just right to the Watchlist button.
Replied to Download Laracast Videos
Hey skino, Yeah sure, you have a Download button on the episode link page, just right to the Watchlist button.
Awarded Best Reply on Dynamically Generated Nav Dropdown
One option is to use View Composers
, so you only need to define the variable you want to share once.
public function compose(View $view)
{
$view->with('categories', $this->categories);
}
Replied to Dynamically Generated Nav Dropdown
One option is to use View Composers
, so you only need to define the variable you want to share once.
public function compose(View $view)
{
$view->with('categories', $this->categories);
}
Awarded Best Reply on In Which File To Write Application Routes
Normally you would use the web.php
file. If you just want api routes (to use with axios for example) you can use the api.php
file. It's just a matter of organizing routes you can visit the RouteServiceProvider
to see the differences between the files.
Replied to In Which File To Write Application Routes
Normally you would use the web.php
file. If you just want api routes (to use with axios for example) you can use the api.php
file. It's just a matter of organizing routes you can visit the RouteServiceProvider
to see the differences between the files.