Author : Christian Aldana

how can i save a record in 2 different tables. I have my article model and my article controller in this way. My second table is called History I hope you can help me, thank you very much my article model: protected $fillable =[ ‘idcategoria’,’codigo’,’nombre’,’precio_proveedor’,’precio_venta’,’iva’,’ieps’,’stock’,’stock1′,’descripcion’,’condicion’ ]; public function categoria(){ return $this->belongsTo(‘AppCategoria’); } my article controller, ..

Read more

Displaying Items In Datatables This is how my normal html table looked like. In the table, i display the countries as tabs and under every tab a user clicks, the tables displays teams that belong to the particular country(tab). This works fine. <div class=”nav-tabs-custom” id=”tabs”> <ul id=”myUL” class=”nav nav-tabs”> @foreach($countries as $country) <li ><a href=”#tab_{{ ..

Read more

Displaying data in Laravel DataTable This is how my normal html table looked like. In the table, i display the countries as tabs and under every tab a user clicks, the tables displays teams that belong to the particular country(tab). This works fine. <div class=”nav-tabs-custom” id=”tabs”> <ul id=”myUL” class=”nav nav-tabs”> @foreach($countries as $country) <li ><a ..

Read more

Admin & User Middleware Authentication – Laravel This is my admin middleware authentication public function handle($request, Closure $next) { if(Auth::check()) { if(Auth::user()->hasRole(‘administrator’)) { //return redirect(‘admin/dashboard/home’); } else if (Auth::user()->hasRole(‘operator’)) { return redirect(‘user/dashboard/home’); } return $next($request); } } This is my user middleware authentication public function handle($request, Closure $next) { if(Auth::check()) { if(Auth::user()->hasRole(‘administrator’)) { return redirect(‘admin/dashboard/home’); ..

Read more

Retrieving Data from Database – Laravel I am able to save data into my database using the code below. When the user clicks on the checkbox, the name of the item is displayed and stored in the database. But my problem now is, when I am editing the stored data, I am able to retrieve ..

Read more

Pass Id from ajax to controller – Laravel I am trying to pass my id from ajax to my controller. I mostly see that it is being done through the url but is there any other way i could do this without using the URL? View </div> <div class=”form-group”> <label for=”select” class=”col-lg-2 control-label”>Item</label> <div class=”col-lg-10″> ..

Read more

Method items cannot be found – Many to Many Relationship I have a products and items table with a many to many relationship and a pivot table (item_product). This is how my model looks like. When i try to retrieve items belonging to a product(category) $selectedItems= $products->items()->get(); i get an error “Method items cannot be ..

Read more