Placid

Placid

Member Since 3 Years Ago

Experience Points 6,930
Experience Level 2

3,070 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 66
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

28 Mar
2 years ago

Placid started a new conversation Authorizing In Controller Constructor

Hello,

Is it possible to authorize an action in the constructor of a controller so that every method will check the authorization before implementing the method?

I have defined a Gate as follows:

Gate::define('manage-users', function($user) {
        return $user->user_level_name == "super_admin" || $user->user_level_name == "admin";
});

This authorization will be checked for every method in UserController. It works perfectly if I include in individual methods, such as:

public function create()
{
        $this->authorize('manage-users');
        $user_levels = UserLevel::all();
        return view('users.create', compact('user_levels'));
}

But when I put the check in the constructor it blocks any user from accessing any method in the controller.

Is there any way to do this, or do I have to repeat the same check in every method in the controller.

27 Jan
2 years ago

Placid left a reply on PHP Directly Print To Printer

Thanks @SaeedPrez . I think its going to work for me.

Placid left a reply on PHP Directly Print To Printer

Hi @SaeedPrez, thank you so much for your kind suggestion. I will try it.

In your experience with these tools, is it possible to start a page, print something, end the page and start again. I am asking this because I need to print barcodes to barcode printer, for which I need to start and end the pages for barcodes to print on each barcode sticker.

Thank you again.

Placid started a new conversation PHP Directly Print To Printer

Hello,

My organization uses a web application built with PHP that prints barcodes and other formatted stuffs directly to printer. The PHP version used is 5.2.6 that has php_printer.dll extension which enables the program to print directly to printer.

Now, the management wants me to rebuild the app and I am very interested to create it using Laravel latest version which requires PHP version >= 5.6.4. But the php_printer.dll extension is not available for these versions.

I found the extension which mentions it supports 5.6.8 (https://github.com/gimjudge/php) but it does not work. I have tested with PHP 5.6.25 and 5.6.8.

So, what are my options here?

  • Am I stuck with older version of PHP because of this single issue?
  • I am self learned web developer without CS degree. I don't know C language. So I cannot create the .dll extension myself. Do I have to learn the whole process? How long might this take?
  • Can I hire someone to take the extension for the old version and create a new one for the latest version of PHP? How long may this take and how much may this cost?

Any insights is highly appreciated. Thanks

13 Aug
3 years ago

Placid started a new conversation Liking A Model: How To Set User_id As A Property Of Like Model

I am following the lesson "Liking" a model with TDD in which Jeffrey creates 'user_id' fillable property in the Likes model. But at that moment (10:10), he also hints about an alternative approach which is to create the 'user_id' as a property. Can anyone please tell me how to go in this approach? Or give me a link to any lesson where this is explained? Thanks in advance.

11 Jul
3 years ago

Placid started a new conversation Test Unauthorized Access Using PHPUnit

I am trying to test unauthorized access in Laravel 5.2 using PHPUnit.

AuthServiceProvider.php:

        $gate->define('foo', function ($user)
        {
            return $user->email == '[email protected]';
        });

routes.php:

Route::get('foo', '[email protected]');

PagesController.php:

    public function foo()
    {
        $this->authorize('foo');
        return "Hello foo";
    }

Its working properly in browser. The user [email protected] (user with id 1) can access 'localhost/foo' url. Others can't.

Test:

    /**
     * @test
     */
    public function it_allows_authorized_user()
    {
        $user = Auth::loginUsingId(1);

        $this->actingAs($user)
        ->visit('foo')
        ->assertResponseOk();
    }

    /**
     * @test
     */
    public function it_blocks_unauthorized_access()
    {
        $user = Auth::loginUsingId(2);

        $this->actingAs($user)
        ->visit('foo')
        ->assertResponseStatus(403);
    }

The second test is failing. What am I doing wrong? How to test this?

29 Jun
3 years ago

Placid left a reply on Sublime PHP Companion - Import_namespace

Thanks @tomo_pongrac for your response. I am using this key binding for expand_fqcn:

{ "keys" : ["f9"], "command": "expand_fqcn" }

and its working properly, but the import_namespace is not working correctly.

Placid started a new conversation Sublime PHP Companion - Import_namespace

I am trying to use https://github.com/erichard/SublimePHPCompanion. But I'm having a hard time with the import_namespace command. I have set the key bindings as: { "keys" : ["f4"], "command": "import_namespace" }

But when I execute this command, its not generating proper namespaces. For example, in app/Foo.php, it generates the following namespace: namespace C:\wamp\www\laravel\test1\app; where it should be: namespace App;

Again, in app/Http/controllers/FooController.php, it generates the following namespace: namespace Http\Controllers; where it should be: namespace App\Http\Controllers;

Does any one know how to make this command work properly?