Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

cristimocean

cristimocean

Member Since 1 Year Ago

Experience Points
9,590
Total
Experience

410 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
87
Lessons
Completed
Best Reply Awards
0
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.

Level 2
9,590 XP
Aug
08
3 months ago
Activity icon

Replied to Mix Documentation Wrong/outdated ?

A slightly unrelated question: after I removed mix.version() and the mix() helper and I compiled again with "npm run watch" Chrome stopped caching ! I checked the network tab in chrome devtools and it no longer says (memory cache) but it's downloaded each time instead. Any idea what caused this ? Chrome used to serve from cache before I played with version()/mix() ...

Activity icon

Replied to Mix Documentation Wrong/outdated ?

thanks a lot Snapey,it's clear now

Activity icon

Replied to Mix Documentation Wrong/outdated ?

webpack.mix.js

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .version();

mix-manifest.json

{
    "/js/app.js": "/js/app.js?id=c8fd755425ce3cdde8a9",
    "/css/app.css": "/css/app.css?id=30709468585d3b432ca4"
}

package.json

     "laravel-mix": "^5.0.1", 

I am using laravel 7

Activity icon

Started a new Conversation Mix Documentation Wrong/outdated ?

The docs say "The version method will automatically append a unique hash to the filenames" and that I should use the mix helper to detect file names () but that not seem to be the case. My javascript is NOT hashed after adding .version , it's still under public\js\app.js and layout.app is loading it just fine with asset('js/app.js') , no mix helper needed ...

Jul
29
3 months ago
Activity icon

Replied to Some Laracasts Captchas Cannot Be Easilly Bypassed

hmmm...while trying to update my previous post I noticed that answers that previously worked (ex: $var="foo") no longer work. It seems to be a random failure.

Activity icon

Started a new Conversation Some Laracasts Captchas Cannot Be Easilly Bypassed

I was trying to edit my own reply and I had to fill this captcha: What do the programmers say to the "world" ? I type all these: hello, Hello, hello world, Hello World, Hello world. None of them worked. Also when tring to make a new post the captcha's text is not fully visible (it could be because I have large fonts set). Also there was another question to make a PHP variable which did not accept $a = 1 .

I can understand the enthusiasm to have programming related captchas but the implementation is frustrating for users (at least for me).

Jul
28
3 months ago
Activity icon

Started a new Conversation Pusher Stops Working After Installing Bootswatch

I've tested this a couple time by using git stash and reverting before the install. Pusher is working just fine, then I run npm install bootswatch (some bootstrap themes package), then I add

@import "~bootswatch/dist/cyborg/variables";
@import '~bootstrap/scss/bootstrap';  // this already exists
@import "~bootswatch/dist/cyborg/bootswatch";

and then I get 2 errors in javascript console:

  1. You must pass your app key when you instantiate Pusher.
  2. Echo is not defined
Jul
23
4 months ago
Activity icon

Replied to How Does Passport's "Consuming Your API With JavaScript" Work ?

AWESOME answer.

I wish the docs were as clear as your answer.

Thanks a lot

Jul
22
4 months ago
Activity icon

Replied to Dusk Runs Web.php Multiple Times

Adding

    protected $preserveGlobalState = FALSE;
    protected $runTestInSeparateProcess = TRUE;

to the test class fixed it.

Source https://queirozf.com/entries/error-message-constant-already-defined-when-using-phpunit

Activity icon

Replied to Dusk Runs Web.php Multiple Times

If I comment the "version" constant out I get this error. Removing Telescope doesn't help though. Still digging. https://github.com/laravel/telescope/issues/361

Jul
21
4 months ago
Activity icon

Started a new Conversation Dusk Runs Web.php Multiple Times

I am just learning Dusk, and I have a problem: I cannot run more than one test at a time. If I try to run 2 tests I get an error about const version being already defined in web.php. How can I run 2 tests and bypass this error ?

I run this with php artisan dusk --group setup

Here's my code:

<?php

namespace Tests\Browser;

use App\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class SetupTest extends DuskTestCase
{
    use DatabaseMigrations;

    public function setUp():void
    {
        parent::setUp();

        $this->seed();
    }

    /** @test
     * @group can_login
     * @group setup
     */
    public function can_login()
    {
        $this->browse(function (Browser $browser) {
            $member = factory(User::class)->create();
            $browser->loginAs($member)
                ->visit('/home')
                ->assertPathIs('/tasks');
        });
    }

    /**
     * @test
     * @group can_connect_to_database
     * @group setup
     */
    public function can_connect_to_database()
    {
        DB::statement('CREATE TABLE dummy (id int, name varchar(255))');
        $data = ['id' => 1, 'name' => 'lalala'];
        DB::table('dummy')->insert($data);
        $this->assertDatabaseHas('dummy', ['name' => 'lalala']);
    }

}

Jul
02
4 months ago
Activity icon

Replied to How Does Passport's "Consuming Your API With JavaScript" Work ?

Can anyone confirm this feature does not provide some hidden ways to work with scopes and per user access ? All clues lead that way, I'm just asking for my peace of mind.

