Mythos33

Mythos33

Waldkirchen

Member Since 3 Years Ago

Experience Points 87,625
Experience
Level
Lessons Completed 901
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

16 Nov
1 year ago

Mythos33 left a reply on Laravel CI Testing With GitLab

Hey there, I'm using the config of @Refringe. But I'll get this error:

Checking out ca730a3c as master...
$ bash .gitlab-ci.sh
$ php vendor/bin/phpunit --colors
Could not open input file: vendor/bin/phpunit
ERROR: Build failed: exit code 1

Does anyone know why composer doesn't install the dependencies?

Regards, Stefan

28 Dec
2 years ago

Mythos33 left a reply on [L5.2] Login Not Working

@thomaskim That explains many things. Thanks for the clarification. What should I do when I want to create some API functions? Is there a special middleware like 'web' for that? Or do I just place them in an e.g. '[prefix => 'api']' group?

Mythos33 left a reply on [L5.2] Login Not Working

@thomaskim Wow that did the trick. I just wonder why nobody experienced that issue as it was untouched and a clean install. I'ts a bit weird to me, that everything needs the web middleware. (even the '/' route)

Mythos33 left a reply on [L5.2] Login Not Working

@AkiyamaSmart

It's the original code from php artisan make:auth.

https://gist.github.com/Mythos/d7fcb69fdd4b60194c12

Mythos33 left a reply on [L5.2] Login Not Working

@AkiyamaSmart Nope, doesn't work unfortunately.

@monsterdream My routes.php looks like this:

Route::get('/', function () {
    //return view('welcome');
    return Auth::check() + '';
});

Route::group(['middleware' => ['web'], 'prefix' => 'admin'], function () {
    Route::resource('users', Admin\UserController::class);
});

Route::group(['middleware' => 'web'], function () {
    Route::auth();

    Route::get('/home', 'HomeController@index');
});

Mythos33 started a new conversation [L5.2] Login Not Working

Hey guys,

I'm trying to continue learning laravel and I created a new laravel application with 5.2. After installing it I ran php artisan make:auth to generate auth scaffolding. Works so far, I can register. But when I try to login, the first time I get redirected back, means the login was probably successful. But now comes my problem: On top I still see "Login / Register" instead of a dropdown with a logout button. Displaying Auth::guest() shows that I'm not logged in. (returns 1) But when I try to click on "Login" I'll get redirected back, which means the guest middleware says that I'm logged in.

Did anyone of you experience that issue or has an idea what could be wrong?

Additional information:

  • Host: Win10 x64
  • Homestead: v0.4.0 / per project installation
  • Migrations ran successfully
  • Switching session driver from file to database did not solve that problem
  • Browser has a session cookie and a remember-me cookie

Best regards, Stefan

14 Oct
3 years ago

Mythos33 started a new conversation En-/Decrypting Attributes Using Accessors & Mutators

Hello guys,

for my project I want to encrypt/decrypt data in my database. Easiest way to do this is to create accessors & mutators with the according call to the Crypt class.

With tinker and model factories I've found out that creating my models works as expected. Finding an entry works, but the value is encrypted in the JSON. When I access the property it is decrypted.

How can I decrypt those attributes easily for example in lists without iterating through every item and set the attribute which would not work unless I would use a DTO or something like that?

Regards,

Mythos

14 Sep
3 years ago

Mythos33 left a reply on Mass Assignment And Controller Methods

Thanks, didn't notice that I have a typo in my code.

Mythos33 started a new conversation Mass Assignment And Controller Methods

Hello guys,

if I have a model like this:

class Category extends Model
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['name', 'user_id'];

    /**
     * Get the user that owns the category.
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

Should the user_id be fillable in case an administrator can move the category from one user to another?

My second question is about controller methods:

public function store(CategoryCreateRequest $request)
{
    $this->repoistory->create($request->all());
    return redirect()->route('categories.index');
}

public function update(Request $request, $id)
{
    $category = $this->repoistory->find($id);
    if (Gate::denies('update-category', $category)) {
        abort(403);
    }
    $this->repoistory->update($request->all(), $id);
    return redirect()->route('categories.index');
}

What can I do to improve those methods? (I'm using Bosnadev's repositories btw) When I try to call my update method, I'll get an error, because it tries to store the CSRF-token and the method.

Thanks for your help.

Regards, Mythos

10 Jun
3 years ago

Mythos33 left a reply on Laravel5 CRUD Generator

Hi, I'm using your package and it seems nice. Just some things to improve (just my opinion):

  • Models always get pluralized (User -> Users), would be nice if there's an option to disable that
  • I would like to have editable stubs

Regards, Stefan

18 May
3 years ago

Mythos33 left a reply on RepositoryInterface Is Not Instantiable

Thanks, I've completely missed that subfolder.

Mythos33 started a new conversation RepositoryInterface Is Not Instantiable

Hello guys,

I've done some refactoring and now I'm getting this error:

Target [App\Contracts\Repositories\Models\CategoryRepositoryInterface] is not instantiable.

I'm using it in my CategoryController via constructor injections:

    /**
     * CategoryController constructor.
     * @param CategoryRepositoryInterface $repository
     */
    public function __construct(CategoryRepositoryInterface $repository)
    {
        $this->repository = $repository;
    }

