Submit role button to the pivot table












0















I've got 2 models, User, Role and a pivot table. In the pivot table are visible all appointed roles to the users(user_id | role_id) Currently in controller it's made that every line has it's own submit button for submitting roles to the database. I made only one button but it does not work, it throws exception "No query results for model [AppUser]". Also I'm using ajax, but all that you will see in the code below.



I made it separate because generateUserTable also connects to the destroy and action method. Button is in generateUserTable -



<td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
<div class="potvrdi">Potvrdi</div>
</button></td>


Controller -



public function postUserRole(Request $request)
{
if ($request->ajax()) {
$loged_in_user = User::findOrFail(Auth::user()->id);
$user = User::findOrFail($request->get('id'));
$r1 = Role::find(1);
$r2 = Role::find(2);
if ($loged_in_user->IsAdmin()) {
if ($request->get('admin_role')==1) {
$user->roles()->attach($r1);
} else {
$user->roles()->detach($r1);
}
if ($request->get('korisnik_role')==1) {
$user->roles()->attach($r2);
} else {
$user->roles()->detach($r2);
}
}
$data = User::all();
return json_encode($this->generateUserTable($data));
}
}

public function generateUserTable($data)
{
// return User::find(5)->roles;
$total_row = $data->count();
$output = "";
if ($total_row > 0) {
foreach ($data as $row) {
$roleNames = '';
$userRoles = $row->roles()->pluck('id')->toArray();
foreach (Role::all() as $roles1) {
$checked = '';
// var_dump($userRoles);
// var_dump($roles1->id);
// var_dump($roles1);
if (in_array($roles1->id, $userRoles, true)) {
$checked = 'checked="checked"';
}
$roleNames .= $roles1->role != null ? $roles1->role.' '.'<input type="checkbox" '.$checked.' name="role" value="'.$roles1->id.'" class="checkbox'.$roles1->id.'" id="'.$roles1->id.'">'.' ' : '';
}
$output .= '
<tr>
<td>'.$row->surname.'</td>
<td>'.$row->name.'</td>
<td>'.$row->phone.'</td>
<td>'.$roleNames.'</td>
<td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
<div class="potvrdi">Potvrdi</div>
</button></td>
<td><button type="button" id="rowId" class="remove-button btn btn-danger" data-id="'.$row->id.'">
<div class="close">x</div>
</button></td>
</tr>
';
}
} else {
$output = '
<tr>
<td align="center" colspan="5">Nema podataka</td>
</tr>
';
}
return array(
'table_data' => $output,
'total_data' => $total_row,
);
}


}



View - here is where I wish to "transfer" the submit button. I've put it after the table. Script is in view and ajax for submitting user roles to the database is the second one.



<div class="container">
<div class="panel panel-default">
<div class="panel-heading">Pretraži korisnike</div>
<div class="panel-body">
<div class="form-group">
<input type="text" name="search" id="search" class="form-control" placeholder="Pretraži korisnike" />
</div>
<div class="table-responsive">
<h3 align="center">Broj korisnika: <span id="total_records"></span></h3>
<table id="users" class="table table-striped table-bordered">
<thead>
<tr>
<th>Prezime</th>
<th>Ime</th>
<th>Telefon</th>
<th>Rola</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>

</tbody>
</table>
</div>
<button type="button" id="potvrdi" class="potvrdi-button btn btn-primary">
<div class="potvrdi">Potvrdi</div>
</button>
</div>
</div>
</div>


