matalina

matalina

Member Since 5 Years Ago

Gulf Coast of MS

Web Developer at Baber's Inc

Experience Points 6,215
Experience Level 2

3,785 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 131
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

08 Apr
1 week ago

matalina started a new conversation Advice: Multiple Similar Sites Based On Similar Code Bases

I work for a company that has multiple subsidiaries which all use basically the same information but have different databases, and one central home office. I'm rewriting our intranet to be separate for each company it's already written in laravel (mostly) and I intend to use some of the code going forward in the rewrite, not all of it because there are better techniques to employ.

But I'm wondering what's a good way to maintain multiple code bases that are built on top of a similar code base.

So here's the more details version. I have a base version of the app that controls authentication, notifications, websockets, queues, artisan commands that run on a schedule, as well as the other common features like document management, calendars and things. I have at least two derivatives that will share base code but not presentation so I pulled most of that code out into an api to be called and the app can just process the information as it wants. BUT since a great deal of the functionality is the same - only slightly different I'm at odds of how best to maintain these different pieces of code.

I can go a fully modular route and write each piece as it's own separate repo and pull them in in NPM or composer but then if I need to make a change to these bits of code I have to update the repo. (all these things are being written and tested in tandem)

I can use one repo with three separate branches. The common, and one for each derivative. This seems like the easiest maintenance route as long as the workflow remains separate for each one.

And then there is the forking from the common branch and using pull requests to update the common and other branches as necessary.

I'm trying to keep my code DRY and not have so many places to maintain.

Any suggestions?

15 Mar
1 month ago

matalina left a reply on AssertStatus Giving Errors

@NASH - Thank you. I thought I had it aliased to use the vendor installed one I must have it installed globally!

matalina started a new conversation AssertStatus Giving Errors

New to testing. But not exactly sure why I'm getting this error on the frist run, and then it passes on the other two (at least that's what I'm assuming)

I have three Test classes that are identical (just the basic stub)

<?php

namespace Tests\Feature\Versirent;

use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class DocumentationTest extends TestCase
{
    /**
     * A basic feature test example.
     *
     * @return void
     */
    public function testExample()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }
}

The following error happens:

PHPUnit 6.5.7 by Sebastian Bergmann and contributors.

E..                                                                 3 / 3 (100%)

Time: 467 ms, Memory: 20.00MB

There was 1 error:

1) Tests\Feature\Versirent\DocumentationTest::testExample
ErrorException: Declaration of Illuminate\Foundation\Testing\Assert::assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void should be compatible with PHPUnit\Framework\Assert::assertArraySubset($subset, $array, $strict = false, $message = '')

/mnt/d/projects/intranet_api/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Assert.php:42
/mnt/d/projects/intranet_api/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:131
/mnt/d/projects/intranet_api/tests/Feature/Versirent/DocumentationTest.php:20

ERRORS!
Tests: 3, Assertions: 2, Errors: 1.

if I comment out the $response->assertStatus(200); i get the expected no assertion test and then the second class/test fails for the above reason.

Everything is default phpunit settings that came when I ran the laravel composer scripts. And I've updated through composer as well.

Any ideas? Really at a loss for this and I'd really like to use the laravel helper methods as it's cleaner code.

11 Mar
1 month ago

matalina left a reply on GUID In API Resources

Found my answer.

In order to get the resource to populate. In the Model Resource file change brand in ToArray to

'brand' => new Brand($this->whenLoaded('brand')),

matalina left a reply on GUID In API Resources

As a side note: this is the error

"Malformed UTF-8 characters, possibly incorrectly encoded"

matalina started a new conversation GUID In API Resources

I'm using MSSQL in Ubuntu 16.04LTS PHP 7.2. (I don't know the version of MSSQL)

I have a Model, Brand and Status table in the MSSQL database.

I'm writing an API for read only access to this database so I'm using the API Resource to convert my models to JSON easily.

I call the brand url and I'm able to pull up the Brand GUID without a problem.

I call the model url and eager loading brand using with on the query and the whenLoaded in the resource however the brand will not load with it despite being on the model correctly.

As a note the GUID requires a conversion using getBrandIDAttribute in order to display in a human readable format (This is likely the problem but no idea how to fix it).

