zoomyboy

zoomyboy

Member Since 4 Years Ago

Experience Points 57,735
Experience Level 12

2,265 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 549
Lessons
Completed
Best Reply Awards 1
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.

29 Sep
8 months ago

zoomyboy left a reply on [Vue Warn]: Cannot Find Element: #app

As far as I can see, you generate a "section class="widget" for every $pageWidget on your page. If that's the case, and you have more than one widget, you would also have more than one section with the ID "app", which is not allowed. So probably Vue would complain cause it doesnt know which '#app' to use.

26 May
1 year ago

zoomyboy started a new conversation Pick User Model For Policy

Hey guys,

I scaffolded my authentication. So I have a User model and each user can login. In this app, the user is like an admin who has full access to every part of the App. But there's also a Client model, which can login as well, but only via an email token, not via Session authentication - that way, the Client can trigger some action in the app by clicking an link in an email, because he gets authenticated via the Token prop.

Because I used a new Auth guard for the clients, It's possible that a user and a client are logged in on the same machine at the same time.

I have a simple Policy for authorization. If I now call the following function to check for authorization:

function show($user, $model) {
    // do whatever is neccessary to check authorization for given user and model
}

how can I grab both the authenticated client as well as the authenticated user and use them both in the policy? It seems like the guard used to resolve the authenticated Eloquent model for the Policy always picks the default guard - so I will always get the authenticated user and not the client..

24 Jan
1 year ago

zoomyboy left a reply on Organise Permissions In Controllers

Well, you always use authorizazion, but the real question is where you put this authorize code. In the controller or in the request?

I think this really depends on how big your Form Request is and wether it's worth it at all to create a form request at all. I mean for the get method you probably have just one or two lines of code (fetch all - or a selection of records and return them) - so most of the time I stick to authorization in the controller, because it's cleaner.

zoomyboy left a reply on Organise Permissions In Controllers

You could use the authorize method in the controller.

public function show($id) {
    $this->authorize('view-controller-2', Model::class);

    /* some code */
}

In this case, you just authorize the user to perform the action 'view-controller-2' in general - meaning you dont "ask" for a specific model. This is why you just pass the FQCN of the model.

If this authorization fails, Laravel will sent a message back with a 403 response.

See (https://laravel.com/docs/5.5/authorization#via-controller-helpers)

Your second option would be to create an authorize() method in your Form Request - but this of course only works if you use a form request at all (so not for the show() method).

zoomyboy started a new conversation Create Laravel Ready To Run Package

Hello together,

Imagine I have a laravel project hosted on Github and a related github page used for docs. I can provide the users with some installation manual - what they should do in which order.

But after all:

  • The user should have shell access to the machine where this project is going to run onto
  • Composer should be installed to install all the dependencies
  • Npm should be installed to compile the assets (because these aren't in the github repo of course)
  • He should enter all the 3rd party dependencies to the .env file, create an application key, set the database connection and probably even pusher set-up, enter SMTP Server credentials, etc.

In general, I expect the user to have a little bit of experience in development (so that he knows how to install composer, e.g.), but normally that's not the case. I guess for the majority of people, who just wants to use it, this turns out to be a nightmare, even with a really good documentation.

Is there a way to create a "standalone" package that you can install like almost every other web application (e.g. joomla, Wordpress, owncloud), which means:

  • Extract the ZIP File to the document root
  • Create a database
  • open the URL in the browser
  • Redirect to "/install" dir and see install screen
  • Enter all the needed (and only(!) the needed) information (which would be the database credentials and a first administrator)
  • Finally, the app is ready.

So, how would a professional developer handle this issue while keeping his his githu repo nice and clean? I would expect e.g. some git hook that grabs the latest "tagged" commit from the repo, install and sets everything up to work nicely and create an archive which you can link in the documentation. Ideally, this should happen automatically via a git hook or any similar 3rd party service.

10 Nov
1 year ago

zoomyboy left a reply on Laravel Dusk: Element Is Not Currently Interactable And May Not Be Manipulated

I had the same problem. You should make sure that your provided selector resolves to exactly one element. If they're more than one, Dusk doesnt know which one to click on, so it gets confused..

22 Oct
1 year ago

zoomyboy left a reply on Laravel Mix - Unexpected Token

I got the same issue as well. In order to make use of lazy loading, I'm not a big fan of require or import .. from .. Any help or suggestions on that?

03 Jul
1 year ago

zoomyboy left a reply on Two Different Mails For Password Reset For The Same User Model

Finally, I fond out that you can get the broker (in fact any broker if you provide a name, e.g. broker('useradmin')) from the Service Container. And you can get the tokenRepository and create your own token:

/** @var Illuminate\Auth\Passwords\DatabaseTokenRepository */
$tokens = app()->make('auth.password')->broker()->getRepository();

$user->sendPasswordAfterCreationNotification($tokens->create($user));

zoomyboy started a new conversation Override Implementation Of A Contract

Hello guys,

I have a User that has the ability to reset its password (that means it just has the Illuminate\Foundation\Auth\User trait). I have overritten the sendPasswordNotification to send a custom formatted E-Mail to the usser with his new Pasword:

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable {
    /**
     * Send the password reset notification.
     *
     * @param  string  $token
     * @return void
     */
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new PasswordResetNotification($token));
    }
}

