Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.

Mythos33

Experience

2,675

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 58 Lessons Completed
  • 0 Favorites

16th November, 2016

Mythos33 left a reply on Laravel CI Testing With GitLab • 1 year ago

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

28th December, 2015

Mythos33 left a reply on [L5.2] Login Not Working • 1 year ago

@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 • 1 year ago

@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 • 1 year ago

@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 • 1 year ago

@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 • 1 year ago

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

14th October, 2015

Mythos33 started a new conversation En-/Decrypting Attributes Using Accessors & Mutators • 2 years ago

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

14th September, 2015

Mythos33 left a reply on Mass Assignment And Controller Methods • 2 years ago

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

Mythos33 started a new conversation Mass Assignment And Controller Methods • 2 years ago

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

10th June, 2015

Mythos33 left a reply on Laravel5 CRUD Generator • 2 years ago

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

18th May, 2015

Mythos33 left a reply on RepositoryInterface Is Not Instantiable • 2 years ago

Thanks, I've completely missed that subfolder.

Mythos33 started a new conversation RepositoryInterface Is Not Instantiable • 2 years ago

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

20th April, 2015

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

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

16th April, 2015

Mythos33 left a reply on Generics Equivalent In PHP • 2 years ago

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

Mythos33 left a reply on Generics Equivalent In PHP • 2 years ago

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 • 2 years ago

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

26th February, 2015

Mythos33 left a reply on Laravel 5 Generators Extended • 2 years ago

@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 • 2 years ago

@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 • 2 years ago

@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 • 2 years ago

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 • 2 years ago

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 • 2 years ago

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 • 2 years ago

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

24th February, 2015

Mythos33 left a reply on Always Pass Certain Variables To A View • 2 years ago

Thanks that's what I was looking for!

Mythos33 started a new conversation Always Pass Certain Variables To A View • 2 years ago

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

23rd February, 2015

Mythos33 left a reply on How To Update The Application? • 2 years ago

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? • 2 years ago

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? • 2 years ago

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? • 2 years ago

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

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.