jenya

jenya

Member Since 1 Year Ago

Experience Points 5,110
Experience Level 2

4,890 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 38
Lessons
Completed
Best Reply Awards 0
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.

11 Mar
1 month ago

jenya left a reply on Download Website Content And Put It Into Db

@grenadecx thank you for answer. But you say

-You don't need collection. And then you need to parse the page for the categories you want to fetch. I agree. But how to know categories I want to fetch if news posts are published daily?

07 Mar
1 month ago

jenya left a reply on Download Website Content And Put It Into Db

@grenadecx , thank You for your answer. but in this tutorial protected $collections array is known in advance, so it can be passed into public static function scrape($collection). But if some new category can be published and it not in $collections array?

jenya started a new conversation Download Website Content And Put It Into Db

Hi! Is it possible to get and download new articles from website ( https://laravel-news.com for example), put it db (one table - header of the article, another - article body and so on ) and do it on schedule with Laravel framework? Thanks

23 Jan
2 months ago

jenya started a new conversation Authorizing Private Channels By Condition

Hello Laracasts! I use Laravel events broadcasting with socket.IO and redis to notify users if records were updated : in controller

public function update(Request $request, $id)
    {
     ......
     \Event::fire(new UpdateEvent($var));
    }

in my event

class UpdateEvent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $var;

    public function __construct(\App\Card $card) {
    $this->card = $card;
    }

    public function broadcastOn()
    {
       return new PrivateChannel('test-channel'.$this->card->id); 
    }

}

in channels.php

Broadcast::channel('test-channel', function ($user) {
    return auth()->user();
});

and in my view index.blade.php

