Mythos33

Mythos33

Member Since 4 Years Ago

Waldkirchen

Experience Points
88,725
Total
Experience

1,275 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
912
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.

Level 18
88,725 XP
Nov
16
2 years ago
Activity icon

Replied to 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

Dec
28
3 years ago
Activity icon

Replied to [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?

Activity icon

Replied to [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)

Activity icon

Replied to [L5.2] Login Not Working

@AkiyamaSmart

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

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

Activity icon

Replied to [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');
});

FYI: Auth:check() returns a 0, means I'm not logged in.

Activity icon

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

Oct
14
3 years ago
Activity icon

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

Sep
14
4 years ago
Activity icon

Replied to Mass Assignment And Controller Methods

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

Activity icon

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

Jun
10
4 years ago
Activity icon

Replied to 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 e.g. the Controllers, Views, etc.

Regards, Stefan

May
18
4 years ago
Activity icon

Replied to RepositoryInterface Is Not Instantiable

Thanks, I've completely missed that subfolder.

Activity icon

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 injection:

    /**
     * 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");
        }
    }

Edit: this is my CategoryRepositoryInterface:

namespace App\Contracts\Repositories\Models;
use App\Contracts\Repositories\Extensions\LatestInterface;
use App\Contracts\Repositories\RepositoryInterface;

interface CategoryRepositoryInterface extends RepositoryInterface, LatestInterface
{

}

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

Regards, Mythos

Apr
20
4 years ago
Activity icon

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.

Short:

User 1 should be able to create Category "Test" once.

User 2 should also be able to create Category "Test" once.

So how do I create this validation rule?

Regards, Mythos

Apr
16
4 years ago
Activity icon

Replied to Generics Equivalent In PHP

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

Activity icon

Replied to 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
Activity icon

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?

EDIT:

The reason I want to do this is type safety and code completion assistance and I don't want to cast the model parameter all the time. ;-)

Regards, Stefan

Feb
26
4 years ago
Activity icon

Replied to 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.

EDIT: Nevermind, fixed it with composer require "laracasts/generators"

Activity icon

Replied to 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!

Activity icon

Replied to 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.

Activity icon

Replied to 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

Activity icon

Replied to 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.

Activity icon

Replied to 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.

Activity icon

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 {!! !!}-syntax 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.

/edit:

I've also tried to change the syntax under Blade settings (@{{, {{, {{{) in PhpStorm with no success.

Regards,

Mythos

Feb
24
4 years ago
Activity icon

Replied to Always Pass Certain Variables To A View

Thanks that's what I was looking for!

Activity icon

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

Feb
23
4 years ago
Activity icon

Replied to 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?

Activity icon

Replied to 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 and merge them manually. Isn't there a composer update-like way to do that?

Activity icon

Replied to 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

Activity icon

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 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