When loading a resource through another resource as a relationship it's not using the get mutator.

The same exact code is working for the status relationship which uses an integer id to signify the relationship.

So the question is can the GUID be made human readable without the conversion? I've been unable to find the way to do it so just convert it with a mutator.

Or am I doing something wrong I'm completely missing??

Below are the snippets of code.

Model Resource

class Model extends JsonResource
{
    public function toArray($request)
    {
        return [
            'ModID' => $this->ModID,
            'ModelNumber' => $this->ModelNumber,
            'ModelDescription' => $this->ModelDescription,
            'PCID' => $this->PCID,
            'BrandID' => $this->BrandID,
            'MfrID' => $this->MfrID,
            'ModStatID' => $this->ModStatID,
            'Life' => $this->Life,
            'UPCNumber' => $this->UPCNumber,
            'DefaultReceiveAs' => $this->DefaultReceiveAs,
            'DisAllowBundle' => $this->DisAllowBundle,
            'ShowAPI' => $this->ShowAPI,
            'ImageURL' => $this->ImageURL,
            'ModelDetails' => $this->ModelDetails,

            'brand' => $this->whenLoaded('brand'),
            //'product_code' => $this->whenLoaded('product_code'),
            //'vendors' => Vendor::collection($this->whenLoaded('vendors')),
            //'manufacturer' => $this->whenLoaded('manufacturer'),
            'status' => $this->whenLoaded('status'),
            //'rates' => Rates::collection($this->whenLoaded('rates')),
        ];
    }
}

Brand Resource

class Brand extends JsonResource
{
    public function toArray($request)
    {
        return [
            'BrandID' => $this->BrandID,
            'BrandName' => $this->BrandName,
            'InActive' => $this->InActive,
        ];
    }
}

Status Resource

class ModelStatus extends JsonResource
{
    public function toArray($request)
    {
        return [
            'ModStatID' => $this->ModStatID,
            'Description' => $this->Description,
        ];
    }
}

Model Model

class Model extends VersiRentModel
{
    use SearchByScope;
    use SearchThroughScope;

    protected $table = 'Model';
    protected $primaryKey = 'ModID';
    public $incrementing = false;
    protected $fillable = [];

    // Relationships
    public function brand()
    {
        return $this->belongsTo(Brand::class,'BrandID','BrandID');
    }

    // ...

    public function status()
    {
        return $this->belongsTo(ModelStatus::class,'ModStatID','ModStatID');
    }

    // ...
}
19 Sep
7 months ago

matalina left a reply on SQL SRV Not Escaping Correctly

simple as it can be will cause the error.

Model::where('FirstName','LIKE',$first_name.'%')->first();

That's simplified of course.

And I realized I can do this on a one by one basis, but this can potentially hit every single string query that I've ever written....that touches the MSSQL.

Extending part of the Model, or writing a different eloquent model to correct this parsing issue is the simplest and easiest way to catch all the potential problems.

But the simplist solution at present is to not use MSSQL to check customer accounts against. It's a slightly delayed process to create account stubs in mysql where I can escape properly without rewriting the code.

It doesn't prevent any potential breaking down the line for future MSSQL queries, but it at least solves the issue here and a few other operational issues on the business side.

matalina left a reply on SQL SRV Not Escaping Correctly

Yes I'm aware that the issue is not with Laravel. I'm looking for a Laravel way to fix the problem since it's PDO and MSSQL thing and I don't want to dig too much deeper. I'll do a work around.

Writing raw queries in place of EVERY single WHERE statement that uses a string as it's value is not a feasible solution.