socket.on("test-channel:App\Events\UpdateEvent", function(message)
  {
    //some jquery action
 }

And question is: if user who can edit card with category 'important' for example make some changes how to deny user who can't see 'important' see this changes. I use spatie/laravel-permissions package to manage permissions. Thanks!

15 Jan
3 months ago

jenya started a new conversation VentureCraft/revisionable

Hello everyone. I use latest versions of VentureCraft/revisionable package, MS SQL Server and latest version of Laravel to log model changes.

model structure is

//PostModel for example
                        $table->integer('id', true);
            $table->integer('card_id');
            $table->integer('otd_id');
            $table->integer('doc_id')->nullable();
            $table->dateTime('doc_date')->nullable();
            $table->string('work')->nullable();

When I change value of work field from empty to 'some text' an error occurs:

SQLSTATE [22018]: [Microsoft] [ODBC Driver 13 for SQL Server] [SQL Server] Error converting nvarchar "some text" value to int data type.
(SQL:insert into [revisions] 
([created_at], [key], [new_value], [old_value], [revisionable_id], [revisionable_type], [updated_at], [user_id]) 
values (2019-15-01 21:21:43.542, work, some text, , 8260, App\Post, 2019-15-01 21:21:43.542, 1023))

It seems like Venturecraft try new value of field into [revisionable_id] Anyone had the same problem?

20 Dec
4 months ago

jenya started a new conversation Paginate Related Model Data

Hello Laracasts! I try to paginate related model data in my view. Models are:

class Card extends Model 
{
   
...............................

    public function ispol()
    {
        return $this->hasMany('App\Ispol','card_id');
    }
    
 .............................   
}

and

class Comment extends Model
{
...........................
 
    public function Card()
    {
        return $this->belongsTo('App\Card');
    }
...........................
}

Retriving data in controller:

public function all(Request $request)
    {
        $records = Card::with(['Document',
                          'comment' => function ($q)
                         {
                           $q->with(['user']);
                        }
                        ])->Paginate(10);
        return view('cards.index', ['records' => $records]);
    }

And view is:

{{$records->links() }}
 
    @foreach($records as $value)
        @foreach($value->comment as $comment)
        <tr>
             <td>{{$value->number}}</td>
             <td>{{$comment->text}}</td>
        </tr>
       @endforeach
    @endforeach

So, paginate don't work correctly..

18 Dec
4 months ago

jenya left a reply on Bind A Select Field From Db

This solution helps me

@foreach($person->state as state)
{!! Form::select('city[]',['New York'=>''New York','Berlin'=>'Berlin','London'=>'London'],\App\City::where('Description','=',$state->city->Description)->pluck('Description','id'),  ['class' => 'form-control']) !!}
@endforeach 

@billmn, @Cronics - thank you very much for your help and attention

14 Dec
4 months ago

jenya left a reply on Bind A Select Field From Db

And one more stupid question please)

<? $cities = App\City::pluck('name', 'id');?>
{{ Form::model($person, array('route' => array('person.update', $person->id), 'method' => 'PUT')) }}

@foreach($person->state as $state)  

{{ Form::text('some_text1[]',$data1)}}
{{ Form::model($state)}} 

    {!! Form::select('city_id[]',$cities, null, ['id' => 'system_list','multiple' => true]) !!}

{{Form::close()}}
{{ Form::text('some_text1[]',$data1)}}
@endforeach

{{Form::close()}}

and when I check my request data using dd(request->all() some_text1 and some_text1 returns arrays form many elements (as much as they have), but city_id returns also array but array from first element only so I can't save data from form beacause loop has for example 5 itterations, but city [] has only one element

jenya left a reply on Bind A Select Field From Db

@billmn, thank you for a detailed answer! But if I want to display all Person data in foreach loop ,can I use Form::model inside Form::model like this:

{{ Form::model($person, array('route' => array('person.update', $person->id), 'method' => 'PUT')) }} 
   @foreach($person->state as $state) 
    {{ Form::model($state) }}
     //bind select liste
   {{ Form::close() }}
  @endforeach
{{ Form::close() }}
12 Dec
4 months ago

jenya left a reply on Bind A Select Field From Db

@billmn, It works great when I have two models as I described below, so great thanks to you! But...if I have another model City for example

<?php
 class City extends Model
{ 
     public function state()
    {
        return $this->hasMany('App\State');
    }
     
}

and

<?php
 class State extends Model
{ 
     public function Person()
    {
        return $this->hasMany('App\Person');
    }
     
     
    public function City()
    {
        return $this->belongsTo('App\city','city_id');
    }
     
}

So,if I use form model binding for State model

{{ Form::model($state, array('route' => array('states.update', $state->id), 'method' => 'PUT')) }} \

and I can bind State to select list in my blade like this

{{ Form::select('otdel_id', \App\State::pluck('Description', 'id'),null, array('class' => 'form-control')) }}

But can I bind select list by ```City`` model values as well

jenya left a reply on Bind A Select Field From Db

@billmn , my models are:

<?php
 class Person extends Model
{
    public function State()
    {
        return $this->belongsTo('App\State', 'state_id');
    }

}
and related

<?php
 class State extends Model
{ 

     public function Person()
    {
        return $this->hasMany('App\Person');
    }
     
   
    
}

And I want to bind state->description value in select list when I loop through Person. @Cronics, thank you for your answer, but is not necessary to do smth like this

<option value="2" selected>Two</option>
<option value="1">One</option>
<option value="3">Three</option>

I just want to have my value selected by default in my select list

11 Dec
4 months ago

jenya left a reply on Bind A Select Field From Db

@billmn, thank you for a answer. I use form model binding but I want to populate my select list with related model data? Is it possible to use form model binding with related models data too?

jenya started a new conversation Bind A Select Field From Db

Hello everyone!

I want to bind db value to <option> tag of select field so that db value will be first in select list, and other option values as well. I use Laravel collective Form package and Laravel 5.7.15. Has anyone done this?

04 Dec
4 months ago

jenya left a reply on Laravel Redisearch Indexing Problem

@munazzil , thank you for a answer. But unfortunatly, it not help. the same error ocures

The field is not a property in the index. id

jenya started a new conversation Laravel Redisearch Indexing Problem

Hello everyone. I want to use Laravel Redisearch driver for Scout in my project. I have Ubuntu 18.04 with Redis server and full-text search extension for it. ( works fine from Redis CLI, I checked). Also I installed ethanhann/Laravel-RediSearch package and counfigure scout_driver variable in .env and in config/scout.php. When I want to import my model for indexing using scout:import command, error ocures: The field is not a property in the index. id My model:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
class Search_test extends Model
{
   use Searchable;
 
    protected $primaryKey ='id';
    protected $table='Search_test';
    protected $connection = pgsql';

   public function toSearchableArray()
    {
      $array =  [
            'id'      => $this->id,
            'name'    => $this->name,
            'value' => $this->value
        ];
//There are only 3 fields :id, name and value
        return $array;
    }
    public function searchableAs()
    {
        return 'search_test_index';
    }
    
}

Please help. Thanks!

15 Nov
5 months ago

jenya left a reply on Broadcast Just Added Model Data

jquery .remove() helped me))

jenya left a reply on Broadcast Just Added Model Data

@D9705996, everything works fine, thank you! But if I delete record in destroy method of my resource controller, and fire some event DeleteEvent , can I also update my laravel view ( I know what Vue is more suitable, but I still use jquery in this project)? I suppose to clear my html table and draw in again in client side

 socket.on("test-channel:App\Events\DeleteEvent", function(message){
   // clear my html table and draw in again
      });

but is where more rational way to do it?

10 Nov
5 months ago

jenya left a reply on Broadcast Just Added Model Data

Thanks! But I can see nested data in the console:

Message Recieved: 
{"event":"App\Events\TestEvent",
"data":
  {"card":{"id":2050,"Number":"2049","Note":"some note",
  "club":[
          {"id":3115,"card_id":"2050","City":"New York"},
          {"id":6165,"card_id":"2050","City":"Utah"}
         ]
  },
  "socket":null
}

But if I want to append field values into jquery like this:

$("#one").append("<tr> <td align=\'center\'> "+message.card.club.city+"</td> </tr>");

it returns undefined...

jenya left a reply on Broadcast Just Added Model Data

@D9705996, thank you for your answer! But is it possible to broadcast nested model data. For example Card belongs to Club, Club has many many Members and so on...

09 Nov
5 months ago

jenya left a reply on Broadcast Just Added Model Data

@D9705996, thank you for your answer. Works fine! But is it possible to use the same technology to display updated data as well? For example, I update name of the card from Micahel to Taylor in my controller method

$card  =Card::find($id);
$card->name ='Taylor';
$card->save(); 

And I want to change name 'Michael' to 'Taylor' in one of the td's in my blade?

jenya left a reply on Broadcast Just Added Model Data

@cmdobueno thank you for your answer. I use Laravel 5.7.5

jenya started a new conversation Broadcast Just Added Model Data

Hello, Laracasts. I want to use Laravel events broadcasting for refreshing my blade view with socket.io. When I save record I fire the event in my controller method like this:

$card  = new Card();
$card->name ='Michael';
$card->city  ='London';
$card->save(); 
\Event::fire(new TestEvent());

And append or prepend a row in my Laravel blade

<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.1/socket.io.js"></script>
    <script>
         var socket = io('http://localhost:3004');
         socket.on("test-channel:App\Events\TestEvent", function(message){
          $("#my_table").append("<tr> <td>just text</td>....... <td>just text</td>></tr>");
         });  
//I use redis pub/sub as well
</script>

It works fine. But how can I append row with just added model fields I add in my controller method?

21 Oct
5 months ago

jenya left a reply on Sorting Coumns In View With Eager Load Records

@Snapey thank you for a answer. I want to sort results by two-three fields from each table in relationships. But how to simplify my problem using joins notnested relationships?

jenya started a new conversation Sorting Coumns In View With Eager Load Records

Hello, Laracasts! I have some data i get from related tables in controller

 $records = Card::with(['Name', 'Document',
            'doer => function ($q) {
                $q->with(['city, 'country']);
                }
        ])->get();

and pass it into view like this

 return view('cards.index', ['records' => $records']);

Is there a way to sort table consists of eager loaded records by each column on the client side?

14 Oct
6 months ago

jenya left a reply on Display Redis Data In Laravel Blade

@neilherbertuk, thank you for a answer. But if i try

@foreach($del as $value)
       <tr> 
            <td align="center">{{$value['id']}}</td>
            <td align="center"> {{$value['card_id']}}</td>
            <td align="center">{{$value['user']}} </td>
            .......
        </tr>
 @endforeach 

an error occurred -Illegal string offset 'id'

jenya started a new conversation Display Redis Data In Laravel Blade

Hello, Laracasts. I can get some data from Redis server and json encode it.

After that I try to pass it into blade view like this

  $del=json_encode(Redis::mget(Redis::keys('data_del_*')),true);
 return view('logs.index', ['del'=>$del]);
dd($del) return
["{\"id\":6167,\"card_id\":\"2025\",\"delo\":null,\"user\":\"jenya\",\"state_id\":\"1\",\"work\":null,\"fail\":null,\"user_id\":\"3\",\"deleted_at\":null,\"nach_id\":\"1\"}","{\"id\":6169,\"card_id\":\"2025\",\"delo\":null,\"user\":\"jenya\",\"state_id\":\"1\",\"work\":null,\"fail\":null,\"user_id\":\"3\",\"deleted_at\":null,\"nach_id\":null}"] "

And question is how to print value in Laravel view . I try do it in foreach loop

@foreach($delas $value)
       
       <tr> 
            <td align="center">{{$value['id']}}</td>
            <td align="center"> {{$value['card_id']}}</td>
            <td align="center">{{$value['user']}} </td>
            .......
        </tr>
    
    @endforeach

but it don't work. Pleas help. Thaks!

23 Sep
6 months ago

jenya started a new conversation Laravel Scout Indexing Of New Records

Hello, Laracasts. I use latest versions of Laravel framework and Scout package with MS SQL Server DB. To implement searching i use import command:

php artisan scout:import "App\Post"

so, post.index file in the storage directory was created and i can use search method with my model (if i update or add new data in table with my Laravel app as well !). but is it possible to consider db table changes in Scout search make not by my app but if somebody add rows in MS SQL Server table directly?? Can i basically detect db changes make outside my app by Laravel methods and for example fire event 'Record № .. was created, but not by Laravel app' ?

02 Sep
7 months ago

jenya left a reply on Using Bootsrtap 4 In Dompdf

@martinbean , thank you for your answer! But is it possible to specify name of downloaded pdf file?

jenya started a new conversation Using Bootsrtap 4 In Dompdf

Hello Laracasts! I use barryvdh/laravel-dompdf v0.8.2 and Bootstrap v4.0.0 to display some data from my DB in Laravel 5.6 app. Is it possible to use such Bootstrap features as grids, form control classes and so on.. If not possible, please tell my what you do in these case, are there others pdf packages for it? Thanks!

17 Aug
8 months ago

jenya left a reply on Can't Pass Variable To A Dompdf LoadView Method

@Cronix, thank you for your answer! I try to do

use App\Card; 
use PDF;
............
public function show($id)
    {
      $card = Card->where('id',$id)->get(); //or another model query
       $this->print_pdf($card); 
    }
//and call print_pdf method with $card parameter
public function print_pdf($card)
{
   $pdf = PDF::loadView('print.print', ['card' => $card]);
    return $pdf->download('card.pdf');
}

dd($pdf) returns some array but if i use

   $pdf = PDF::loadView('print.print', ['card' => $card]);
    return $pdf->download('card.pdf');

error occurs: Maximum execution time of 30 seconds exceeded in vendor\dompdf\dompdf\src\Css\Stylesheet.php file (i want to display in pdf not so much data, only a few rows)

16 Aug
8 months ago

jenya started a new conversation Can't Pass Variable To A Dompdf LoadView Method

Hello, Laracasts. I use dompdf for Laravel, version is 0.8.2, Laravel version is 5.6.33. And i try to load my blade view with some data into .pdf file using dompdf package. Laravel view is obtained from controller method

use App\Card;
use PDF;
............
public function show($id)
    {
      $card = Card->where('id',$id)->get(); //or another model query
     return view('print.print', ['card' => $card]);
    }

so, it's return blade view with data correclty ike this

@foreach ($card as $value)
        <div class="row">
       <div class="col-sm-7"> 
          <h4>{{$value->Number}}</h4>
         </div>
       </div>
       <div class="row">
           <div class="col-sm-12"> 
            <b>{{$value->City}}</b>
       </div>
    </div>
      {-- and so on--}
      @endforeach

Trying to load view into pdf file:

public function print_pdf()
    {    
        $pdf = PDF::loadView('print.print',array('card' =>$card));
        return $pdf->download('card.pdf');
    }

but error occurs "Undefined variable: card". Please help. Thanks

11 Aug
8 months ago

jenya started a new conversation Related Models In Query Filter

Hello, Laracast! I try to make search by my related models, parameters to query filter I pass from search form inputs. Models are:

class Card extends Model
{
    public function Doer()
    {
        return $this->hasMany('App\Doer,'card_id');
    }
}
//Card can have several Doers
class Doer extends Model
{
    public function Card()
    {
        return $this->belongsTo('App\Card');
    }
    public function City()
    {
        return $this->belongsTo('App\City','city_id');
    }
   //Doer can have several Doers
}

and

class City extends Model
{
     public function Doer()
    {
        return $this->hasMany('App\Doer','city_id');
    }
}

I want to select only Cards which number == $request->input('number') and doer only from city where city == $request->input('city') I can get Cards with Doers

$x=Card::with([
                      'Doer'=>function($query)
                              {
                               //some conditions ???
                              }
                              ])->get( );

But how to select only doer which id = City.id and City.description ==$request->input('city')?

05 Aug
8 months ago

jenya left a reply on Display Blade Data As A List, Tile Or Simple Table

@esorone, are you sure that https://github.com/Nayjest/Grids is working with Blade templating?? Have ou any examples? Nayjest/Grids works like (demo example)

public function getExample1()
    {
        $cfg = [
            'src' => 'App\User',
            'columns' => [
                'id',
                'name',
                'email',
                'country'
            ]
        ];
        $grid = Grids::make($cfg);
        $text = "<h1>Basic grid example</h1>";
        return view('demo.default', compact('grid', 'text'));
    }

and just pass $grid variable into view like this:

    <div class="container">
            <?= $grid ?>
        </div>

where here can be applied blade conditions like @if , @else and so on ?

04 Aug
8 months ago

jenya left a reply on A Blank Page When I Access /horizon

@RonB1985, @Cronix thank you both for your answers! But is it possible to setup MS SQL Server 2012 or higher on Homestad? I just use MS SQL in my project

jenya left a reply on A Blank Page When I Access /horizon

@Cronix , thanks for the detailed answer.But can homestad be installed on VMWare(because it is already installed) or it requires Vargant only?

jenya left a reply on A Blank Page When I Access /horizon

@squibby, great thanks for your answer.Yes, i have published and horizon.php file has been created in config dir. But in browser develpoer tools i can see errors that say that failed app.js and app.css files..

jenya started a new conversation A Blank Page When I Access /horizon

Hello, Laracasts! I have PHP Version 7.1.12 and installed Horizon package v 1.3.1 on my Windows 7 PC like this:

composer require laravel/horizon --ignore-platform-reqs

(predis client v 1.1.1 installed with Horizon as well) After that I configured and tested predis client by set and get some keys in it

Route::get('/predis',function(){
      Redis::set('new_key', 'new_value');

});//It works

Also i set redis as a queue driver in myr queue configuration file. In AppServiceProvider.php file i configured users access

public function boot()
    {
        \Horizon::auth(function ($request) 
        {
          return true;//access to all or
         return auth()->user()->id==3;//for user whit id equal 3
       //both methods works as well
         });
    }

When i started horizon ``php artisan horizon // CLI says thar Horizon started successfully //but also shows some error Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined function Laravel\Horizon\Console\pcntl_async_signals() //I think purpose is i dont use pcntl ext because it' php on Windows )``` After that I try to access Horizon dashbord by /horizon route and after all this i see blank page (but Debugbar show me that horizon view horizon::app (\vendor\laravel\horizon\resources\views\app.blade.php)) is loaded without any errors?? What is the reason?

03 Aug
8 months ago

jenya left a reply on Display Blade Data As A List, Tile Or Simple Table

@ bobbybouwmann, great thanks for this package! But is it possible to use blade conditions inside?

jenya started a new conversation Display Blade Data As A List, Tile Or Simple Table

Hello everybody! Are there any packages or built-in capabilities in Laravel that allow to display view data as a list, tile or simple table as implemented in online stores for example? Thanks!

29 Jul
8 months ago

jenya left a reply on Notify User Of New Records Added

Thanks for anserws! But can I use websocket or pusher in my Intranet (or in local machine without Internet) app? Pusher require to sign up, for example to get an app key

jenya started a new conversation Notify User Of New Records Added

Hello, Laracast! I want to notify user about new records added to db, for example he will see popup or modal window in the right bottom corner with notification "Post with some title created'' , refresh data in view automatically and  add some roles for users, for example if user has admin role, he will see popups with all user actions but if not admin - only posts he can read/edit and so on..

And question is: Does Laravel have a ability to do it with his own means, without jquery, bootstrap and so on. I have heard about broadcasting events, socket.io, slack etс, but a lot of information about it. What is suitable for me, please advice. Thanks!

22 Jul
8 months ago

jenya left a reply on Blade Directives In YajraDatatables

@Snapey, great thanks for a fastest answer! But how in this case to autoupdate data in my view with loader and in ajax container , as I quickly did with datatables on raw php without Laravel? Are there any ways to build it without Yajra package?

jenya started a new conversation Blade Directives In YajraDatatables

Hi everyone. When I want to display data from DB in my blade view I usually do like this

//My controller
 public function index()
    {
      $rec=Card::all();
     return view('cards.index')->with('card', $rec);
   }

and display data in blade view using directives

...............
<thead>
        <tr>
           <td align="center">Number</td>
           <td align="center">Surname</td> 
           <td align="center">City</td>           
       </tr>
</thead>
<tbody>
@foreach($rec as $value)
        <tr>
           @if($value1->City=='New York')
             <td><i class="fas far fa-clock" style="font-size:26px"></i>{{$value1->City}}</td>
           @else
             <td><i class="fas fa-exclamation-circle" style="font-size:26px"></i>{{$value1->City}}</td>
           @endif
          <!-- different @if, @role directives used here -->
        </tr>
@endforeach
</tbody>
...............

But if i want to use YajraDatatables package for Laravel, Controller would like

use Yajra\DataTables\Facades\DataTables;
...................................
public function index()
    {
      $rec=Card::all();
     return Datatables::of($rec)->make(true);
   }

and in view

<script>
   $('#posts-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: 'url to responce',
        columns: [
            {data: 'Number', name: 'Number'},
            {data: 'Surname', name: 'Surname'},
            {data: 'City', name: 'City''}
        ]
    });
</script>
...............
<tabele id="posts-table">
<thead>
        <tr>
           <td align="center">Number</td>
           <td align="center">Surname</td> 
           <td align="center">City</td>           
       </tr>
</thead>
</table>
...............

Is it possible to use blade directives in view which contains YajraDatatable ?? Laravel version is 5.6.26, YaraDatatables is 8.7.0, db -MS SQL Server 2012, jquery 3.2.1, datatables verison 1.10.19. Please help.

27 Jun
9 months ago

jenya left a reply on Form Model Binding By Condition

@BishoyWagih - condition in foreach loop - this is what I need, it works, thank you !! @Snapey , now i use href button to edit, thank you

26 Jun
9 months ago

jenya started a new conversation Form Model Binding By Condition

Hi everyone. I have two models first is '''

21 Jun
9 months ago

jenya left a reply on How Can I Add A New Item In One-to-many Relation While Updating

Great thanks to @GRENADECX, his advice helps me how to delete records and to @mvd for his post about adding new records! But i have heard about attach and sync methods which can used for updating related models? Are they for my one to many relation or for many to many ect..?

18 Jun
10 months ago

jenya left a reply on How Can I Add A New Item In One-to-many Relation While Updating

@mvd, thank you for your post. it is a good idea to add new records like you advise but if i want to delete for example 2 of 3 existing textarea using jquery from my blade, how to save reords now?

17 Jun
10 months ago

jenya started a new conversation How Can I Add A New Item In One-to-many Relation While Updating

Hello everyone. I have 2 related models in my Laravel 5.6 app

1st is

Card model

l and and it has a

public function Control()
    {
        return $this->hasMany('App\Control','card_id');
    }

Control lmodell

also have a ``` public function Card() { return $this->belongsTo('App\Card'); } ``` in my resource controller i am going to edit given relation in such way ``` //CardController public function update(Request $request, $id) { $cards= Card::find($id)->control;
foreach ($cards as $card=>$val)
 {
      $val->work=$request->get('work')[$card];
     //editing 'work' field, i get values from 'work[]' array -it is a textarea fields from my 
    //edit.blade
      $val->save();
}
but if i try to add some new textareas in my edit.blade using jquery append method, so i have for example two existing textsareas and i add another 4 textareas, how to add data from this new and old textareas properly? Thank you for attention


09 Jun
10 months ago

jenya left a reply on Form Model Binding For A Few One To Many Models

not solved yet. I should try it with my table data

08 Jun
10 months ago