Member Since 5 Years Ago
840 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 Access Base_path() From Within A Unit Test?
@divspace thanks, but the strange thing is, base_path() used to work. I dont know what changed.. Your solution works, but it relies on relative paths... For this reason I was hoping to get base_path() working.
Started a new Conversation Access Base_path() From Within A Unit Test?
Trying to call base_path from setupBeforeClass()
php artisan test --filter=PaymentsAndSubscriptionsTest
public static function setUpBeforeClass(): void
{
$path = base_path('tests') . "/Feature/listen_for_stripe_webhooks.sh";
exec("bash $path");
and it throws this error:
• Tests\Feature\PaymentsAndSubscriptionsTest > can reseed database
Error
Call to undefined method Illuminate\Container\Container::path()
at vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:132
128▕ * @return string
129▕ */
130▕ function app_path($path = '')
131▕ {
➜ 132▕ return app()->path($path);
133▕ }
134▕ }
135▕
136▕ if (! function_exists('asset')) {
Why can't I access base_path from within a unit test? I am on an app that was converted from laravel 7 -> laravel 8
Replied to How To Compact + Uglify + Strip Unused CSS And JS For Production Deploys?
Dont think I ever resolved this, ended up using tailwindcss and purgecss built in
Replied to Survey: What Are You Using Laravel Zero For?
@sinnbeck interesting! Didnt know about Takeout. How do you know they're using Laravel Zero?
Started a new Conversation Survey: What Are You Using Laravel Zero For?
Laravel Zero v 8.0 was just released today https://laravel-news.com/laravel-zero-8
I've always been "aware" of Laravel Zero but never quite understood why I'd need it....to me, the php artisan make
command seems to suffice, but maybe I'm missing something.
Let's turn this into a survey / poll:
Leave your reply below! Thanks :)
Replied to Laravel 8 Team::factory() Not Found
Same error here, and my use-case is a lot simpler with no circular reference.
<?php
namespace Database\Seeders;
use App\Role;
use App\User;
use Illuminate\Database\Seeder;
use Faker\Generator as Faker;
// Call using command: php artisan db:seed --class=AdminUsersTableSeeder
class AdminUsersTableSeeder extends Seeder
{
public function run(Faker $faker)
{
$adminRole = Role::where([
'title' => 'Admin',
])->firstOrFail();
User::factory()->create([
'id' => 1,
'email' => env('ADMIN_EMAIL'),
'username' => env('ADMIN_USERNAME'),
'password' => Hash::make(env('ADMIN_PASSWORD')),
'email_verified_at' => now(),
'remember_token' => Str::random(10),
'created_at' => now(),
'updated_at' => now(),
]);
}
}
This is the output
$ php artisan db:seed --class=AdminUsersTableSeeder
BadMethodCallException
Call to undefined method App\User::factory()
at vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:50
46▕ * @throws \BadMethodCallException
47▕ */
48▕ protected static function throwBadMethodCallException($method)
49▕ {
➜ 50▕ throw new BadMethodCallException(sprintf(
51▕ 'Call to undefined method %s::%s()', static::class, $method
52▕ ));
53▕ }
54▕ }
• Bad Method Call: Did you mean App\User::toArray() ?
+3 vendor frames
4 database/seeders/AdminUsersTableSeeder.php:20
Illuminate\Database\Eloquent\Model::__callStatic("factory", [])
+24 vendor frames
29 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
and it's driving me nuts. Anyone??
Replied to Cant Upgrade Php Version On MacOS Catalina
/usr/local/bin/php is a logical link to /usr/local/Cellar/php/7.4.9/bin/php
so I think you meant this:
sudo ln -s /usr/local/Cellar/php/7.4.9/bin/php /usr/bin/php
Unfortunately Catalina's system integrity protection wont let me do that.
$ sudo ln -s /usr/local/Cellar/php/7.4.9/bin/php /usr/bin/php
Password:
ln: /usr/bin/php: Operation not permitted
Ready to hang in the towel on this one - was really hoping for a way to fix the php version in /usr/bin/php, but Apple makes it really difficult.
Replied to Cant Upgrade Php Version On MacOS Catalina
@bugsysha I want to use php locally (instead of homestead or valet) - i dont want to deal with VMs, port forwarding, and all that
@snapey @tykus good point yeah, and that works, but I'd like to just run "php" and not have to worry about version differences and being bitten by this issue again. Hope that makes sense.
@tisuchi I did try the approach at http://laravel-school.com/posts/macbook-update-php-version-globally-35 but it didnt work for me. My cron job still invokes /usr/bin/php which has version 7.3.
@tray2 that didnt work either.
Started a new Conversation Cant Upgrade Php Version On MacOS Catalina
I have a very annoying problem. I have 2 versions of PHP on MacOS Catalina, and no matter what I do, I cant seem to get rid of the old (php 7.3.x) version. I can't change anything in /usr/bin/ on my Mac, even though I'm an admin user.
The 2 versions of PHP are:
$ /usr/bin/php -v
PHP 7.3.11 (cli) (built: Apr 17 2020 19:14:14) ( NTS )
$ /usr/local/bin/php -v
PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06) ( NTS )
Even though which php
and php -v
use 7.4:
$ which php
/usr/local/bin/php
$ php -v
PHP 7.4.9 (cli) (built: Aug 7 2020 19:23:06) ( NTS )
The problem is that when my cron job runs, it uses /usr/bin/php (version 7.3.x), making my cron job fail (turns out some Laravel package code - specifically Mailcoach - is not compiant with php 7.3.* and NEEDS php v 7.4 or above.
This is what my PATH variable looks like:
$ echo $PATH
/usr/local/bin/php:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:./vendor/bin:/usr/local/sbin:/Users/kunalpunjabi/.composer/vendor/bin:/usr/local/mysql/bin:/usr/local/bin/mysql
If you've encountered this before or know how to fix it, please help!
Replied to Package Or Repo For Email Drip Campaign Functionality? (not Drip.com)
Thanks @bobbybouwmann just looking for a good starting point
Started a new Conversation Package Or Repo For Email Drip Campaign Functionality? (not Drip.com)
I am looking for a Laravel Package or Repo that implements email Drip campaigns (NOT using Drip.com), on top of ANY email provider (whether custom or using a provider like Mailgun). I am using Laravel Mailcoach for my emails and they dont have Drip functionality yet - but this is something I urgently need. I intend to build a layer in my app that uses Mailcoach underneath....really need a good starting point.
Any pointers to code snippets or repos that do the Drip portion (adding / editing / deleting / scheduling Drip campaigns) would be helpful.
Started a new Conversation Nuxt Subdomain Routing
I'm trying to implement subdomain routing in Nuxt. This is what I need to do:
/pages/username/index.vue:
username1.mydomain.com (this page should display "hello, i am username1")
username2.mydomain.com (this page should display "hello, i am username2")
username3.mydomain.com (this page should display "hello, i am username3")
username4.mydomain.com (this page should display "hello, i am username4")
and so on
/pages/username/content.vue
username1.mydomain.com/content (this page should display "content by username1")
username2.mydomain.com/content (this page should display "content by username2")
username3.mydomain.com/content (this page should display "content by username3")
username4.mydomain.com/content (this page should display "content by username4")
and so on
I found this link (have yet to make it work) but it uses @Nuxtjs/router to (i think) override vue-router - wondering if there's a better way, I really like nuxt's ability to "create a page and you dont need to define the route" approach. Is there a way to do this in nuxt, ideally without vue-router, keeping the nuxt default page / routing behavior?