BarbaraTackaBa

BarbaraTackaBa

Zagreb

Member Since 1 Month Ago

Experience Points 730
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

18 Nov
2 days ago

BarbaraTackaBa left a reply on Send Mail Through Window Modal Form

@SNAPEY - Hello @snapey

step#1 There is nothing in there

step#2 There is so many line of code. How should find error for this?

step#3 When I use dd($request) everything is there

step#4 oh, ok. What should I use for that? I watch couple of videos but niether of them is modal window, so I don't know what to use instead of this.

@gertjanroke Thank you! I changed it! :)

16 Nov
4 days ago

BarbaraTackaBa started a new conversation Send Mail Through Window Modal Form

Hi! I am trying to send email through modal window form. Link is on index (main) page. Something is wrong. It won't send message, won't show error. What did I miss? Here is my code:

web.php

Route::resource('/','BecomeSponsorsController'); //BecomeSponsor

env

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=525
MAIL_USERNAME=2cf9e4d117fbca
MAIL_PASSWORD=5700abf4c75545
MAIL_ENCRYPTION=null

Form

@if($message = Session::get('success'))
    <p>USpješno ste poslali poruku! {{ $message }}</p>
@endif

     {!! Form::open (['method' => 'POST', 'action' => '[email protected]']) !!}
     {!! csrf_field() !!}
      <div class="form-group">
        <label for="formGroupInput">Kontakt osoba</label>
        <input type="text" name="person" class="form-control" placeholder="Upišite ime i prezime" required>
      </div>
      <div class="form-group">
        <label for="formGroupInput">Naziv firme</label>
        <input type="text" name="company" class="form-control" placeholder="Upišite naziv firme">
      </div>
      <div class="form-group">
        <label for="FormControlInput1">Email</label>
        <input type="email" name="email" class="form-control" placeholder="[email protected]" required>
      </div>
      <div class="form-group">
        <label for="formGroupInput">Telefon</label>
        <input type="text" name="phone" class="form-control" placeholder="+385 91 222333" required>
      </div>
      <div class="form-group">
            <label for="formGroupInput">Adresa i broj</label>
            <input type="text" name="address" class="form-control" placeholder="Upišite adresu i broj" required>
      </div>
      <div class="form-group">
            <label for="formGroupInput">Grad</label>
            <input type="text" name="town" class="form-control" placeholder="Upišite grad iz kojeg dolazite" required>
      </div>
      <div class="form-group">
            <label for="formGroupInput">Država</label>
            <input type="text" name="country" class="form-control" placeholder="Upišite državu iz koje dolazite" required>
      </div>
      <div class="form-group">
        <label for="exampleFormControlTextarea1">Poruka</label>
        <textarea name="sponsor_message" class="form-control" id="#" rows="4" required></textarea>
      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-primary">Pošaljite poruku</button>
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Zatvoriti</button>
      </div>
      {!! Form::close() !!}

BecomeSponsorController

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
use App\Mail\BecomeSponsor;

class BecomeSponsorsController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view ('pages.index');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $this -> validate($request,[
            'name'              => 'required',
            'company'                        ,
            'email'             => 'required | email',
            'phone'             => 'required',
            'address'           => 'required',
            'town'              => 'required',
            'country'           => 'required',
            'sponsor_message'   => 'required',
        ]);

        $data = array(
            'name'              =>$request->name,
            'company'           =>$request->company,
            'email'             =>$request->email,
            'phone'             =>$request->phone,
            'address'           =>$request->address,
            'town'              =>$request->town,
            'country'           =>$request->country,
            'sponsor_message'   =>$request->sponsor_message
        );

        Mail::to('[email protected]')->send(new BecomeSponsor($data));
        return back()->with('success','Hvala Vam što nam želite pomoći!');
    }

Mail

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class BecomeSponsor extends Mailable
{
    use Queueable, SerializesModels;

    public $data;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from('[email protected]')
                    ->subject('Postani sponzor')
                    ->view('become-sponsor-template')
                    ->with('data',$this->data);
    }
}

become-sponsor-template

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. <b>{{ $data['name'] }} </b>Ad consequatur quisquam repellendus tempora. Autem consequatur dicta ea molestias sed sequi.</p>
10 Nov
1 week ago

BarbaraTackaBa left a reply on Problem With Edit And Delete In Modal Window

Hello! I didn't find solution yet. Can someone help me please?

07 Nov
1 week ago

BarbaraTackaBa left a reply on Problem With Edit And Delete In Modal Window

@Snapey It's not correct. I told you wrong. It's all mixed when I try to update it. I have the same problem in console. It's the same person/data all the time. It only shows correctly in edit fields (name, surname, town and country).