I assumed for as many years as I've been using Laravel that Eloquent was escaping those characters correctly. I've never had any problems with any of the drivers until now (and if I did I never had any issues reported :( )

I believe this is the first PDO/Eloquent string I have searched, usually I'm only pulling numbers from that database but I don't know if it is broken anywhere else so I wanted a global fix in Laravel to mitigate the problem so I don't get errors like this.

18 Sep
7 months ago

matalina started a new conversation SQL SRV Not Escaping Correctly

I've already googled: This issue came up - https://github.com/laravel/framework/issues/24123

Basically whenever I have a single quote in a query for the MSSQL server I get the following error:

SQLSTATE[HY000]: General error: 105 Unclosed quotation mark after the character string ''. [105] (severity 15)

Can I extend the eloquent drive to automatically apply the '' to my query. Or some other means of doing this 100% across the board for ONLY MSSQL (I use mysql as well - not my choice to use MSSQL - only reading from MSSQL)

21 May
10 months ago

matalina left a reply on Eloquent Don't Return A GUID From SQL Server

Hate to bump an old thread, but do you happen to know if this will work with a relationship.

I do though I will need to add this to some of my models I currently have many guids I need to convert and do it through getAttribute functions.

06 Jun
2 years ago

matalina left a reply on Designate Connection For Password_resets Table Other Than Default?

Not really. I made my default database the one that had the password and users in it. It fixed it, but I didn't figure out a way to use another database as my user database.

29 Feb
3 years ago

matalina left a reply on Designate Connection For Password_resets Table Other Than Default?

I managed to see that you CAN set a connection deep down inside of the Password Resets but I didn't find a way to set that specific connection before that level. I got lost in the hierarchy before I just made my default connection the one with the users and passwords on it since in ALL my Eloquent models I explicitly assign a connection (mostly so I don't forget which model goes to which database since several model files have the same name).

24 Feb
3 years ago

matalina left a reply on Designate Connection For Password_resets Table Other Than Default?

The method provided should only work if the only difference is the connection is the Databases. ie: mysql Database 1 = main database 2 = new_db

I need to change connection completely. Meaning I have my main database tables on one server and a second database on another server. Authentication works great with Model files because of the connection, but I can't figure out how to set a database config to be used with password resets.

Note: I already tried the above method and it does not work in this situation.

13 Oct
3 years ago

matalina left a reply on After Update Default Logout Not Working

I don't know what the problem was but renaming my logout method fixed the problem. If I use getLogout it causes issues. I'm assuming something is messing with inheritance and I just didn't bother with finding the root cause since I could just rename the function and be golden. getLogout does nothing with my routes now so I shouldn't see that error again.

Thanks for your help.

16 Sep
3 years ago

matalina left a reply on After Update Default Logout Not Working

That's what I thought as well.

Laravel is reading the route correctly: route:list shows correctly:

|        | GET|HEAD                       | logout                                | logout                          | App\Http\Controllers\Auth\AuthController@getLogout                         | auth       |

matalina started a new conversation After Update Default Logout Not Working

I just updated to the latest composer package and now my logout function isn't working.

FatalErrorException in VerifyCsrfToken.php line 101:
Call to undefined method Symfony\Component\HttpFoundation\HeaderBag::setCookie()

This method does not exist, did Symphony have a change?

Using a route binder:

$router->group(['middleware' => ['auth']], function () use ($router)
        {
            $router->get('logout', [
                'as' => 'logout',
                'uses' => 'App\Http\Controllers\Auth\AuthController@getLogout'
            ]);
        });
26 Aug
3 years ago

matalina started a new conversation Best Video/Series For TDD Of A Full App

I very much need to start this for my work. I'm rewriting our intranet from CI to Laravel 5.1. The biggest problem before was I make a small change here, and I break something someplace else.

I would like to find a tutorial or even just a web cast of an application in Laravel being built in a TDD way.

I get the theory behind it. A lot of what my job entails is taking a set of data and manipulating it to get more data to put in reports. I don't know what this data looks like until I get it, so writing a Test first is always going to be difficult. I didn't write the underlying schema, I have NO control over it, I can only access it to read it and then spit it out in a format my boss wants it in. But if I can get my repositories tested so that when I inevitably make a change for my boss that I won't break something else.

So what would you recommend I watch here at Laracasts to get a good handle on TDD in Laravel on an actual app. I THINK I've already watched a few here but I'd like to here your thoughts.

18 Aug
3 years ago

matalina left a reply on [L5] Where To Add Custom Validation Function?

I know this is an old topic but I wanted to add. For overriding implicit extensions (which is what I was searching for specifically) in 5.1 there is the addImplicitExtensions method in the Validator class. There is no need to override the array itself:

$this->addImplicitExtensions([
            'require_at_least_one' => 'App\Validators\CustomValidator@validateRequireAtLeastOne']
        );