<script>
$(document).ready(function(){
fetch_user_data();
function fetch_user_data(query = ''){
$.ajax({
url:"{{ route('live_search.action') }}",
method:'GET',
data:{query:query},
dataType:'json',
success:function(data)
{
$('tbody').html(data.table_data);
$('#total_records').text(data.total_data);
}
})
}

$(document).on('click', '.potvrdi-button', function(){
var id = $(this).data('id');
var admin_role = $(this).parent().parent().find('td:nth-child(4) .checkbox1:checkbox:checked').length;
console.log(admin_role);
var korisnik_role = $(this).parent().parent().find('td:nth-child(4) .checkbox2:checkbox:checked').length;
console.log(korisnik_role);
$.ajax({
url: "{{ route('live_search.postUserRole') }}",
method: "post",
data: {
id:id,
admin_role: admin_role,
korisnik_role: korisnik_role,
_token:'{{ csrf_token() }}'
},
dataType: 'json',
success: function(data) {
$('.checkbox1').prop('checked', false);
$('.checkbox2').prop('checked', false);
$('tbody').html(data.table_data);
$('#total_records').text(data.total_data);
}
})
})


EDIT Routes



Route::group(['middleware' => ['web', 'auth']], function () {
Route::get('/admin', 'PagesController@admin');
Route::post('/adminForma', 'PagesController@adminForma')->name('adminForma');
Route::get('/users', 'PagesController@users');
Route::get('/settings', 'PagesController@settings');
Route::post('/settings', 'PagesController@settings');
Route::get('/generateUserTable', 'PagesController@generateUserTable');
Route::post('/generateUserTable', 'PagesController@generateUserTable');
Route::get('/live_search/action', 'PagesController@action')->name('live_search.action');
Route::post('/live_search/action', 'PagesController@action');
Route::get('/live_search/postUserRole', 'PagesController@postUserRole')->name('live_search.postUserRole');
Route::post('/live_search/postUserRole', 'PagesController@postUserRole');
Route::get('/live_search/destroy', 'PagesController@destroy')->name('live_search.destroy');
Route::post('/live_search/generateUserTable', 'PagesController@generateUserTable');
Route::get('/live_search/generateUserTable', 'PagesController@generateUserTable')->name('live_search.generateUserTable');
});


I'm still a beginner so I apologize for spaghetti code, I'm trying my best.



Thank you










share|improve this question





























    0















    I've got 2 models, User, Role and a pivot table. In the pivot table are visible all appointed roles to the users(user_id | role_id) Currently in controller it's made that every line has it's own submit button for submitting roles to the database. I made only one button but it does not work, it throws exception "No query results for model [AppUser]". Also I'm using ajax, but all that you will see in the code below.



    I made it separate because generateUserTable also connects to the destroy and action method. Button is in generateUserTable -



    <td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
    <div class="potvrdi">Potvrdi</div>
    </button></td>


    Controller -



    public function postUserRole(Request $request)
    {
    if ($request->ajax()) {
    $loged_in_user = User::findOrFail(Auth::user()->id);
    $user = User::findOrFail($request->get('id'));
    $r1 = Role::find(1);
    $r2 = Role::find(2);
    if ($loged_in_user->IsAdmin()) {
    if ($request->get('admin_role')==1) {
    $user->roles()->attach($r1);
    } else {
    $user->roles()->detach($r1);
    }
    if ($request->get('korisnik_role')==1) {
    $user->roles()->attach($r2);
    } else {
    $user->roles()->detach($r2);
    }
    }
    $data = User::all();
    return json_encode($this->generateUserTable($data));
    }
    }

    public function generateUserTable($data)
    {
    // return User::find(5)->roles;
    $total_row = $data->count();
    $output = "";
    if ($total_row > 0) {
    foreach ($data as $row) {
    $roleNames = '';
    $userRoles = $row->roles()->pluck('id')->toArray();
    foreach (Role::all() as $roles1) {
    $checked = '';
    // var_dump($userRoles);
    // var_dump($roles1->id);
    // var_dump($roles1);
    if (in_array($roles1->id, $userRoles, true)) {
    $checked = 'checked="checked"';
    }
    $roleNames .= $roles1->role != null ? $roles1->role.' '.'<input type="checkbox" '.$checked.' name="role" value="'.$roles1->id.'" class="checkbox'.$roles1->id.'" id="'.$roles1->id.'">'.' ' : '';
    }
    $output .= '
    <tr>
    <td>'.$row->surname.'</td>
    <td>'.$row->name.'</td>
    <td>'.$row->phone.'</td>
    <td>'.$roleNames.'</td>
    <td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
    <div class="potvrdi">Potvrdi</div>
    </button></td>
    <td><button type="button" id="rowId" class="remove-button btn btn-danger" data-id="'.$row->id.'">
    <div class="close">x</div>
    </button></td>
    </tr>
    ';
    }
    } else {
    $output = '
    <tr>
    <td align="center" colspan="5">Nema podataka</td>
    </tr>
    ';
    }
    return array(
    'table_data' => $output,
    'total_data' => $total_row,
    );
    }


    }



    View - here is where I wish to "transfer" the submit button. I've put it after the table. Script is in view and ajax for submitting user roles to the database is the second one.



    <div class="container">
    <div class="panel panel-default">
    <div class="panel-heading">Pretraži korisnike</div>
    <div class="panel-body">
    <div class="form-group">
    <input type="text" name="search" id="search" class="form-control" placeholder="Pretraži korisnike" />
    </div>
    <div class="table-responsive">
    <h3 align="center">Broj korisnika: <span id="total_records"></span></h3>
    <table id="users" class="table table-striped table-bordered">
    <thead>
    <tr>
    <th>Prezime</th>
    <th>Ime</th>
    <th>Telefon</th>
    <th>Rola</th>
    <th></th>
    <th></th>
    </tr>
    </thead>
    <tbody>

    </tbody>
    </table>
    </div>
    <button type="button" id="potvrdi" class="potvrdi-button btn btn-primary">
    <div class="potvrdi">Potvrdi</div>
    </button>
    </div>
    </div>
    </div>


    <script>
    $(document).ready(function(){
    fetch_user_data();
    function fetch_user_data(query = ''){
    $.ajax({
    url:"{{ route('live_search.action') }}",
    method:'GET',
    data:{query:query},
    dataType:'json',
    success:function(data)
    {
    $('tbody').html(data.table_data);
    $('#total_records').text(data.total_data);
    }
    })
    }

    $(document).on('click', '.potvrdi-button', function(){
    var id = $(this).data('id');
    var admin_role = $(this).parent().parent().find('td:nth-child(4) .checkbox1:checkbox:checked').length;
    console.log(admin_role);
    var korisnik_role = $(this).parent().parent().find('td:nth-child(4) .checkbox2:checkbox:checked').length;
    console.log(korisnik_role);
    $.ajax({
    url: "{{ route('live_search.postUserRole') }}",
    method: "post",
    data: {
    id:id,
    admin_role: admin_role,
    korisnik_role: korisnik_role,
    _token:'{{ csrf_token() }}'
    },
    dataType: 'json',
    success: function(data) {
    $('.checkbox1').prop('checked', false);
    $('.checkbox2').prop('checked', false);
    $('tbody').html(data.table_data);
    $('#total_records').text(data.total_data);
    }
    })
    })


    EDIT Routes



    Route::group(['middleware' => ['web', 'auth']], function () {
    Route::get('/admin', 'PagesController@admin');
    Route::post('/adminForma', 'PagesController@adminForma')->name('adminForma');
    Route::get('/users', 'PagesController@users');
    Route::get('/settings', 'PagesController@settings');
    Route::post('/settings', 'PagesController@settings');
    Route::get('/generateUserTable', 'PagesController@generateUserTable');
    Route::post('/generateUserTable', 'PagesController@generateUserTable');
    Route::get('/live_search/action', 'PagesController@action')->name('live_search.action');
    Route::post('/live_search/action', 'PagesController@action');
    Route::get('/live_search/postUserRole', 'PagesController@postUserRole')->name('live_search.postUserRole');
    Route::post('/live_search/postUserRole', 'PagesController@postUserRole');
    Route::get('/live_search/destroy', 'PagesController@destroy')->name('live_search.destroy');
    Route::post('/live_search/generateUserTable', 'PagesController@generateUserTable');
    Route::get('/live_search/generateUserTable', 'PagesController@generateUserTable')->name('live_search.generateUserTable');
    });


    I'm still a beginner so I apologize for spaghetti code, I'm trying my best.



    Thank you










    share|improve this question



























      0












      0








      0








      I've got 2 models, User, Role and a pivot table. In the pivot table are visible all appointed roles to the users(user_id | role_id) Currently in controller it's made that every line has it's own submit button for submitting roles to the database. I made only one button but it does not work, it throws exception "No query results for model [AppUser]". Also I'm using ajax, but all that you will see in the code below.



      I made it separate because generateUserTable also connects to the destroy and action method. Button is in generateUserTable -



      <td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
      <div class="potvrdi">Potvrdi</div>
      </button></td>


      Controller -



      public function postUserRole(Request $request)
      {
      if ($request->ajax()) {
      $loged_in_user = User::findOrFail(Auth::user()->id);
      $user = User::findOrFail($request->get('id'));
      $r1 = Role::find(1);
      $r2 = Role::find(2);
      if ($loged_in_user->IsAdmin()) {
      if ($request->get('admin_role')==1) {
      $user->roles()->attach($r1);
      } else {
      $user->roles()->detach($r1);
      }
      if ($request->get('korisnik_role')==1) {
      $user->roles()->attach($r2);
      } else {
      $user->roles()->detach($r2);
      }
      }
      $data = User::all();
      return json_encode($this->generateUserTable($data));
      }
      }

      public function generateUserTable($data)
      {
      // return User::find(5)->roles;
      $total_row = $data->count();
      $output = "";
      if ($total_row > 0) {
      foreach ($data as $row) {
      $roleNames = '';
      $userRoles = $row->roles()->pluck('id')->toArray();
      foreach (Role::all() as $roles1) {
      $checked = '';
      // var_dump($userRoles);
      // var_dump($roles1->id);
      // var_dump($roles1);
      if (in_array($roles1->id, $userRoles, true)) {
      $checked = 'checked="checked"';
      }
      $roleNames .= $roles1->role != null ? $roles1->role.' '.'<input type="checkbox" '.$checked.' name="role" value="'.$roles1->id.'" class="checkbox'.$roles1->id.'" id="'.$roles1->id.'">'.' ' : '';
      }
      $output .= '
      <tr>
      <td>'.$row->surname.'</td>
      <td>'.$row->name.'</td>
      <td>'.$row->phone.'</td>
      <td>'.$roleNames.'</td>
      <td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
      <div class="potvrdi">Potvrdi</div>
      </button></td>
      <td><button type="button" id="rowId" class="remove-button btn btn-danger" data-id="'.$row->id.'">
      <div class="close">x</div>
      </button></td>
      </tr>
      ';
      }
      } else {
      $output = '
      <tr>
      <td align="center" colspan="5">Nema podataka</td>
      </tr>
      ';
      }
      return array(
      'table_data' => $output,
      'total_data' => $total_row,
      );
      }


      }



      View - here is where I wish to "transfer" the submit button. I've put it after the table. Script is in view and ajax for submitting user roles to the database is the second one.



      <div class="container">
      <div class="panel panel-default">
      <div class="panel-heading">Pretraži korisnike</div>
      <div class="panel-body">
      <div class="form-group">
      <input type="text" name="search" id="search" class="form-control" placeholder="Pretraži korisnike" />
      </div>
      <div class="table-responsive">
      <h3 align="center">Broj korisnika: <span id="total_records"></span></h3>
      <table id="users" class="table table-striped table-bordered">
      <thead>
      <tr>
      <th>Prezime</th>
      <th>Ime</th>
      <th>Telefon</th>
      <th>Rola</th>
      <th></th>
      <th></th>
      </tr>
      </thead>
      <tbody>

      </tbody>
      </table>
      </div>
      <button type="button" id="potvrdi" class="potvrdi-button btn btn-primary">
      <div class="potvrdi">Potvrdi</div>
      </button>
      </div>
      </div>
      </div>


      <script>
      $(document).ready(function(){
      fetch_user_data();
      function fetch_user_data(query = ''){
      $.ajax({
      url:"{{ route('live_search.action') }}",
      method:'GET',
      data:{query:query},
      dataType:'json',
      success:function(data)
      {
      $('tbody').html(data.table_data);
      $('#total_records').text(data.total_data);
      }
      })
      }

      $(document).on('click', '.potvrdi-button', function(){
      var id = $(this).data('id');
      var admin_role = $(this).parent().parent().find('td:nth-child(4) .checkbox1:checkbox:checked').length;
      console.log(admin_role);
      var korisnik_role = $(this).parent().parent().find('td:nth-child(4) .checkbox2:checkbox:checked').length;
      console.log(korisnik_role);
      $.ajax({
      url: "{{ route('live_search.postUserRole') }}",
      method: "post",
      data: {
      id:id,
      admin_role: admin_role,
      korisnik_role: korisnik_role,
      _token:'{{ csrf_token() }}'
      },
      dataType: 'json',
      success: function(data) {
      $('.checkbox1').prop('checked', false);
      $('.checkbox2').prop('checked', false);
      $('tbody').html(data.table_data);
      $('#total_records').text(data.total_data);
      }
      })
      })


      EDIT Routes



      Route::group(['middleware' => ['web', 'auth']], function () {
      Route::get('/admin', 'PagesController@admin');
      Route::post('/adminForma', 'PagesController@adminForma')->name('adminForma');
      Route::get('/users', 'PagesController@users');
      Route::get('/settings', 'PagesController@settings');
      Route::post('/settings', 'PagesController@settings');
      Route::get('/generateUserTable', 'PagesController@generateUserTable');
      Route::post('/generateUserTable', 'PagesController@generateUserTable');
      Route::get('/live_search/action', 'PagesController@action')->name('live_search.action');
      Route::post('/live_search/action', 'PagesController@action');
      Route::get('/live_search/postUserRole', 'PagesController@postUserRole')->name('live_search.postUserRole');
      Route::post('/live_search/postUserRole', 'PagesController@postUserRole');
      Route::get('/live_search/destroy', 'PagesController@destroy')->name('live_search.destroy');
      Route::post('/live_search/generateUserTable', 'PagesController@generateUserTable');
      Route::get('/live_search/generateUserTable', 'PagesController@generateUserTable')->name('live_search.generateUserTable');
      });


      I'm still a beginner so I apologize for spaghetti code, I'm trying my best.



      Thank you










      share|improve this question
















      I've got 2 models, User, Role and a pivot table. In the pivot table are visible all appointed roles to the users(user_id | role_id) Currently in controller it's made that every line has it's own submit button for submitting roles to the database. I made only one button but it does not work, it throws exception "No query results for model [AppUser]". Also I'm using ajax, but all that you will see in the code below.



      I made it separate because generateUserTable also connects to the destroy and action method. Button is in generateUserTable -



      <td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
      <div class="potvrdi">Potvrdi</div>
      </button></td>


      Controller -



      public function postUserRole(Request $request)
      {
      if ($request->ajax()) {
      $loged_in_user = User::findOrFail(Auth::user()->id);
      $user = User::findOrFail($request->get('id'));
      $r1 = Role::find(1);
      $r2 = Role::find(2);
      if ($loged_in_user->IsAdmin()) {
      if ($request->get('admin_role')==1) {
      $user->roles()->attach($r1);
      } else {
      $user->roles()->detach($r1);
      }
      if ($request->get('korisnik_role')==1) {
      $user->roles()->attach($r2);
      } else {
      $user->roles()->detach($r2);
      }
      }
      $data = User::all();
      return json_encode($this->generateUserTable($data));
      }
      }

      public function generateUserTable($data)
      {
      // return User::find(5)->roles;
      $total_row = $data->count();
      $output = "";
      if ($total_row > 0) {
      foreach ($data as $row) {
      $roleNames = '';
      $userRoles = $row->roles()->pluck('id')->toArray();
      foreach (Role::all() as $roles1) {
      $checked = '';
      // var_dump($userRoles);
      // var_dump($roles1->id);
      // var_dump($roles1);
      if (in_array($roles1->id, $userRoles, true)) {
      $checked = 'checked="checked"';
      }
      $roleNames .= $roles1->role != null ? $roles1->role.' '.'<input type="checkbox" '.$checked.' name="role" value="'.$roles1->id.'" class="checkbox'.$roles1->id.'" id="'.$roles1->id.'">'.' ' : '';
      }
      $output .= '
      <tr>
      <td>'.$row->surname.'</td>
      <td>'.$row->name.'</td>
      <td>'.$row->phone.'</td>
      <td>'.$roleNames.'</td>
      <td><button type="button" id="potvrdi" class="potvrdi-button btn btn-primary" data-id="'.$row->id.'">
      <div class="potvrdi">Potvrdi</div>
      </button></td>
      <td><button type="button" id="rowId" class="remove-button btn btn-danger" data-id="'.$row->id.'">
      <div class="close">x</div>
      </button></td>
      </tr>
      ';
      }
      } else {
      $output = '
      <tr>
      <td align="center" colspan="5">Nema podataka</td>
      </tr>
      ';
      }
      return array(
      'table_data' => $output,
      'total_data' => $total_row,
      );
      }


      }



      View - here is where I wish to "transfer" the submit button. I've put it after the table. Script is in view and ajax for submitting user roles to the database is the second one.



      <div class="container">
      <div class="panel panel-default">
      <div class="panel-heading">Pretraži korisnike</div>
      <div class="panel-body">
      <div class="form-group">
      <input type="text" name="search" id="search" class="form-control" placeholder="Pretraži korisnike" />
      </div>
      <div class="table-responsive">
      <h3 align="center">Broj korisnika: <span id="total_records"></span></h3>
      <table id="users" class="table table-striped table-bordered">
      <thead>
      <tr>
      <th>Prezime</th>
      <th>Ime</th>
      <th>Telefon</th>
      <th>Rola</th>
      <th></th>
      <th></th>
      </tr>
      </thead>
      <tbody>

      </tbody>
      </table>
      </div>
      <button type="button" id="potvrdi" class="potvrdi-button btn btn-primary">
      <div class="potvrdi">Potvrdi</div>
      </button>
      </div>
      </div>
      </div>


      <script>
      $(document).ready(function(){
      fetch_user_data();
      function fetch_user_data(query = ''){
      $.ajax({
      url:"{{ route('live_search.action') }}",
      method:'GET',
      data:{query:query},
      dataType:'json',
      success:function(data)
      {
      $('tbody').html(data.table_data);
      $('#total_records').text(data.total_data);
      }
      })
      }

      $(document).on('click', '.potvrdi-button', function(){
      var id = $(this).data('id');
      var admin_role = $(this).parent().parent().find('td:nth-child(4) .checkbox1:checkbox:checked').length;
      console.log(admin_role);
      var korisnik_role = $(this).parent().parent().find('td:nth-child(4) .checkbox2:checkbox:checked').length;
      console.log(korisnik_role);
      $.ajax({
      url: "{{ route('live_search.postUserRole') }}",
      method: "post",
      data: {
      id:id,
      admin_role: admin_role,
      korisnik_role: korisnik_role,
      _token:'{{ csrf_token() }}'
      },
      dataType: 'json',
      success: function(data) {
      $('.checkbox1').prop('checked', false);
      $('.checkbox2').prop('checked', false);
      $('tbody').html(data.table_data);
      $('#total_records').text(data.total_data);
      }
      })
      })


      EDIT Routes



      Route::group(['middleware' => ['web', 'auth']], function () {
      Route::get('/admin', 'PagesController@admin');
      Route::post('/adminForma', 'PagesController@adminForma')->name('adminForma');
      Route::get('/users', 'PagesController@users');
      Route::get('/settings', 'PagesController@settings');
      Route::post('/settings', 'PagesController@settings');
      Route::get('/generateUserTable', 'PagesController@generateUserTable');
      Route::post('/generateUserTable', 'PagesController@generateUserTable');
      Route::get('/live_search/action', 'PagesController@action')->name('live_search.action');
      Route::post('/live_search/action', 'PagesController@action');
      Route::get('/live_search/postUserRole', 'PagesController@postUserRole')->name('live_search.postUserRole');
      Route::post('/live_search/postUserRole', 'PagesController@postUserRole');
      Route::get('/live_search/destroy', 'PagesController@destroy')->name('live_search.destroy');
      Route::post('/live_search/generateUserTable', 'PagesController@generateUserTable');
      Route::get('/live_search/generateUserTable', 'PagesController@generateUserTable')->name('live_search.generateUserTable');
      });


      I'm still a beginner so I apologize for spaghetti code, I'm trying my best.



      Thank you







      php jquery laravel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 8:47







      laravelnewbie

















      asked Nov 22 '18 at 8:41









      laravelnewbielaravelnewbie

      217




      217
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426888%2fsubmit-role-button-to-the-pivot-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426888%2fsubmit-role-button-to-the-pivot-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          Npm cannot find a required file even through it is in the searched directory