BarbaraTackaBa left a reply on Problem With Edit And Delete In Modal Window

@Snapey Yes, it shows in modal console.log correctly. (modal-open -> innerText)

06 Nov
2 weeks ago

BarbaraTackaBa left a reply on Problem With Edit And Delete In Modal Window

$( document ).ready(function() {

    //Calls the modal when button is clicked
    $('#editDirectory').on('show.bs.modal', function(event) {
        //console.log('Modal opened');
        var button  = $(event.relatedTarget)
        var name    = button.data('item-name')
        var surname = button.data('item-surname')
        var email   = button.data('item-email')
        var phone   = button.data('item-phone')
        var town    = button.data('item-town')
        var country = button.data('item-country')
        var gender  = button.data('item-gender')
        var status  = button.data('item-status')
    // If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
    // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
        var modal = $(this)
        modal.find('input[id="name"]').val(name)
        modal.find('input[id="surname"]').val(surname)
        modal.find('email[id="email"]').val(email)
        modal.find('phone[id="phone"]').val(phone)
        modal.find('input[id="town"]').val(town)
        modal.find('input[id="country"]').val(country)
        modal.find('select[id="gender"]').val(gender)
        modal.find('select[id="status"]').val(status)
    });

});

It works everything with input field. But these with email, phone and select fields don't work. It's shows wrong data like before.

02 Nov
2 weeks ago

BarbaraTackaBa started a new conversation Problem With Edit And Delete In Modal Window

Hello!!

I have problem with editing and deleting items in modal window. When I click on edit or delete button it opens always the same item in modal window (last one from table who is in order by alphabet, it's NOT the last one inserted in database!) What I did wrong?

Here is my code EDIT:

DirectoriesController

public function edit($id)
    {
        $directories = Directory::find($id);
        return view('pages.admin.directory', compact('directories','id'));
    }

directory.blade.php

<table class="table table-hover">
                          <thead class="text-center">
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Ime</th>
                              <th scope="col">Prezime</th>
                              <th scope="col">Email</th>
                              <th scope="col">Telefon</th>
                              <th scope="col">Grad</th>
                              <th scope="col">Država</th>
                              <th scope="col">Spol</th>
                              <th scope="col">Status</th>
                              <th scope="col">Izmijeni</th>
                              <th scope="col">Izbriši</th>
                            </tr>
                          </thead>
                          <tbody class="text-center">
                                @foreach($directories as $key => $item)
                                <tr>
                                    <td scope="row">{{ $key+1 }}</td>
                                    <td hidden="hidden">{{ $item->id }}</td>
                                    <td>{{ $item->name }}</td>
                                    <td>{{ $item->surname }}</td>
                                    <td>{{ $item->email }}</td>
                                    <td>{{ $item->phone }}</td>
                                    <td>{{ $item->town }}</td>
                                    <td>{{ $item->country }}</td>
                                    <td>{{ $item->gender }}</td>
                                    <td>{{ $item->status }}</td>
                                    <td>
                                        <a href="#editDirectory/{{ $item->id }}"
                                            data-item-id="{{ $item->id }}"
                                            data-item-name="{{ $item->name }}"
                                            data-item-surname="{{ $item->surname }}"
                                            data-item-email="{{ $item->email }}"
                                            data-item-phone="{{ $item->phone }}"
                                            data-item-town="{{ $item->town }}"
                                            data-item-country="{{ $item->country }}"
                                            data-item-gender="{{ $item->gender }}"
                                            data-item-status="{{ $item->status }}"
                                            data-target="#editDirectory" data-toggle="modal">
                                            <button type="submit">
                                              <img src="/storage/admin/edit.png" class="mx-auto d-block img-crud"/>
                                            </button>
                                         </a>
                                    </td>
                                    <td>
                                        <a href="#deleteDirectory/{{ $item->id }}" data-item-id="{{ $item->id }}" data-target="#deleteDirectory" data-toggle="modal">
                                            <button type="submit">
                                               <img src="/storage/admin/delete.png" class="mx-auto d-block img-crud"/>
                                            </button>
                                        </a>
                                    </td>
                                </tr>
                                @endforeach
                          </tbody>
                        </table>

Form

    <div class="modal fade bd-example-modal-md" id="editDirectory" tabindex="-1" role="dialog" aria-labelledby="editDirectoryModalLabel" aria-hidden="true" data-backdrop="false">
  <div class="modal-dialog modal-md" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="editDirectoryModalLabel">Ažuriranje novog korisnika</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
          {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$item->id]]) !!}
          {!! csrf_field() !!}
                @include('pages.admin.forms-admin.edit.edit-directory')
          {!! Form::hidden('_method','PATCH')!!}
          {!! Form::close() !!}
      </div>
    </div>
  </div>
</div>
<div class="form-group">

{{Form::label('name','Ime')}} {{Form::text('name',$item->name, ['class' => 'form-control','placeholder' => 'Upišite ime'])}}

{{Form::label('surname','Prezime')}} {{Form::text('surname',$item->surname, ['class' => 'form-control','placeholder' => 'Upišite prezime'])}} {{Form::label('email','Email')}} {{Form::email('email',$item->email, ['class' => 'form-control','placeholder' => '[email protected]'])}} {{Form::label('phone','Telefon')}} {{Form::number('phone',$item->phone, ['class' => 'form-control','placeholder' => '38591222333'])}} {{Form::label('town','Grad')}} {{Form::text('town',$item->town, ['class' => 'form-control','placeholder' => 'Upiši grad'])}} {{Form::label('country','Država')}} {{Form::text('country',$item->country, ['class' => 'form-control','placeholder' => 'Upiši državu'])}} {{Form::label('gender','Spol')}} {{Form::select('gender', $genders, $item->gender, ['class' => 'form-control'])}} {{Form::label('status','Status')}} {{Form::select('status', $statuses, $item->status, ['class' => 'form-control'])}} {{--{{Form::submit('Ažuriraj',['class'=> 'btn btn-primary'])}}--}} Zatvoriti

app.js

/**

  • First we will load all of this project's JavaScript dependencies which

  • includes Vue and other libraries. It is a great starting point when

  • building robust, powerful web applications using Vue and Laravel. */

    require('./bootstrap');

    window.Vue = require('vue');

/**

  • Next, we will create a fresh Vue application instance and attach it to

  • the page. Then, you may begin adding components to this application

  • or customize the JavaScript scaffolding to fit your unique needs. */

    Vue.component('example-component', require('./components/ExampleComponent.vue'));

    const app = new Vue({ el: '#app' });

//ADMIN - Directory - Edit $('#editDirectory').on('show.bs.modal', function (event) { console.log('Modal opened'); var button = $(event.relatedTarget) // Button that triggered the modal //var recipient = button.data('item-id') // Extract info from data-* attributes var id = button.data('item-id') var name = button.data('item-name') var surname = button.data('item-surname') var phone = button.data('item-phone') var email = button.data('item-email') var town = button.data('item-town') var country = button.data('item-country') var gender = button.data('item-gender') var status = button.data('item-status') // If necessary, you could initiate an AJAX request here (and then do the updating in a callback). // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. var modal = $(this) modal.find('hidden[id="id"]').val(id) //modal.find('input[id="name"]').val(name) //modal.find('input[id="surname"]').val(surname) //modal.find('phone[id="phone"]').val(phone) //modal.find('email[id="email"]').val(email) //modal.find('input[id="town"]').val(town) //modal.find('input[id="country"]').val(country) //modal.find('select[id="gender"]').val(gender) //modal.find('select[id="status"]').val(status) })

29 Oct
3 weeks ago

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

I didn't find solution for this yet. Can someone help me? Console log in app.js doesn't work. What's wrong?

17 Oct
1 month ago

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

@Snapey

I do almost the same thing with delete and it is the same problem. It shows only one user in every modal window.

BarbaraTackaBa left a reply on Image Instead Of Button

Now it works!!! But I get square around my picture. Probably because of button tag. How can I move that?

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

I tried to check it with console log but it doesn't show anything.

BarbaraTackaBa left a reply on Image Instead Of Button

| | GET|HEAD | / | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | admin | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | admin/directory | directory.index | App\Http\Controllers\[email protected] | web | | | POST | admin/directory | directory.store | App\Http\Controllers\[email protected] | web | | | GET|HEAD | admin/directory/create | directory.create | App\Http\Controllers\[email protected] | web | | | GET|HEAD | admin/directory/{directory} | directory.show | App\Http\Controllers\[email protected] | web | | | PUT|PATCH | admin/directory/{directory} | directory.update | App\Http\Controllers\[email protected] | web | | | DELETE | admin/directory/{directory} | directory.destroy | App\Http\Controllers\[email protected] | web | | | GET|HEAD | admin/directory/{directory}/edit | directory.edit | App\Http\Controllers\[email protected] | web | | | GET|HEAD | api/user

BarbaraTackaBa left a reply on Image Instead Of Button

@munazzil

Route::resource('/admin/directory','DirectoriesController');

BarbaraTackaBa left a reply on Image Instead Of Button

@munazzil

Here is my full code or view:

<tbody class="text-center">
                                @foreach($directories as $key => $item)
                                <tr>
                                    <td scope="row">{{ $key+1 }}</td>
                                    <td>{{ $item->name }}</td>
                                    <td>{{ $item->surname }}</td>
                                    <td>{{ $item->email }}</td>
                                    <td>{{ $item->phone }}</td>
                                    <td>{{ $item->town }}</td>
                                    <td>{{ $item->country }}</td>
                                    <td>{{ $item->gender }}</td>
                                    <td>{{ $item->status }}</td>
                                    <td><a href="#editDirectory/{{ $item->id }}"
                                        data-item-id="{{ $item->id }}"
                                        data-name="{{ $item->name }}"
                                        data-surname="{{ $item->surname }}"
                                        data-email="{{ $item->email }}"
                                        data-phone="{{ $item->phone }}"
                                        data-town="{{ $item->town }}"
                                        data-country="{{ $item->country }}"
                                        data-gender="{{ $item->gender }}"
                                        data-status="{{ $item->status }}"
                                        data-target="#editDirectory" data-toggle="modal">
                                         <img src="{{ asset('storage/admin/edit.png') }}" height=23 width=23 class="mx-auto d-block"/>
                                        </a>
                                    </td>
                                    <td>
                                        <a href="#deleteDirectory/{{ $item->id }}">
                                                {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$item->id]]) !!}
                                                {!! Form::hidden('_method','DELETE')!!}
                                                <img src="{{ asset('storage/admin/delete.png') }}" height=23 width=23 class="mx-auto d-block"/>
                                                {!! Form::close() !!}
                                        </a>
                                    </td>
                                </tr>
                                @endforeach
                          </tbody>

BarbaraTackaBa left a reply on Image Instead Of Button

@munazzil

Did you mean this?

public function destroy($id)
    {
        $directories = Directory::find($id);
        $directories->delete();

        return redirect('/admin/directory')->with('success', 'Uspješno si izbrisao učesnika!');
     }

BarbaraTackaBa left a reply on Image Instead Of Button

                                    <td>
                                        <a href="#deleteDirectory/{{ $item->id }}">
                                                {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$item->id]]) !!}
                                                {!! Form::hidden('_method','DELETE')!!}
                                                <img src="{{ asset('storage/admin/delete.png') }}" height=23 width=23 class="mx-auto d-block"/>
                                                {!! Form::close() !!}
                                        </a>
                                    </td>

It shows button properly (that was ok before I put it in Form::) but it doesn't work. When I click on it, it doesn't delete anything.

BarbaraTackaBa left a reply on Image Instead Of Button

@munazzil I tried so many combinations. No, it still doesn't work.

<td>
          <a href="#deleteDirectory/{{ $item->id }}">
                    <
                          {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$item->id]]) !!}
                          {!! Form::hidden('_method','DELETE')!!}
                          {!! Form::button(img src =  "{{ asset('admin/delete.png') }}", ['class' => 'img-delete mx-auto d-block form-control', 'type' => 'submit']) !!}
                           {!! Form::close() !!}
                       />
          </a>
  </td>

BarbaraTackaBa left a reply on Image Instead Of Button

@munazzil Yes, I also tried what you wrote but it doesn't work. :(

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

@Snapey

There is no console error. And in console shows right data. But in modal window 'Edit' not.

BarbaraTackaBa left a reply on Image Instead Of Button

@Cronix and @Snapey can you please check this? Thank you!

16 Oct
1 month ago

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

@Cronix

Hi! I tried what you said but it doesn't work? Can you check my code?

app.js

$('#editDirectory').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
//var recipient = button.data('item-id') // Extract info from data-* attributes
var id = button.data('id')
var name = button.data('name')
var surname = button.data('surname')
var phone = button.data('phone')
var email = button.data('email')
var town = button.data('town')
var country = button.data('country')
var gender = button.data('gender')
var status = button.data('status')
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
var modal = $(this)
modal.find('hidden[id="id"]').val(id)
modal.find('input[id="name"]').val(name)
modal.find('input[id="surname"]').val(surname)
modal.find('phone[id="phone"]').val(phone)
modal.find('email[id="email"]').val(email)
modal.find('input[id="town"]').val(town)
modal.find('input[id="country"]').val(country)
modal.find('select[id="gender"]').val(gender)
modal.find('select[id="status"]').val(status)

})

BarbaraTackaBa left a reply on Image Instead Of Button

@munazzil

I tried this but unfortunately it doesn't work.

BarbaraTackaBa left a reply on Image Instead Of Button