Activity icon

Replied to How Does Passport's "Consuming Your API With JavaScript" Work ?

I just tried and set in authServiceProvider

    Passport::setDefaultScope([
        'none'
    ]);

So now the token generated by CreateFreshApiToken should have a token , so it shouldn't ignore scopes anymore . But it does.

Activity icon

Replied to How Does Passport's "Consuming Your API With JavaScript" Work ?

Thank you. I'll look into that. Though it sounds like a strange logic rule ...having no scopes gives access to all scopes ?? Also CreateFreshApiToken is creating it's own token (laravel_token) and the docs don't specify any way to update it.

Activity icon

Started a new Conversation How Does Passport's "Consuming Your API With JavaScript" Work ?

I was following the official docs, trying to learn how to use Passport and I hit a wall at this section: https://laravel.com/docs/7.x/passport#consuming-your-api-with-javascript The problem is that this feature simply allows me access to EVERYTHING. It ignores scopes and the logged in member. Is that how is it supposed to work ?

For example:

Route::get('articles/{article}', '[email protected]')->middleware(['auth:api', 'scopes:chewarticlepaper']);

The "chewarticlepaper" scope does not exist, but I can still access the article from javascript. And I can even access the articles from members who don't even have an access token. The only thing the CreateFreshApiToken middleware seems to achieve is keep away guests. Is this all it does or I am missing something ?

Any good tutorial on using this particular feature ? (CreateFreshApiToken / laravel_token) ?

Thanks

Jun
16
5 months ago
Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

oohh shoot... turns out I hardcoded my account as admin and allowed to bypass policies. When I tested with another account it was working.

The lesson: don't code when you're tired. Or learn to debug properly.

Jun
12
5 months ago
Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

really ? wow...I misunderstood then.

well on my computer it doesn't.

I'll try with a new repo tommorow. Going to sleep now since it's 2 AM here. Thanks again a lot for all the help. I appreciate it very much !

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

anyway going to sleep, thanks for trying . It's some crazy bug, probably hard to pinpoint.

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

well nevermind...I am using the official git anyway. But it does NOT work. The policy is NOT reached !

You should NOT be able to post twice in less than a minute !

But thank you for trying to help. I appreciate it.

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

Since you already can see my code...here's the issue expressed with the logging:

In browser (POLICY NOT CALLED !!) [2020-06-12 22:03:58] local.INFO: asking auth [2020-06-12 22:03:58] local.INFO: done auth [2020-06-12 22:04:01] local.INFO: asking auth [2020-06-12 22:04:01] local.INFO: done auth

In tests (POLICY CALLED AND WORKING - second time it doesn't allow to reach done auth ) [2020-06-12 22:04:37] testing.INFO: asking auth [2020-06-12 22:04:37] testing.INFO: create policy [2020-06-12 22:04:37] testing.INFO: done auth [2020-06-12 22:04:37] testing.INFO: asking auth [2020-06-12 22:04:37] testing.INFO: create policy

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

You should not be able to post 2 consecutive replies in less than a minute. You should get an error notification bottom-right.

I tracked the issue to ReplyPolicy > create not being called when running from browser.

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

Well you might be right...just saying that for me personally all these changes were a big source of wasted time. But I guess python wasn't THAT much better either :)

Here it is. https://github.com/cristimocean/tddforum

That is my code when I reached lesson 54.

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

for now I resorted to cloning his github. I have absolutelly zero ideas how I could go about debugging such issue. The fact that it works in testing but not in browser , despite both making the same post calls, to the same endpoint puzzles me really bad !

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

well I used 5.5 and he uses 5.4 and by lesson 40 I already had to do 3 things differently ! And what about removing make:auth or changing model keys from integer to biginteger ?

Those are things that as a beginner made me loose a lot of time !!

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

well..the worst thing about Laravel is that it constantly breaks backwards compatibility :(

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

It must be some bug / setting in my project because even a simple gate doesn't work. A Gate::allows returns true even for non existing gates !!

But on a blank Laravel 7 project I CAN use simple gates.

Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

This happens to other callbacks in the policy controller too (for example update doesn't run either).

I am sure the callback is not reached because I placed server Log instructions (I don't know how to set phpunit to debug under vagrant :D ).

I DID place the policy in auth server provider:

protected $policies = [ 
    'App\Reply' => 'App\Policies\ReplyPolicy',
];
Activity icon

Replied to Policy Called Only In Tests But Not From The Front End

Same error . I'm on Laravel 5.5 if that helps.

Activity icon

Started a new Conversation Policy Called Only In Tests But Not From The Front End

In the "make a forum with TDD" tutorial (episode 54) I have that problem from title.

  • In controller > store $this->authorize('create', new Reply); // -- this always gets run

  • In policy file public function create(User $user){ // -- this point is only reached when running tests

So again ... the authorize function does not call the policy when running from front-end (manual browser) but it does run when running tests. Both the tests and the browser make a post request to the controller > store endpoint, in which the authorize is.