Kazuto

Experience

430

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

31st October, 2017

Kazuto started a new conversation Change Language Of Carbon • 3 weeks ago

I want to use carbon if a date is just a day or less away.

But I can't figure out how to change the localization from english to german.

AppServiceProvider.php

    {
        setlocale(LC_TIME, config('app.locale'));
    }```

config/app.php
```'locale' => 'de',```

But it' stays english no matter what.

25th September, 2017

Kazuto left a reply on Save And Display Two Relations • 1 month ago

Can nobody help me? :(

19th September, 2017

Kazuto left a reply on Vue Not Getting Array Values • 2 months ago

@topvillas I'm using buefy. If that's what you mean.

Kazuto left a reply on Vue Not Getting Array Values • 2 months ago

@topvillas <input type="hidden" name="players" v-model="playerSelected"> isn't working either.

Kazuto started a new conversation Vue Not Getting Array Values • 2 months ago

If I select a checkbox vue does not give any values to the array, even though the items have a value as I checked the DOM Tree.

<div class="column">
                    <div class="card">
                        <div class="card-content">
                            <label for="players" class="label">{{ trans_choice('sites.players', 2) }}</label>
                            <input type="hidden" name="players" :value="playerSelected">

                            <b-checkbox-group v-model="playerSelected">
                                @foreach ( $players as $player )
                                    <div class="field">
                                        <b-checkbox :custom-value="{{ $player->id }}">{{ $player->nickname }}</b-checkbox>
                                    </div>
                                @endforeach
                            </b-checkbox-group>
                        </div>
                    </div>
                </div><!--column-->
            </div><!--columns-->
        </form><!--form-->
    </div><!--container-->

    <script>
        var app = new Vue({
            el: '#app',
            data: {
                playerSelected: {!! $team->players->pluck('id') !!},
                gameSelected: {!! $team->games->pluck('id') !!}
            }
        });
    </script>

18th September, 2017

Kazuto left a reply on Undefinded Index After Renaming/refactoring • 2 months ago

@Snapey Yes, unfortunately. But I've managed to revert my changes. Glad that PhpStorm has a local history so I just reverted everything back to what is was yesterday evening when I stopped my session and did my latest commit.

It works now again. Should have tried the history before posting this but maybe this will help some others at some point.

Kazuto started a new conversation Undefinded Index After Renaming/refactoring • 2 months ago

Hey guys,

I wanted to create two subfolders for my controllers. One called manage and one called public. I've noticed that Controllers\public won't work in the namespace so I've renamed/refactored it to frontend.

Now I can't use Storage::put anymore even though filesystems.php is back to normal.

This is the error I'm getting:

at HandleExceptions->handleError(8, 'Undefined index: frontend', '/Users/hillemacher/Desktop/git/turtle-esports-cms/vendor/league/flysystem/src/Adapter/Local.php', 349, array('path' => 'images/posts/1505757886.jpg', 'visibility' => 'frontend', 'location' => '/Users/hillemacher/Desktop/git/turtle-esports-cms/storage/app/frontend/images/posts/1505757886.jpg', 'type' => 'file'))
in Local.php (line 349)

I've already checked flysystem/src/Adapter/Local.php but there are no occurences of "frontend" whatsoever.

17th September, 2017

Kazuto started a new conversation Save And Display Two Relations • 2 months ago

Hey guys,

I'm close to finish my CMS but I have one minor problem.

I can create several teams, works perfectly fine. I can create several games, works also perfectly fine.

Now I want to create matches between those teams, which means I have two pivot tables. One called game_match and the other called match_team.

game_match consist of game_idand match_id match_teamconsist of match_id, team1_idand team2_id

My match/create.blade.php has two dropdown fields for each team.

Saving a single relation to the database works fine for me as I've done this a couple of times, but I can't figure out how to save two relations.

This is what I got so far:

Inside match/create.blade.php

<div class="field m-t-20 is-inline-block">
    <p class="control">
        <label for="home" class="label"><b>{{ trans_choice('messages.home', 1) }}</b></label>
        <input type="hidden" name="home" id="home" :value="homeSelected">
        <div class="select">
            <select v-model="homeSelected">
                @foreach($teams as $team)
                    <option value="{{ $team->id }}">{{ $team->name }}</option>
                @endforeach
            </select>
        </div>
    </p>
</div>

<div class="field m-t-20 is-inline-block">
    <p class="control">
        <label for="opponent" class="label"><b>{{ trans_choice('messages.opponent', 1) }}</b></label>
        <input type="hidden" name="opponent" id="opponent" :value="opponentSelected">
        <div class="select">
            <select v-model="opponentSelected">
                @foreach($teams as $team)
                    <option value="{{ $team->id }}">{{ $team->name }}</option>
                @endforeach
            </select>
        </div>
    </p>
</div>

@section('scripts')
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                homeSelected: "",
                opponentSelected: "",
                gameSelected: ""
            }
        });
    </script>
@endsection

MatchController.php

public function store(Request $request)
    {
        $this->validate($request, [
            'title' => 'required|max:255',
            'matchday' => 'required',
        ]);

        $match = new Match();

        $match->title = $request->title;
        $match->matchday = $request->matchday;

        if ($match->save()) {
            $match->games()->sync($request->game);
            $match->teams()->sync( [
                ['team1_id' => $request->home, 'team2_id' => $request->opponent],
            ]);

            Session::flash('success', trans('messages.created', ['item' => $match->title]));
            return redirect()->route('matches.show', $match->id);
        } else {
            Session::flash('error', trans('messages.error'));
            return redirect()->route('matches.create')->withInput();
        }
    }

match.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Match extends Model
{
    use SoftDeletes; // <-- Use This Instead Of SoftDeletingTrait

    protected $fillable = [
        'title'
    ];

    protected $dates = ['deleted_at'];

    public function setHomeTeam () {}

    public function teams () {
        return $this->belongsToMany('App\Team', 'match_team', 'match_id', 'team1_id');
    }

    public function games () {
        return $this->belongsToMany('App\Game', 'game_match');
    }

    public function getHomeTeam() {
        return $this->belongsToMany('App\Team', 'match_team', 'match_id', 'team1_id');
    }

    public function getOpponentTeam() {
        return $this->belongsToMany('App\Team', 'match_team', 'match_id', 'team2_id');
    }
}

Can someone help me?

16th September, 2017

Kazuto left a reply on Nginx | Can Only Access Some Routes But Not All • 2 months ago

I should have look in the logs sooner.

I've forgot that I've added soft deletes locally but have not migrated them to the production server.

Now everything works fine.

Thanks @Snapey

Kazuto left a reply on Nginx | Can Only Access Some Routes But Not All • 2 months ago

@Snapey error_log shows no entries. I just get the regular "Whoops. Something went wrong."

access_log shows this:

XX.XX.XX.XX - - [16/Sep/2017:11:03:02 +0200] "GET /manage/members HTTP/1.1" 500 20837 "http://turtles.devel.kazuto.de/manage/dashboard" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36"
XX.XX.XX.XX- - [16/Sep/2017:11:03:02 +0200] "GET /favicon.ico HTTP/1.1" 200 0 "http://turtles.devel.kazuto.de/manage/members" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36"

@Cronix I've changed the order of the routes and put every ::resource to the end. But nothing has changed.

15th September, 2017

Kazuto left a reply on Nginx | Can Only Access Some Routes But Not All • 2 months ago

Server OS: Ubuntu 16.04 | PHP 7.0 | nginx: 1.10.3 Local OS: OSX 10.12.1 | PHP 7.1.4

Laravel: 5.4.32

Routes:

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

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

Auth::routes();

Route::prefix('manage')->middleware('role:superadministrator|administrator|editor|author|contributor')->group(function () {
    Route::get('/', '[email protected]');
    Route::get('/dashboard', '[email protected]')->name('manage.dashboard');

    /* General */
    Route::resource('/posts', 'PostController');
    Route::post('/posts/{post}/restore', '[email protected]')->name('posts.restore');
    Route::delete('/posts/{post}/delete', '[email protected]')->name('posts.delete');

    Route::resource('/downloads', 'DownloadController');
    Route::post('/downloads/{download}/restore', '[email protected]')->name('downloads.restore');
    Route::delete('/downloads/{download}/delete', '[email protected]')->name('downloads.delete');

    Route::resource('/streams', 'StreamController');
    Route::post('/streams/{stream}/restore', '[email protected]')->name('streams.restore');
    Route::delete('/streams/{stream}/delete', '[email protected]')->name('streams.delete');

    Route::resource('/providers', 'ProviderController');
    Route::post('/providers/{provider}/restore', '[email protected]')->name('providers.restore');
    Route::delete('/providers/{provider}/delete', '[email protected]')->name('providers.delete');

    /* eSport */
    Route::resource('/teams', 'TeamController');
    Route::post('/teams/{team}/restore', '[email protected]')->name('teams.restore');
    Route::delete('/teams/{team}/delete', '[email protected]')->name('teams.delete');

    Route::resource('/members', 'MemberController');
    Route::post('/members/{member}/restore', '[email protected]')->name('members.restore');
    Route::delete('/members/{member}/delete', '[email protected]')->name('members.delete');

    Route::resource('/awards', 'AwardController');
    Route::post('/awards/{award}/restore', '[email protected]')->name('awards.restore');
    Route::delete('/awards/{award}/delete', '[email protected]')->name('awards.delete');

    Route::resource('/matches', 'MatchController');
    Route::post('/matches/{match}/restore', '[email protected]')->name('matches.restore');
    Route::delete('/matches/{match}/delete', '[email protected]')->name('matches.delete');

    Route::resource('/games', 'GameController');
    Route::post('/games/{game}/restore', '[email protected]')->name('games.restore');
    Route::delete('/games/{game}/delete', '[email protected]')->name('games.delete');

    Route::resource('/sponsors', 'SponsorController');
    Route::post('/sponsors/{sponsor}/restore', '[email protected]')->name('sponsors.restore');
    Route::delete('/sponsors/{sponsor}/delete', '[email protected]')->name('sponsors.delete');


    Route::resource('/users', 'UserController');
    Route::resource('/permissions', 'PermissionController');
    Route::resource('/roles', 'RoleController');
    Route::resource('/menus', 'MenuController');
});

Route::get('/home', '[email protected]')->name('home');

14th September, 2017

Kazuto started a new conversation Nginx | Can Only Access Some Routes But Not All • 2 months ago

Hey guys,

I can access routes like "manage/users" or "manage/roles" but not "manage/downloads". Locally everything works just fine, so it has to so something with my server.

        listen 80;
    listen [::]:80;

    # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
    return 301 https://$host$request_uri;

        server_name server_name MYDOMAIN;
}

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        resolver 127.0.0.1;

        root /var/www/path/to/my/project/public;

        index index.php index.html index.htm;

        server_name MYDOMAIN;

        location / {
                try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
                try_files $uri /index.php =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        location ~ /\.ht {
                deny all;
        }

        location ~ /.well-known {
                allow all;
        }
}

18th August, 2017

Kazuto left a reply on How Do Retrieve Data Of A Specified Many-to-many Column? • 3 months ago

I already have relationships and they're working fine. I just don't know how to display the informations of "team1_id" and "team2_id" separately.

Kazuto started a new conversation How Do Retrieve Data Of A Specified Many-to-many Column? • 3 months ago

I'm having an intermediate table with "match_id", "team1_id" and "team2_id" and I want to display the related informations separately.

How do I need to approach this?

8th August, 2017

Kazuto started a new conversation Can't Figure Out Sync(). • 3 months ago

Hey guys,

I'm fairly new to Laravel and Blade, startet a few weeks ago. Currently I'm working on a CMS for a friend/customer.

What I plan on doing: Create Teams > Create Members >Edit Team and attach members.

I've created three tables for this: teams, members and team_member.

The team_member table consists of:

Schema::create('team_member', function (Blueprint $table) {
            $table->unsignedInteger('team_id');
            $table->unsignedInteger('member_id');
            $table->string('team_type');


            $table->foreign('member_id')->references('id')->on('members')
                ->onUpdate('cascade')->onDelete('cascade');

            $table->primary(['team_id', 'member_id', 'team_type']);
        });

and I have a hidden input named "member".

Edit Your Profile
Update

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