Can someone help me with this? It doesn't work.

  <td>
                                        <a href="#deleteDirectory/{{ $item->id }}"><img
                                            {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$item->id]]) !!}
                                            {!! Form::hidden('_method','DELETE')!!}
                                            {{ Form::button'src' =>{{ asset('storage/admin/delete.png') }}'  , ['class' => 'btn img-delete mx-auto d-block form-control', 'type' => 'submit' ]) }}
                                            {!! Form::close() !!}
                                            />
                                        </a>
                                    </td>
15 Oct
1 month ago

BarbaraTackaBa left a reply on Image Instead Of Button

I can't see your code.

BarbaraTackaBa left a reply on Image Instead Of Button

No, it doesn't show correct

BarbaraTackaBa left a reply on Image Instead Of Button

Can you correct your code pls? Last one. So I can see it :o

BarbaraTackaBa left a reply on Image Instead Of Button

{{ Form::button('img src="{{ asset('storage/admin/'.delete.png) }}"', ['class' => 'img-delete mx-auto d-block form-control', 'type' => 'submit']) }}

Like this?

BarbaraTackaBa left a reply on Image Instead Of Button

I can't see again what you wrote. :(

BarbaraTackaBa left a reply on Image Instead Of Button

public/storage/admin/delete.png

BarbaraTackaBa left a reply on Image Instead Of Button

Can you write me that in my first code above? how to do it... because I am trying put your code and I don't succeed.

BarbaraTackaBa left a reply on Image Instead Of Button

I still can't see your code. You have to put 4 spaces before code.

BarbaraTackaBa left a reply on Image Instead Of Button

I don't see what you wrote.

BarbaraTackaBa started a new conversation Image Instead Of Button

Hi! I want put image instead regular Bootstrap button.

{{ Form::button('<img src="../..(../../public/storage/admin/delete.png"/>', ['class' => 'img-delete mx-auto d-block form-control', 'type' => 'submit']) }}

I tried with

but it doesn't work! What I did wrong?

14 Oct
1 month ago

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

How he put values here without Ajax?

https://youtu.be/PAP8IS_ak6w?t=247

Just like that. Like I tried.

13 Oct
1 month ago

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

And just one more question. It doesn't fetch correct values in form. For all users shows data from user with id=1.

Here is my code:

Controller

public function edit($id)
{
    $directories = Directory::find($id);
    return view('pages.admin.directory')->with('directories',$directories);
}

Form

     <div class="form-group has-feedback">
    {{Form::label('name','Ime')}}
    {{Form::text('name',$item->name, ['class' => 'form-control','placeholder' => 'Upišite ime'])}}
  </div>
  <div class="form-group">
    {{Form::label('surname','Prezime')}}
    {{Form::text('surname',$item->surname, ['class' => 'form-control','placeholder' => 'Upišite prezime'])}}
    </div>
  <div class="form-group">
    {{Form::label('email','Email')}}
    {{Form::email('email',$item->email, ['class' => 'form-control','placeholder' => '[email protected]'])}}
  </div>
  <div class="form-group">
    {{Form::label('phone','Telefon')}}
    {{Form::number('phone',$item->phone, ['class' => 'form-control','placeholder' => '38591222333'])}}
  </div>
  <div class="form-group">
    {{Form::label('town','Grad')}}
    {{Form::text('town',$item->town, ['class' => 'form-control','placeholder' => 'Upiši grad'])}}
  </div>
  <div class="form-group">
    {{Form::label('country','Država')}}
    {{Form::text('country',$item->country, ['class' => 'form-control','placeholder' => 'Upiši državu'])}}
  </div>
  <div class="form-group">
      {{Form::label('gender','Spol')}}
      {{Form::select('gender', $genders, $item->gender, ['class' => 'form-control'])}}
  </div>
  <div class="form-group">
      {{Form::label('status','Status')}}
      {{Form::select('status', $statuses, $item->status, ['class' => 'form-control'])}}
  </div>
  <div class="modal-footer">
    {{Form::submit('Spasi',['class'=> 'btn btn-primary'])}}
    <button type="button" class="btn btn-secondary" data-dismiss="modal">Zatvoriti</button>
  </div>

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

I told you. I saw it in that video and it worked there. :o

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

Ok, I'll try to find error... yes it works on ADD modal... it works great! A because of that I am confused. Why it won't work here in EDIT modal.

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

I saw it ($directories->id) here:

https://www.youtube.com/watch?v=PAP8IS_ak6w&list=PLillGF-RfqbYhQsN5WMXy6VsDMKGadrJ-&index=8

Do I have to change it then? In what?

Thank you guys for your time...

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

Error is: Trying to get property 'id' of non-object

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

it's not solved yet. I have an error. I put wrong button.

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

directory.blade.php (I didn't include edit modal before)

@extends('layouts.app-admin')

@section('content')
    <section id="admin">
         <div class="container">
            <div class="row">
                <div class="col-md-12 text-center">
                    <h2 class="text-center">Imenik</h2>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12 d-flex justify-content-end">
                    <a href="#addDirectory" data-toggle="modal"><img src="{{ asset('storage/admin/add.png') }}" height=33 width=33 class="img-responsive mr-auto d-block"/></a>
                </div>
            </div>

             <div class="row">
                 <div class="col-md-12 text-center">
                      <div class="text-justify">
                        <table class="table table-hover">
                          <thead class="text-center">
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Ime</th>
                              <th scope="col">Prezime</th>
                              <th scope="col">Email</th>
                              <th scope="col">Telefon</th>
                              <th scope="col">Grad</th>
                              <th scope="col">Država</th>
                              <th scope="col">Spol</th>
                              <th scope="col">Status</th>
                              <th scope="col">Izmijeni</th>
                              <th scope="col">Izbriši</th>
                            </tr>
                          </thead>
                          <tbody class="text-center">
                                @foreach($directories as $key => $item)
                                <tr>
                                    <td scope="row">{{ $key+1 }}</td>
                                    <td>{{ $item->name }}</td>
                                    <td>{{ $item->surname }}</td>
                                    <td>{{ $item->email }}</td>
                                    <td>{{ $item->phone }}</td>
                                    <td>{{ $item->town }}</td>
                                    <td>{{ $item->country }}</td>
                                    <td>{{ $item->gender }}</td>
                                    <td>{{ $item->status }}</td>
                                    <td><a href="#editDirectory/{{ $item->id }}" data-item-id="{{ $item->id }} data-target="#editDirectory" data-toggle="modal"><img src="{{ asset('storage/admin/edit.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>
                                    <td><a href="#deleteDirectory{{ $item->id}}" data-toggle="modal" class="text-center"><img src="{{ asset('storage/admin/delete.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>
                                </tr>
                                @endforeach
                          </tbody>
                        </table>
                      </div>
                 </div>
             </div>
         </div>
</section>

    @include('pages.admin.modals-admin.create.add-directory')
    @include('pages.admin.modals-admin.edit.edit-directory')
@endsection

pages\admin\modals-admin\edit\edit-directory.blade.php

                <div class="modal fade bd-example-modal-md" id="editDirectory" tabindex="-1" role="dialog" aria-labelledby="editDirectoryModalLabel" aria-hidden="true" data-backdrop="false">
                  <div class="modal-dialog modal-md" role="document">
                    <div class="modal-content">

                    {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$directories->id]]) !!}
                    {!! csrf_field() !!}

                      <div class="modal-header">
                        <h5 class="modal-title" id="editDirectoryModalLabel">Ažuriranje novog učesnika turnira Murga Open</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                          <span aria-hidden="true">&times;</span>
                        </button>
                      </div>
                      <div class="modal-body">
                        @include('pages.admin.forms-admin.edit.edit-directory')
                      </div>
                    {!! Form::hidden('_method','PUT')!!}
                    {!! Form::close() !!}
                    </div>
                  </div>
                </div>

