Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Displayed proper alert message in the master file #51

Closed
musa-33 opened this issue Sep 27, 2019 · 10 comments
Closed

Not Displayed proper alert message in the master file #51

musa-33 opened this issue Sep 27, 2019 · 10 comments

Comments

@musa-33
Copy link

musa-33 commented Sep 27, 2019

  • Package Version: #.#.#
  • Laravel Version: 6.0

Description:

Alert gives proper output outside of the master file.
But when using in the master file then it gives this
[ https://user-images.githubusercontent.com/22576412/65787763-7e6fe480-e17b-11e9-9db9-35a6e4e09db4.png ] output.

Steps To Reproduce:

@musa-33 musa-33 changed the title Not Display proper alert in master file Not Displayed proper alert message in the master file Sep 27, 2019
@erickleinde
Copy link

Same problem here. Does anyone have a solution?

@realrashid
Copy link
Owner

Hello Guys 👋,
I am out of country right now so i can't make any fix but i recommend check your other JavaScript libraries and comment out one by one and you will get which one creating this problem 😉.

@erickleinde
Copy link

hey @realrashid

my problem is, that the js and view is not included in my main view. i have follow the docs but it does not work 🤷‍♂

@realrashid
Copy link
Owner

Hello @erickleinde
So you just need to include the @include('sweetalert::alert') in your main layout and run php artisan vendor:publish --provider="RealRashid\SweetAlert\SweetAlertServiceProvider" this command.
Hope this will solve the issue.

@erickleinde
Copy link

hey @realrashid

I did that twice, but it does not work..

public function store(Request $request)
    {

        $validation = $request->validate([
            'name'  => ['required', 'unique:groups,name'],
            'description'   => ['required'],
            'email'         => ['nullable', 'email']
        ]);

        try {
            $group = new Group();
            $group->name = $request->name;
            $group->description = $request->description;
            $group->email = $request->email;
            $group->save();
            Alert::toast(Lang::get('settings.groups.create.success'), 'success');
            return redirect(route('settings.groups.index'));
        } catch (\Exception $exception) {
            Alert::error(null, Lang::get('settings.groups.create.error'));
            return redirect(route('settings.groups.index'));
        }
    }
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>@yield('title') | {{ config('app.name') }}</title>
    <link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css">
    @yield('css')
</head>
<body>
<!-- SWEET ALERT -->
@include('sweetalert::alert')
<!-- SWEET ALERT -->
<!-- NAVIGATION BAR -->
@include('layout.topnav')
<!-- NAVIGATION BAR -->

<!-- CONTENT -->
<div class="container-fluid h-100">
    <div class="row h-100">
        <!-- SIDEBAR -->
        <div class="col-md-2 sidebar-wrapper">
            @include('layout.sidebar')
        </div>
        <!-- SIDEBAR -->
        <!-- CONTENT -->
        <div class="col-md-10 ml-auto content-wrapper">
            <section class="content">
                @yield('content')
            </section>
        </div>
        <!-- CONTENT -->
    </div>
</div>
<!-- CONTENT -->

<script src="{{ asset('js/app.js') }}"></script>
@yield('script')
</body>
</html>

and this is the output in google devtools
image

@realrashid
Copy link
Owner

Hello @erickleinde ,
I have seen the output it's mean you didn't set the variables on .env file.

SWEET_ALERT_LOCAL=true
SWEET_ALERT_CDN=''

And last but not least please add the @include('sweetalert::alert') .
Like this @include('sweetalert::alert') </body>

@erickleinde
Copy link

hey @realrashid

I changed it, but it's still the same problem

@musa-33
Copy link
Author

musa-33 commented Oct 1, 2019

Hey @realrashid
After comment out

<script src="{{asset("js/backend_js")}}/jquery.min.js"></script>

this JavaScript file it's work fine.
But how can we fix this problem?

@musa-33
Copy link
Author

musa-33 commented Oct 1, 2019

@Hey @realrashid
Thanks.
After update jquery.min.js library it's work good.

@realrashid
Copy link
Owner

Great to hear that man!

@erickleinde is your issue solve or not let me know then i will close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants