Donations Appreciated

You have not lived today until you have done something for someone who can never repay you. - John Bunyan

Click here to lend your support to: Laravel Datatables and make a donation at !

EloquentController.php - Has Many

Id Title Author Name Email Created At Updated At


    public function getHasMany()
        return view('datatables.eloquent.has-many');

    public function getHasManyData()
        $posts = User::first()->posts()->with('user');

        return Datatables::of($posts)
            ->editColumn('title', '{!! str_limit($title, 60) !!}')


        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
            {data: 'id', name: 'id'},
            {data: 'title', name: 'title'},
            {data: '', name: 'name', orderable: false, searchable: false},
            {data: '', name: 'email', orderable: false, searchable: false},
            {data: 'created_at', name: 'created_at'},
            {data: 'updated_at', name: 'updated_at'}