pages\admin\forms-admin\edit\edit-directory.blade.php

    <div class="form-group has-feedback">
    {{Form::label('name','Ime')}}
    {{Form::text('name',$directory->name, ['class' => 'form-control','placeholder' => 'Upišite ime'])}}
  </div>
  <div class="form-group">
    {{Form::label('surname','Prezime')}}
    {{Form::text('surname',$directory->surname, ['class' => 'form-control','placeholder' => 'Upišite prezime'])}}
  </div>
  <div class="form-group">
    {{Form::label('email','Email')}}
    {{Form::email('email',$directory->email, ['class' => 'form-control','placeholder' => '[email protected]'])}}
  </div>
  <div class="form-group">
    {{Form::label('phone','Telefon')}}
    {{Form::number('phone',$directory->phone, ['class' => 'form-control','placeholder' => '38591222333'])}}
  </div>
  <div class="form-group">
    {{Form::label('town','Grad')}}
    {{Form::text('town',$directory->town, ['class' => 'form-control','placeholder' => 'Upiši grad'])}}
   </div>
  <div class="form-group">
    {{Form::label('country','Država')}}
    {{Form::text('country',$directory->country, ['class' => 'form-control','placeholder' => 'Upiši državu'])}}
  </div>
  <div class="form-group">
      {{Form::label('gender','Spol')}}
      {{Form::select('gender', $genders,$directory->gender, ['class' => 'form-control'])}}
 </div>
 <div class="form-group">
      {{Form::label('status','Status')}}
      {{Form::select('status', $statuses,$directory->status, ['class' => 'form-control'])}}
  </div>
  <div class="modal-footer">
    {{Form::submit('Spasi',['class'=> 'btn btn-primary'])}}
    <button type="button" class="btn btn-secondary" data-dismiss="modal">Zatvoriti</button>
  </div>

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

directory.blade.php