Now, I want to restore the password as well in another situation (in this case, the password reset was performed by an admin rather than by the user) but with another E-Mail being sent to the user. I'd like to use the same functionality that laravel offers (with the hashing of the token and all that stuff) without having to dig into the app and even modify the database directly. So I did the following:

The actual process of sending the E-Mail starts in the Illuminate\Foundation\Auth\SendsPasswordResetEmails trait that the User class has. In there, you can find the actual endpoint for the Reset route:

    /**
     * Send a reset link to the given user.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

        return $response == Password::RESET_LINK_SENT
                    ? $this->sendResetLinkResponse($response)
                    : $this->sendResetLinkFailedResponse($request, $response);
    }

Since I already know the User's E-Mail and also the specific User Model, all the Validation beforehand is not neccessary. I just have to override this part of the method - or even call :

        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

So it seems appropriate to create another Method in the User model and call that instead of the default one that the Illuminate\Foundation\Auth\SendsPasswordResetEmails trait provides:

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable {
    /**
     * Send the password reset notification.
     *
     * @param  string  $token
     * @return void
     */
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new PasswordResetNotification($token));
    }

    /**
     * Send a reset link to the given user from an admin request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.

        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

        return $response == Password::RESET_LINK_SENT
                    ? $this->sendResetLinkResponse($response)
                    : $this->sendResetLinkFailedResponse($request, $response);
    }
}

However, I cannot oveerride the Notification class directly that is used to send the E-Mail. Instead, that happens in the underlying PasswordBroker Class (that is received by $this->broker()):

Illuminate\Auth\Passwords\PasswordBroker:

    /**
     * Send a password reset link to a user.
     *
     * @param  array  $credentials
     * @return string
     */
    public function sendResetLink(array $credentials)
    {
        // First we will check to see if we found a user at the given credentials and
        // if we did not we will redirect back to this current URI with a piece of
        // "flash" data in the session to indicate to the developers the errors.
        $user = $this->getUser($credentials);

        if (is_null($user)) {
            return static::INVALID_USER;
        }

        // Once we have the reset token, we are ready to send the message out to this
        // user with a link to reset their password. We will then redirect back to
        // the current URI having nothing set in the session to indicate errors.
        $user->sendPasswordResetNotification(
            $this->tokens->create($user)
        );

        return static::RESET_LINK_SENT;
    }

Now in my "special case" I want this to work in a different way:

        $user->sendPasswordResetNotificationFromAdmin(
            $this->tokens->create($user)
        );