Also I'm creating a binding in my DatabaseServiceProvider:

        /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $type = 'Caching';
        $models = array(
            'Category',
            'Product',
        );

        foreach ($models as $model) {
            $this->app->bind("App\\Contracts\\Models\\{$model}RepositoryInterface", "App\\Repositories\\{$type}\\{$type}{$model}Repository");
        }
    }

The namespaces in my interfaces/repositories/controllers should be correct. Do you know how to get rid of this error?

Regards, Mythos

20 Apr
3 years ago

Mythos33 started a new conversation How To Add A "unique Per User" Validation Rule?

Hello,

I have a model called Category for which I want to create validation rules:

name
user_id (references users.id)

Now I want a validation rule that a user can not create multiple Categories with the same name, which would be done with the unique rule. But this would say that Category "Test" may onle be in the table one time. If another user creates "Test" the validation will fail.

So how do I create this validation rule?

Regards, Mythos

16 Apr
3 years ago

Mythos33 left a reply on Generics Equivalent In PHP

Ah thanks for your answers @Ruffles @tag :-)

Mythos33 left a reply on Generics Equivalent In PHP

Isn't there a way to type hint my parameter for the save method?

Because a Group should not be passed into UserRepository's save method. ;-)

Using it like this also does not work, because of the different method signature:

(pseudo code)

function save(Model $model); // Method in my Interface

function save(User $model); // Method in my UserRepository implementing the RepositoryInterface

Mythos33 started a new conversation Generics Equivalent In PHP

Hello guys,

I'm trying to use Repositories which implement my RepositoryInterface. As a C# .NET developer I would create a Generic interface like this:

public interface IRepository<TModelType>
{
    IEnumerable<TModelType> FindAll();
    void Save(TModelType model);
}

I would implement it like this:

public class UserRepository : IRepository<User>
{
    public IEnumerable<User> FindAll()
    {
        // Method body
    }

    public void Save(User model)
    {
        // Method body
    }
}

Now my question: Is there something like this in PHP?

Regards, Stefan

26 Feb
3 years ago

Mythos33 left a reply on Laravel 5 Generators Extended

@JeffreyWay How do I install the new generators? It seems they have not been added to packagist, because my composer require 'laracasts/generators' --dev is not able to download and install the package.

Mythos33 left a reply on PhpStorm 8 Blade Support For Laravel 5

@IsraelOrtuno Unfortunately your image is not working due to 403 on Dropbox.

@mstnorris I've got v0.7.2 of the Laravel Plugin installed

@m.rankovic Awesome that worked, thanks!

Mythos33 left a reply on PhpStorm 8 Blade Support For Laravel 5

@mstnorris I've installed the latest version of the Laravel Plugin and I've done composer require barryvdh/laravel-ide-helper so it should have installed the latest version of that, too.

@m.rankovic I'll try that later, thanks.

Mythos33 left a reply on PhpStorm 8 Blade Support For Laravel 5

No, I'll try it in the evening after work.

What should I change in here, to get support for {!! !!} ?

http://laravelnews.s3.amazonaws.com/media/2014/09/phpstorm-blade-custom-tags.png

Mythos33 left a reply on PhpStorm 8 Blade Support For Laravel 5

Yes everything is up and running, just the autocompletion in blade files is not working. PhpStorm thinks that everything in {!! !!} is just normal HTML, including the tags.

Mythos33 left a reply on PhpStorm 8 Blade Support For Laravel 5

Yep I'm using this IDE Helper and set composer to update the IDE Helper and my models on composer update.

Mythos33 started a new conversation PhpStorm 8 Blade Support For Laravel 5

Hey guys,

I've noticed that my PhpStorm 8 does not support Blade's {!! !!} which was introduced in L5.

So I won't get autocomplete for e.g. {!! Form::password('password') !!}.

Does anyone of you know a workaround?

I have installed the latest Laravel Plugin for PhpStorm and I'm using the IDE Helper.

Regards,

Mythos

24 Feb
3 years ago

Mythos33 left a reply on Always Pass Certain Variables To A View

Thanks that's what I was looking for!

Mythos33 started a new conversation Always Pass Certain Variables To A View

Hello guys,

I want to pass certain variables to my views which are e.g. used in the master layout.

So the easiest thing would be creating a method in Controller like:

function showView($viewName) { return View::make($viewName)->with('version', $this->version); }

Now I want to use that in any controller like this:

$this->showView('users')->with('users', $users);

How can I create that method to work fluently?

Regards,

Stefan

23 Feb
3 years ago

Mythos33 left a reply on How To Update The Application?

Ah ok thanks for your answer. ;-) So now I'll update the app by hand. Any recommendations for merging the changes quickly under windows?

Mythos33 left a reply on How To Update The Application?

I want to update my L5 app. For example Taylor pushed this one today: https://github.com/laravel/laravel/commit/4e444b0820ec3c4b466287407c5b3f466a15886f

I want to include these changes in my project but I don't want to check every file for changes. Isn't there a composer update-like way to do that?

Mythos33 left a reply on How To Update The Application?

Hi,

how do I do that exactly? I only have a reference to laravel/framework but I want to update laravel/laravel.

Regards,

Stefan

Mythos33 started a new conversation How To Update The Application?

Hello guys,

I'm been learning Laravel now for some time, but there's one thing that isn't covered by Laracasts or in the Docs. I've created my project via composer, but there have been some useful changes to the application. (https://github.com/laravel/laravel) So how do I update my existing project easily? Updating via git is not an option as I don't have a git history.

I hobe you can help me out with my issue.

Regards, Stefan