@extends('layouts.app-admin')

@section('content')

Imenik

             <div class="row">
                 <div class="col-md-12 text-center">
                      <div class="text-justify">
                        <table class="table table-hover">
                          <thead class="text-center">
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Ime</th>
                              <th scope="col">Prezime</th>
                              <th scope="col">Email</th>
                              <th scope="col">Telefon</th>
                              <th scope="col">Grad</th>
                              <th scope="col">Država</th>
                              <th scope="col">Spol</th>
                              <th scope="col">Status</th>
                              <th scope="col">Izmijeni</th>
                              <th scope="col">Izbriši</th>
                            </tr>
                          </thead>
                          <tbody class="text-center">
                                @foreach($directories as $key => $item)
                                <tr>
                                    <td scope="row">{{ $key+1 }}</td>
                                    <td>{{ $item->name }}</td>
                                    <td>{{ $item->surname }}</td>
                                    <td>{{ $item->email }}</td>
                                    <td>{{ $item->phone }}</td>
                                    <td>{{ $item->town }}</td>
                                    <td>{{ $item->country }}</td>
                                    <td>{{ $item->gender }}</td>
                                    <td>{{ $item->status }}</td>
                                    <td><a href="#" data-item-id="{{ $item->id }}" data-target="#editDirectory" data-toggle="modal"><img src="{{ asset('storage/admin/edit.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>
                                    <td><a href="#deleteDirectory{{ $item->id}}" data-toggle="modal" class="text-center"><img src="{{ asset('storage/admin/delete.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>
                                </tr>
                                @endforeach
                          </tbody>
                        </table>
                      </div>
                 </div>
             </div>
         </div>
</section>

@include('pages.admin.modals-admin.create.add-directory')

@endsection

modal

                    {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$directories->id]]) !!}
                    {!! csrf_field() !!}

                      <div class="modal-header">
                        <h5 class="modal-title" id="editDirectoryModalLabel">Ažuriranje novog učesnika turnira Murga Open</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                          <span aria-hidden="true">&times;</span>
                        </button>
                      </div>
                      <div class="modal-body">
                        @include('pages.admin.forms-admin.edit.edit-directory')
                      </div>
                    {!! Form::hidden('_method','PUT')!!}
                    {!! Form::close() !!}
                    </div>
                  </div>
                </div>

form

<div class="form-group has-feedback">
{{Form::label('name','Ime')}}
{{Form::text('name',$directory->name, ['class' => 'form-control','placeholder' => 'Upišite ime'])}}
{{Form::label('surname','Prezime')}} {{Form::text('surname',$directory->surname, ['class' => 'form-control','placeholder' => 'Upišite prezime'])}} {{Form::label('email','Email')}} {{Form::email('email',$directory->email, ['class' => 'form-control','placeholder' => '[email protected]'])}} {{Form::label('phone','Telefon')}} {{Form::number('phone',$directory->phone, ['class' => 'form-control','placeholder' => '38591222333'])}} {{Form::label('town','Grad')}} {{Form::text('town',$directory->town, ['class' => 'form-control','placeholder' => 'Upiši grad'])}} {{Form::label('country','Država')}} {{Form::text('country',$directory->country, ['class' => 'form-control','placeholder' => 'Upiši državu'])}} {{Form::label('gender','Spol')}} {{Form::select('gender', $genders,$directory->gender, ['class' => 'form-control'])}} {{Form::label('status','Status')}} {{Form::select('status', $statuses,$directory->status, ['class' => 'form-control'])}} {{Form::submit('Spasi',['class'=> 'btn btn-primary'])}} Zatvoriti

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

Modal is not loaded in the same view... it is in different file...

BarbaraTackaBa left a reply on Problem With Modal Window (EDIT)

Thank you!! I changed the last one! :)

Version of Bootstrap is "bootstrap": "^4.0.0"

<td><a href="#" data-item-id="{{ $item->id }}" data-target="#editDirectory" data-toggle="modal"><img src="{{ asset('storage/admin/edit.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>

Did I make this right? I don't know if I understand what you write.

What else should I do?

BarbaraTackaBa left a reply on Edit Using Modal Window

Hm.. I don't understand you. I try to make normal edit. I don't want to create x amount of forms. I just want make edit by user id.

BarbaraTackaBa started a new conversation Problem With Modal Window (EDIT)

I have with modal window (on edit). It won't show/open. Here is my code.

directory.blade.php