And the User model could look like:

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable {
    /**
     * Send the password reset notification.
     *
     * @param  string  $token
     * @return void
     */
    public function sendPasswordResetNotification($token)
    {
        $this->notify(new PasswordResetNotification($token));
    }

    /**
     * Send the password reset notification from admin.
     *
     * @param  string  $token
     * @return void
     */
    public function sendPasswordResetNotificationFromAdmin($token)
    {
        $this->notify(new AdminPasswordResetNotification($token));
    }

    /**
     * Send a reset link to the given user from an admin request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.

        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );

        return $response == Password::RESET_LINK_SENT
                    ? $this->sendResetLinkResponse($response)
                    : $this->sendResetLinkFailedResponse($request, $response);
    }
}

Now I have to tell Laravel: "When it's 'admin-case', dont use the normal PasswordBroker when you call the broker() method from the Illuminate\Foundation\Auth\SendsPasswordResetEmails trait, instead use another one with another sendResetLink Method, but create the tokens and all the other stuff behind the scenes like you didi before."

I already looked at the Docs of ServiceProviders and Facades to override the concrete Implementation of the PasswordBroker before the actual processing, but that didn't work. What would be the proper solution in that case?

27 May
2 years ago

zoomyboy left a reply on Babel Doesnt Compile Js Files In My Npm Package

No, they're all in node_modules.

25 May
2 years ago

zoomyboy started a new conversation Babel Doesnt Compile Js Files In My Npm Package

Hey there,

Unfortunately, my .js-Files in a npm package aren't compiled to vanilla js. I import them with require(). However, code in Vue-files is compiled correctly.Why does that happen?

Here's an example of such a file that doesn't compile correctly:

import merge from 'merge';

export default function() {
    return getValues(this, {});
}

function getValues(instance, values) {
    if (!instance)
        return values;

    if (instance.hasOwnProperty('isField') && instance.isField) {
        return merge.recursive(values, parseValueAndName(instance.$props.name, instance.getValue()));
    }

    instance.$children.forEach(function(child) {
        values = getValues(child, values);
    });

    return values;
}

/**
 * Wenn ein Feld "[]" enthält, dann sollte es als Array übergeben werden. Der Name
 * ist jedoch ein Sting, genauso wie die "[]" darin. Deshalb sorgt diese Funktion dafür,
 * dass der Wert als Arraay übergeben wird.
 */
function parseValueAndName(name, value) {
    var data = {};

    var originalValue = value;

    if (name.indexOf("[") !== -1) {
        var erstername = name.slice(0, name.indexOf('['));
        var inner = name.slice(name.indexOf('[')+1, name.indexOf(']'));
        var after = name.slice(name.indexOf(']')+1);
        console.log(after);
        data[erstername] = parseValueAndName(inner + after, value);
    } else {
        data[name] = value;
    }

    return data;
}

16 Mar
2 years ago

zoomyboy started a new conversation Vim Does Not Update PhpDoc Group

In Vim Version 8.0 I have my own Syntax file for php which I'm going to enhance from time to time so that it exactly fits my needs one day. It's located in ~/.vim/syntax/php.vim and it is in fact loading because all the other rules in there apply perfectly.

Now I want to add a custom tag to my PhpDocs:

syntax match  phpDocTags "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|final\|global\|ignore\|internal\|test\|license\|link\|method\|name\|package\|param\|property\|return\|see\|since\|static\|staticvar\|subpackage\|tutorial\|uses\|var\|version\|contributor\|modified\|filename\|description\|filesource\|throws\)\(\s\+\)\?" containedin=phpComment
hi! def link phpDocTags Identifier

This is an original copy of the System's php syntax file and the group PhpDocTags. Notice that I added the "test" in the regex, because when I'm testing, I want the "@test" show up in bold grey like all the other PhpComment Tags.

BUT - This is not working. I guess the default php syntax file of vim overwrites this setting - so that nothing happens at all. How can I solve this?

zoomyboy left a reply on Testing Dependencies

Found out that Phake is a great tool for that..

27 Feb
2 years ago

zoomyboy left a reply on Using An Admin Theme

Well, you should have an index.php theme file where all the first-level-code (html, head, etc) is. This file is you application file (usually in resources/views/layouts/app.blade.php). Then you can create a content section to exten this (add @yield('content') somewhere inside this app.blade.php file). Then, you should compile your assets with gulp (ore take a precompiled css/js bundle which is most probably included in your theme) and load it.

zoomyboy started a new conversation Testing Dependencies

Hey there,

I am going to test an app that simply echoes a bootstrap button link with Link::to('route')... I know you can do this easily with the route() function, but I'd like to have a fluent API to set e.g. the button color, font-awesome icons, labels, etc..

I have a configuration file with some standard values, so if I doesn't set any size, it defaults to btn-xs. If I doesn't set any color, it defaults to btn-info. I wanna test this now.

So I guess you cannot "fake" the output of a stand-alone-function in the global namespace like the "config" function, because that function doesnt belong to any class. Instead I wrapped this function up in a single method of my package that just fires this function with the parameter value. Then I created a stub of that method.

$mock = $this->createMock(Config::class);
$mock->method('get')->with('link.btnSize')->willReturn('xs');

$this->assertEqual(Link::to('route.example'), '<a href="/route/example" class="btn btn-xs">Test</a>');

This is my current test. But this is not working because the mock is not executed. So I suppose I have to create some kind of relation between my mocking method (the config class) and my tested class (Link::to()).

So I'd like to call the to() method as normal and just ovewrite the config value of this single configuration option so that it affects the output of the to() method. What would be the best workflow for that?

zoomyboy left a reply on Laravel Pusher

Could you post the debugging information from your pusher client API? If there's e.g. an authentication failure, it would show up there.

zoomyboy left a reply on Laravel Pusher

Are you able to fire the event manually from the pusher debug console? You could also make the channel public temporarily and see if this works - if it does it might be an authentication problem..

zoomyboy left a reply on Laravel Pusher

Well, maybe we can get a little more information with the debug mode of the Pusher client. ( the normal pusher client API would do that with Pusher.logToConsole = true). Then post the output here.

zoomyboy left a reply on How To Remove "api" Prefix From URL

Assuming that you are using Laravel 5.4, you can just disable the Prefix (that's the "/api" before every path) if you change the MapApi'Routes in App/Providers/RouteServiceProvider like this:

Route::middleware('api') ->namespace($this->namespace) ->group(base_path('routes/api.php'));

So just remove the prefix('api') stuff

24 Feb
2 years ago

zoomyboy started a new conversation Testing Ass.umes That A Route Exists

Hey there,

I'm developing a package that automatically displays a link to a route. In Order to test the final HTML output of that link, I should test that the route() function was called with the expected parameters. For a method of some class, I would use a Mock object - but what about a standalone function that could be called everywhere?

23 Feb
2 years ago

zoomyboy left a reply on Component Synchronisation Not Working

I finally got that working using Vue.$nextTick

13 Feb
2 years ago

zoomyboy started a new conversation Component Synchronisation Not Working

Hey there, I am currently writing a Todo application that manages todos for different Bills. When I click on the "add new todo" button, the "showAddColumn" method is triggered on the root vue instance. If I type in my title and send that via Ajax, a new row should be added underneath the saved one so that it's possible to add a new todo immediately after the last saved one.

This is currently not working. I'm using a dispatcher for this and then update the data. The data is in fact updated (as Vue Devtools told me), but the component of the new row is not rendered. Where's the issue here?

Consider the following JS Fiddle: https://jsfiddle.net/ggm7b0y0/

Unfortunately, it won't work, because I'm fetching the data from the server in the "real world", but hopefully this illustrates what I'm trying to do...

Thanks for any replies ;)

02 Feb
2 years ago

zoomyboy started a new conversation Get Request From Server Every ... Seconds

Hello folks,

I have a todo management tool - so imagine a table of several todos and you can edit each todo on a separate page. When a user opens a todo for editing, this todo becomes "locked". Now I'd like to add some security check to the overview page that it checks wether a todo is "locked". If so, the current user is not allowed to edit this since both users would edit the samt todo then. If you're familiar with Joomla, you may have noticed that it uses exactly the same feature. However, I have trouble realizing this in Javascript..

My first step was to implement this "hello I'm still here" request for the currently opened edit page. This occurs every 10 seconds - so If the last request occured more than 10 seconds ago, the page was closed by the edited person and the todo isn't locked anymore. So far so good.

Now the overview page should update its locked states automatically. But it's extremely slow: When the editor closes the edit page, the other user is maybe waiting for the todo to edit - so he has to wait for 10 seconds, which is annoying in my view.. Is there a good way to handle this (e.g. how facebook does this with it''s chatting system...)

16 Nov
2 years ago

zoomyboy started a new conversation Vim Font For Comments

Hi guys,

I now use gvim with GTK2+ enabled, and I found out that Jeffrey often uses a special font for any PHP comment in several videos. Is there any "advanced syntax highlighting feature" in vim that allows you to change not any the colors of text, but also its font?

11 Nov
2 years ago

zoomyboy started a new conversation Route Facade

Hey folks,

It's possibly my fault because I understood something wrong, but I was trying to get the current route name in my controller.

The docs (of 5.2) says I can use the Route Facade - So I included the Illuminate\Routing\Route and called a method 'current' on it. However, that doesnt work, because the method current doesnt exist.

On stackoverflow (http://stackoverflow.com/questions/32285647/call-to-undefined-method-illuminate-routing-routeget) it says I should instead use the Illuminate\Support\Facades\Route Facade. That works, but this Class it not mentioned anywhere in the docs... So why does that even work??

25 Aug
2 years ago

zoomyboy started a new conversation Vim Remote Editing With Vinegar

Hi folks, I'm trying to edit a file remotely. In the normal vim docs they say that you should just use scp://[email protected]/ and you can browse to that directory on your remote machine. However, that doesn't work for me when vinegar is enabled - if that's the case I just get an empty list. If it's disabled, it works fine.

Are there any other prople outside struggling wih this issue, or am I on my own? How can I solve that?

27 Jul
2 years ago

zoomyboy left a reply on UpdateOrCreate On Polymorph Relation

Now, I got that working by defining the second parameter as the new values for the Model:

$kb->messages()->updateOrCreate(['prio' => 1], ['message' => $request->rememberMessage]);

Without that Param, the fill() in the method would just update it with the Values it had before - so no update is done.

26 Jul
2 years ago

zoomyboy left a reply on UpdateOrCreate On Polymorph Relation

Oh, It's not a typo, because I use lowercase for model names ;)

I used your workaround right now which works very well - but that blows up my code a lot. The UpdateOrCreate() gets executed somehow, because that saves a model after all. Nevertheless it's not functioning properly I guess ;(

zoomyboy started a new conversation UpdateOrCreate On Polymorph Relation

Hi!

I have a polymorph relation to a mesage table. Since every post can have only one message, Laravel should update the message for a given post if there's any. If not, the message should be created for that given post. Because there are other models that the message may refer to, I set this up as a polymorph relation:

In my controller:

    public function updateMessages(post $kb, Request $request) {
        $kb->messages()->updateOrCreate(['prio' => $request->prio, 'message' => $request->message]);
    }

Post model:

    public function messages() {
        return $this->morphMany('App\message', 'entry');
    }
    
    public function getRememberMessageAttribute() {
        return $this->messages()->where('prio', '=', 1)->first();
    }
    public function getWarningMessageAttribute() {
        return $this->messages()->where('prio', '=', 2)->first();
    }

Message model:

    protected $fillable = [ 'message', 'prio' ];
    
    public function entry() {
        return $this->morphTo();
    }

However, the record is always created, event if I have the same "prio" and the same "message". What's wrong here?

30 Jun
2 years ago

zoomyboy left a reply on Mysql Query For SUM

Well, the results should be SUMmed by date - so there should be some ordering of the results as well... Also I dont know how to select every record before the current...

zoomyboy started a new conversation Mysql Query For SUM

I have something like a cash book table - which means every entry has a certain amount of money that was transfered, a date when the transfer was, an id of course and some other information such as description, blabla...

Now, the SUM of all Values would be the total amount of money I have today - assuming that there was no money at all at the beginning.

Is there any mysql-Qury, Eloquent-Call, or even some plugin to select all SUMs for every record - which means you SUM all Records before the record X for all records X in the table. The Result should look like this:

ID|AMOUNT|SALDO

1|2|2 2|5|7 3|3|10 4|7|17

28 May
3 years ago

zoomyboy left a reply on Define Own Attribute Casting

Well, I know about that, but then I have to define that for every value... The above thing would be a little bit clearer because it overwrites the default value and iss only one line of code...

27 May
3 years ago

zoomyboy started a new conversation Define Own Attribute Casting

Hello guys, I'm using the phospr/fraction package (https://packagist.org/packages/phospr/fraction) get integer values as Fractions. Since every integer value should appear as a fraction in the very end, it would be useful to define my own attribute caster for that. So I can say in the model:

protected $casts = [
    'amount' => 'fraction'
];

Is that possible?

08 May
3 years ago

zoomyboy left a reply on Elixir Ccompilation Fails On New Page

The copy of the Application possibly results in a new bootstrap version which causes poroblems? Have you checked that?

zoomyboy started a new conversation Elixir Ccompilation Fails On New Page

Hello, My Elixir compilation doesn't work anymore. This is my current gulpfile.js:

var elixir = require('laravel-elixir');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */

elixir(
    function (mix) {
        //editor
        mix.less(
            [
                'admin/editor.less'
            ], 'public/css/editor.css'
        );

        //backend css
        mix.less('admin/backend_global.less', 'public/.compiled/admin');
        mix.copy(
            [
                'resources/assets/css/lib/twitter.css',
                'resources/assets/css/lib/sweetalert.css',
                'resources/assets/css/lib/dropzone.css',
                'resources/assets/css/lib/font-awesome.css',
                'node_modules/croppie/croppie.css'
            ], 'public/.compiled/admin'
        );
        mix.styles(
            [
                'twitter.css',
                'sweetalert.css',
                'dropzone.css',
                'font-awesome.css',
                'backend_global.css',
                'croppie.css'
            ], 'public/css/admin.css', 'public/.compiled/admin'
        );

        //backend script
        mix.copy('resources/assets/js/admin/ckeditor_config.js', 'public/js');
        mix.copy('node_modules/croppie/croppie.min.js', 'resources/assets/js/admin');
        mix.scripts(
            [
                'lib/jquery.js',
                'lib/dropzone.js',
                'admin/form.js',
                'lib/dropzone.js',
                'lib/sweetalert.js',
                'bootstrap/dropdown.js',
                'bootstrap/collapse.js',
                'lib/vue.js',
                'admin/ckfinder.js',
                'admin/croppie.min.js'
            ], 'public/js/admin.js'
        );


        //frontend js
        mix.scripts(
            [
                'lib/vue.js',
                'lib/jquery.js',
                'bootstrap/collapse.js',
                'bootstrap/dropdown.js',
                'frontend/fancybox.js',
                'frontend/fancybox.initSingle.js',
                'frontend/scroll.js'
            ]
            , 'public/js/script.js'
        );

        //frontend css
        mix.copy('resources/assets/fonts', 'public/fonts');
        mix.copy('resources/assets/css/lib/fancybox.css', 'public/.compiled/frontend');
        mix.less(
            [
                'template.less'
            ], 'public/.compiled/frontend/template.css'
        );
        mix.styles(
            [
                'fancybox.css',
                'template.css'
            ], 'public/css/styles.css', 'public/.compiled/frontend'
        );
    }
);

When it tries to compile backend_global.less, I get the following error:

{ [Error: Invalid mapping: {"generated":{"line":1289,"column":2},"source":"/var/www/vhosts/HOST/copy.HOST/resources/assets/less/bootstrap/type.less","original":{"line":1,"column":null},"name":null} in file undefined line no. undefined]
  message: 'Invalid mapping: {"generated":{"line":1289,"column":2},"source":"/var/www/vhosts/HOST/copy.HOST/resources/assets/less/bootstrap/type.less","original":{"line":1,"column":null},"name":null} in file undefined line no. undefined',
  stack: 'Error: Invalid mapping: {"generated":{"line":1289,"column":2},"source":"/var/www/vhosts/HOST/copy.HOST/resources/assets/less/bootstrap/type.less","original":{"line":1,"column":null},"name":null}\n    at SourceMapGenerator_validateMapping [as _validateMapping] (/var/www/vhosts/HOST/copy.HOST/node_modules/source-map/lib/source-map-generator.js:277:13)\n    at SourceMapGenerator_addMapping [as addMapping] (/var/www/vhosts/HOST/copy.HOST/node_modules/source-map/lib/source-map-generator.js:101:12)\n    at SourceMapOutput.add (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/source-map-output.js:88:42)\n    at Element.genCSS (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/tree/element.js:42:12)\n    at Selector.genCSS (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/tree/selector.js:104:21)\n    at Ruleset.genCSS (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/tree/ruleset.js:389:21)\n    at Directive.outputRuleset (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/tree/directive.js:124:18)\n    at Media.genCSS (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/tree/media.js:34:10)\n    at Ruleset.genCSS (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/tree/ruleset.js:414:18)\n    at SourceMapOutput.toCSS (/var/www/vhosts/HOST/copy.HOST/node_modules/less/lib/less/source-map-output.js:126:24)',
  lineNumber: undefined,
  fileName: undefined,
  name: 'Error',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-less' }

I supposeI created thios site from scratch - I cloned from a git repo and pulled in all the 3rd party stuff myself using composer & npm. So that error could be related to any missing file from my git repo...

02 Apr
3 years ago

zoomyboy left a reply on ServiceProvider Not Loaded

I did that - same problem aftter those three commands.

zoomyboy started a new conversation ServiceProvider Not Loaded

Hello, I pushed my laravel application to another server, and suddenly my self-created providers doesn't work anymore. The following error is thrown:

Class frontend does not exist

    in Container.php line 738
    at ReflectionClass->__construct('frontend') in Container.php line 738
    at Container->build('frontend', array()) in Container.php line 633
    at Container->make('frontend', array()) in Application.php line 697
    at Application->make('frontend') in Facade.php line 218
    at Facade::__callStatic('make', array('frontend')) in pageController.php line 19
    at App::make('frontend') in pageController.php line 19
    at pageController->__construct(object(frontendrouter))
    at ReflectionClass->newInstanceArgs(array(object(frontendrouter))) in Container.php line 783
    at Container->build('App\Http\Controllers\pageController', array()) in Container.php line 633
    at Container->make('App\Http\Controllers\pageController', array()) in Application.php line 697
    at Application->make('App\Http\Controllers\pageController') in Route.php line 269
    at Route->controllerMiddleware() in Route.php line 242
    at Route->middleware() in Router.php line 737
    at Router->gatherRouteMiddlewares(object(Route)) in Router.php line 716
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699
    at Router->dispatchToRoute(object(Request)) in Router.php line 675
    at Router->dispatch(object(Request)) in Kernel.php line 246
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
    at Pipeline->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
    at Pipeline->then(object(Closure)) in Kernel.php line 132
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
    at Kernel->handle(object(Request)) in index.php line 54

This works perfectly on my local server which is at the same state as my remote webhost, so maybe this is a caching issue. My service provider:

<?php

namespace App\Providers;

use App\Helpers\frontendrouter;
use App\Helpers\globalUrl;
use App\Repositories\frontendMenuRepository;
use Illuminate\Support\ServiceProvider;

class FrontendServiceProvider extends ServiceProvider {
    protected $defer = true;
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot(frontendrouter $router) {
        //menu
        view()->composer('frontend.includes.mainnav', function($view) {
            $view->with('mainmenu', frontendMenuRepository::getFirstMenus());
        });

        view()->composer('frontend.includes.submenucontainer', function($view) use ($router) {
            $view->with('submenu', $router->getFirstMenu()->getChildren());
        });

        //headerimage
        view()->composer('frontend.includes.customCss', function($view) use ($router) {
            $headers = $router->getFirstMenu()->getHeaders();
            $view->with('headers', [
                'x' => $headers->where('size', 'x')->first()->image,
                'l' => $headers->where('size', 'l')->first()->image,
                'm' => $headers->where('size', 'm')->first()->image,
                's' => $headers->where('size', 's')->first()->image,
            ]);
        });

        //info
        view()->composer('layouts.frontend', function($view) use ($router) {
            $info = $router->getFirstMenu()->getInfoParts();
            $view->with('info', $info);
        });
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register() {
        $this->app->bind('frontend', function() {
            return false;
        });
    }
}

17 Mar
3 years ago

zoomyboy left a reply on Artisan Commands Failed

Jepp, that's it! I will create another provider which is not loaded with artisan.

zoomyboy left a reply on Artisan Commands Failed

Since I don't know yet where this error comes from, I'll go deeper ;)

AppServiceProvider:

<?php

namespace App\Providers;

use App\frontendmenu;
use App\Helpers\frontendrouter;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider {
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(frontendrouter $router) {
        view()->composer('lib.adminmenu', function($view) {
            $data = \App\backendMenuKath::with('childData', 'menuData')->get();
            $view->with('data', $data);
        });
        view()->composer('frontend.includes.mainnav', function($view) {
            $menu = \App\frontendmenu::tree(-1);
            $view->with('mainmenu', $menu);
        });

        view()->composer('frontend.includes.submenucontainer', function($view) use ($router) {
            $firstMenu = $router->getFirstMenu();
            $view->with('submenu', $firstMenu->getTree());
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register() {
        //
    }
}

zoomyboy left a reply on Artisan Commands Failed

Maybe it's not the best solution, but I got that working when I added this to my controller

        if (!\App::runningInConsole()) {
            $this->menu = $this->getMenu($this->url);
            $this->param = $this->getParam($this->url);
        }

This will trigger the menu creation only when I'm not using artisan.,

zoomyboy left a reply on Artisan Commands Failed

[2016-03-18 00:10:40] local.ERROR: exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'silvaneu.frontendmenu' doesn't exist' in /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php:333
Stack trace:
#0 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): PDO->prepare('select * from `...')
#1 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php(662): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), 'select * from `...', Array)
#2 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): Illuminate\Database\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#3 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#4 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1461): Illuminate\Database\Connection->select('select * from `...', Array, true)
#5 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1447): Illuminate\Database\Query\Builder->runSelect()
#6 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(569): Illuminate\Database\Query\Builder->get(Array)
#7 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(303): Illuminate\Database\Eloquent\Builder->getModels(Array)
#8 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(273): Illuminate\Database\Eloquent\Builder->get(Array)
#9 /home/pille/www/silva-neu/app/Repositories/frontendMenuRepository.php(45): Illuminate\Database\Eloquent\Builder->first()
#10 /home/pille/www/silva-neu/app/Repositories/frontendMenuRepository.php(24): App\Repositories\frontendMenuRepository::slug('')
#11 /home/pille/www/silva-neu/app/Helpers/frontendrouter.php(23): App\Repositories\frontendMenuRepository::fromSlug('')
#12 /home/pille/www/silva-neu/app/Helpers/frontendrouter.php(17): App\Helpers\frontendrouter->getMenu(Object(App\Helpers\frontendUrl))
#13 [internal function]: App\Helpers\frontendrouter->__construct(Object(App\Helpers\globalUrl))
#14 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(783): ReflectionClass->newInstanceArgs(Array)
#15 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('App\Helpers\fro...', Array)
#16 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(687): Illuminate\Container\Container->make('App\Helpers\fro...', Array)
#17 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(577): Illuminate\Foundation\Application->make('App\Helpers\fro...')
#18 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(537): Illuminate\Container\Container->addDependencyForCallParameter(Object(ReflectionParameter), Array, Array)
#19 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(505): Illuminate\Container\Container->getMethodDependencies(Array, Array)
#20 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(747): Illuminate\Container\Container->call(Array)
#21 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(730): Illuminate\Foundation\Application->bootProvider(Object(App\Providers\AppServiceProvider))
#22 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider), 11)
#23 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(731): array_walk(Array, Object(Closure))
#24 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#25 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#26 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(208): Illuminate\Foundation\Application->bootstrapWith(Array)
#27 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#28 /home/pille/www/silva-neu/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 {main}

Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'silvaneu.frontendmenu' doesn't exist (SQL: select * from `frontendmenu` where `slug` =  limit 1)' in /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
Stack trace:
#0 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): Illuminate\Database\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#1 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#2 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1461): Illuminate\Database\Connection->select('select * from `...', Array, true)
#3 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1447): Illuminate\Database\Query\Builder->runSelect()
#4 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(569): Illuminate\Database\Query\Builder->get(Array)
#5 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(303): Illuminate\Database\Eloquent\Builder->getModels(Array)
#6 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(273): Illuminate\Database\Eloquent\Builder->get(Array)
#7 /home/pille/www/silva-neu/app/Repositories/frontendMenuRepository.php(45): Illuminate\Database\Eloquent\Builder->first()
#8 /home/pille/www/silva-neu/app/Repositories/frontendMenuRepository.php(24): App\Repositories\frontendMenuRepository::slug('')
#9 /home/pille/www/silva-neu/app/Helpers/frontendrouter.php(23): App\Repositories\frontendMenuRepository::fromSlug('')
#10 /home/pille/www/silva-neu/app/Helpers/frontendrouter.php(17): App\Helpers\frontendrouter->getMenu(Object(App\Helpers\frontendUrl))
#11 [internal function]: App\Helpers\frontendrouter->__construct(Object(App\Helpers\globalUrl))
#12 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(783): ReflectionClass->newInstanceArgs(Array)
#13 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(633): Illuminate\Container\Container->build('App\Helpers\fro...', Array)
#14 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(687): Illuminate\Container\Container->make('App\Helpers\fro...', Array)
#15 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(577): Illuminate\Foundation\Application->make('App\Helpers\fro...')
#16 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(537): Illuminate\Container\Container->addDependencyForCallParameter(Object(ReflectionParameter), Array, Array)
#17 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Container/Container.php(505): Illuminate\Container\Container->getMethodDependencies(Array, Array)
#18 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(747): Illuminate\Container\Container->call(Array)
#19 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(730): Illuminate\Foundation\Application->bootProvider(Object(App\Providers\AppServiceProvider))
#20 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider), 11)
#21 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(731): array_walk(Array, Object(Closure))
#22 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#23 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#24 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(208): Illuminate\Foundation\Application->bootstrapWith(Array)
#25 /home/pille/www/silva-neu/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#26 /home/pille/www/silva-neu/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 {main}  

zoomyboy left a reply on Artisan Commands Failed

I'm running it from a command line. I have this in my routes file:

Route::group([ 'middleware' => [ 'web' ] ], function() {
    Route::get('/', [ 'as' => 'page.default', 'uses' => 'pageController@defaultPage' ]);
    Route::get('/{uri}', [ 'as' => 'page', 'uses' => 'pageController@handle' ])->where([ 'uri' => '[0-9a-zA-Z\-\/]+' ]);
});

The PageController:

<?php

namespace App\Http\Controllers;

use App\frontendmenu;
use App\Helpers\frontendrouter;
use App\Http\Interfaces\frontendControllerInterface;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use \App\Http\Controllers\frontend;

class pageController extends Controller {
    private $frouter;

    public function __construct(frontendrouter $frouter) {
        $this->frouter = $frouter;
    }

    public function handle() {
        $controller = $this->frouter->getController();
        $view = $controller->getViewName();
        $headline = $controller->getHeadline() ?: $this->frouter->getMenuName();
        return view($view)->with('headline', $headline)->with('data', $controller->getData());
    }

    /**
     * Load default page
     */
    public function defaultPage() {
        $uri = explode ('/', trim(routeToMenu(frontendmenu::firstDefaultMenu()->first()->id), '/'));
        $controller = $this->frouter->getController();

        $view = $controller->getViewName();
        $headline = $controller->getHeadline() ?: $this->frouter->getName($uri);
        return view($view)->with('headline', $headline)->with('data', $controller->getData());
    }
}

Why does artisan instanciate those classes in order to migrate the database? Can I deal with that differently in my code - like an exception for artisan?

zoomyboy started a new conversation Artisan Commands Failed

Hello folks, I have a problem after deleting all tables manually from mysql. If I now try to migrate my tables, I get the following error:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'DBNAME.frontendmenu' doesn't exist (SQL: select * from `frontendmenu` where `slug`=  limit 1)

This is an error of my application, because artisan tries to create an instance of a controller which requires a table called 'frontendmenu'. This table doesn't exist yet. How can I deal with that?

06 Mar
3 years ago

zoomyboy left a reply on Nested Menu With Mysql

Finally I got that working by applying a regular expression to the URI param:

Route::get('/{uri}', [ 'as' => 'page', 'uses' => 'pageController@handle' ])->where(['uri' => '[0-9a-zA-Z\-\/]+']);

zoomyboy started a new conversation Nested Menu With Mysql

Hello folks,

I am working on a small CMS Project. This cms should have a dynamic menu structure which is easily maintainable through mysql. So imagine you have the following menu structure in your adminpanel setup:

photos --- 2014 ---- ---- Gallery 1 ---- ---- Gallery 2 ---- 2015 ---- ---- Gallery 1 ---- ---- Gallery 2 Editors ---- user1 ---- user2

With Slugs on the menu eintries, you can use the following link to poiont to "gallery2": /photos/2014/gallery2

This structure should be nestable - which means you can have as many "childmenus" as you want. And that is supposed to be handlex by an extra controller since it also deals with site-specific settings in the uri which doesn't belong directly to the menu.

This will end up in a structure which is completely independent from laravels routing system. So I tried to archive this by doing this: Route::get('/{uri}', [ 'as' => 'page', 'uses' => 'pageController@handle' ]);

But that gives me only the first "slug". If there's a second menu, the second '/' isn't passed to the controller and laravel throws a 404 error.

It might even be a good idea to pass the complete $_SERVER['REQUEST_URI'] to the page controller because he needs all this information in order to calculate the served page correctly.

What's the best way to do this?

21 Feb
3 years ago

zoomyboy left a reply on Asynchronous Request With Dropzone.js

Okay - sounds a little tricky but doable. But how would I handle this redirect issue then? I'd probably do that with location.href, but then the url is missing.

20 Feb
3 years ago

zoomyboy started a new conversation Asynchronous Request With Dropzone.js

Hi,

I try to add a Category of a blogpost. A category has a name and an image. I'm going to upload this image using Dropzone.js. Now i'm a little bit confused since the image upload happens asynchronously, so the image is uploaded before(!) all the other posts (like the name and the entire form itself) are sended. If I do this directly via post request, live is much easier, because i'm redirected to the page (using the redirect() in the controller) and live's much easier because everything happens behind the scenes. But this doesn't seem to work with an asynchronous request, since the redirect is an http redirect - furthermore any flashmessages (especially in case of errors) are ignored either, because this depends on sessions.

I end up having a lot of problems to handle this. Is there a "quick solution" or is ist better to do it "the dirty way"?

03 Dec
3 years ago

zoomyboy left a reply on Component With Tr

Can you post an example which shows how you did it?

zoomyboy left a reply on Component With Tr

If I put the template outside and reference it, I get the following error: too much recursion target.parentNode.insertBefore(el, target);

Very strange behaviour after all....

<template id="buchunglisttpl">
    <tr>
        <div class="row">
            <div class="col-sm-6">
                <h4 class="list-group-item-heading pg_heading">. @{{ buch.description }}</h4>
                <p class="list-group-item-text" style="padding-bottom: 10px;">
                    @{{ buch.buchung | moment "DD.MM.YYYY" }}
                </p>
            </div>
            <div class="col-sm-3">
                <span class="label label-warning" v-bind:style="{ 'background-color': buch.kostenstelle_data.color }">@{{ buch.kostenstelle_data.name }}</span><br>
                <span v-bind:style="{'color': betragColor}">@{{ buch.betrag | euro '€' }}</span>
                <p class="list-group-item-text">@{{ buch.addresse }}</p>
                <p class="list-group-item-text">@{{ buch.plz }} @{{ buch.city }}</p>
            </div>
            <div class="col-sm-3">
                <button type="button" class="btn btn-default" v-on:click.prevent="include=!include" v-bind:class="{'active': include==true, 'btn-success': include==true}">
                    <span class="fa fa-check"></span>
                    Markieren
                </button>
            </div>
        </div>
    </tr>
</template>

zoomyboy left a reply on Component With Tr

Yes, I know about that. But where shall I put the 'is=..'?

<tr class="list-group-item"
        v-on:click.prevent="toggleActive"
        :class="{'active': active.id == buch.id}"
        style="cursor: pointer;"
        is="buch"
>

If I do this, it doesn't work either, because this tr is already part of the component template - So there's no need for using the 'is'...