@foreach($directories as $item) {{ $i }} {{ $item->name }} {{ $item->surname }} {{ $item->email }} {{ $item->phone }} {{ $item->town }} {{ $item->country }} {{ $item->gender }} {{ $item->status }} @endforeach modal
            <div class="modal fade bd-example-modal-md" id="editDirectory" tabindex="-1" role="dialog" aria-labelledby="editDirectoryModalLabel" aria-hidden="true" data-backdrop="false">
              <div class="modal-dialog modal-md" role="document">
                <div class="modal-content">

                {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$directories->id]]) !!}
                {!! csrf_field() !!}

                  <div class="modal-header">
                    <h5 class="modal-title" id="editDirectoryModalLabel">Ažuriranje novog korisnika</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                      <span aria-hidden="true">×</span>
                    </button>
                  </div>
                  <div class="modal-body">
                    @include('pages.admin.forms-admin.edit.edit-directory')
                  </div>
                {!! Form::hidden('_method','PUT')!!}
                {!! Form::close() !!}
                </div>
              </div>
            </div>

BarbaraTackaBa left a reply on Edit Using Modal Window

It doesn't show error in console. That is wierd. When I go with mouse on that button it shows (on left down side of screen) correct id. But when I click on it, it just won't open.

BarbaraTackaBa left a reply on Edit Using Modal Window

I have with modal window (on edit). It won't show/open. Here is my code.

directory.blade.php

@foreach($directories as $item) {{ $i }} {{ $item->name }} {{ $item->surname }} {{ $item->email }} {{ $item->phone }} {{ $item->town }} {{ $item->country }} {{ $item->gender }} {{ $item->status }} @endforeach

modal

                <div class="modal fade bd-example-modal-md" id="editDirectory" tabindex="-1" role="dialog" aria-labelledby="editDirectoryModalLabel" aria-hidden="true" data-backdrop="false">
                  <div class="modal-dialog modal-md" role="document">
                    <div class="modal-content">

                    {!! Form::open (['method' => 'POST', 'action' => ['[email protected]',$directories->id]]) !!}
                    {!! csrf_field() !!}

                      <div class="modal-header">
                        <h5 class="modal-title" id="editDirectoryModalLabel">Ažuriranje novog učesnika turnira Murga Open</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                          <span aria-hidden="true">&times;</span>
                        </button>
                      </div>
                      <div class="modal-body">
                        @include('pages.admin.forms-admin.edit.edit-directory')
                      </div>
                    {!! Form::hidden('_method','PUT')!!}
                    {!! Form::close() !!}
                    </div>
                  </div>
                </div>

BarbaraTackaBa left a reply on Populating Dropdown Menu From MySQL Database

I commented function create(). And put those 'things' in function index(). Because I put wrong route as you said.

It looks like that:

public function index()
{
    $directories = DB::select("SELECT*FROM view_directories");
    $genders = Gender::all()->pluck('gender', 'id');
    $statuses = Status::all()->pluck('status', 'id');
    return view('pages.admin.directory', compact('directories','genders','statuses'));
}

And it works fine for now!! Thank you!!

BarbaraTackaBa left a reply on Populating Dropdown Menu From MySQL Database

Modal is part of larger page. It is button/link here: #addDirectory

directory.blade.php

@extends('layouts.app-admin')

@section('content')

Imenik

             <div class="row">
                 <div class="col-md-12 text-center">
                      <div class="text-justify">
                        <table class="table table-hover">
                          <thead class="text-center">
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Ime</th>
                              <th scope="col">Prezime</th>
                              <th scope="col">Email</th>
                              <th scope="col">Telefon</th>
                              <th scope="col">Grad</th>
                              <th scope="col">Država</th>
                              <th scope="col">Spol</th>
                              <th scope="col">Status</th>
                              <th scope="col">Izmijeni</th>
                              <th scope="col">Izbriši</th>
                            </tr>
                          </thead>
                          <tbody class="text-center">
                                <?php $i=1; ?>
                                @foreach($directories as $item)
                                <tr>
                                    <td scope="row">{{ $i }}</td>
                                    <td>{{ $item->name }}</td>
                                    <td>{{ $item->surname }}</td>
                                    <td>{{ $item->email }}</td>
                                    <td>{{ $item->phone }}</td>
                                    <td>{{ $item->town }}</td>
                                    <td>{{ $item->country }}</td>
                                    <td>{{ $item->gender }}</td>
                                    <td>{{ $item->status }}</td>
                                    <td><a href="/directory/{{$item->id}}/edit" ><img src="{{ asset('storage/admin/edit.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>
                                    <td><a href="#" class="text-center"><img src="{{ asset('storage/admin/delete.png') }}" height=23 width=23 class="mx-auto d-block"/></a></td>
                                 <?php $i++; ?>
                                </tr>
                                @endforeach
                          </tbody>
                        </table>
                      </div>
                 </div>
             </div>
         </div>
</section>

@include('pages.admin.modals-admin.create.add-directory')

@endsection