dan3460

dan3460

Member Since 1 Year Ago

Haddon Hts

Experience Points 16,800
Experience Level 4

3,200 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 118
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

02 Sep
2 weeks ago

dan3460 left a reply on Wrong Character Display

thanks @snapey, that did it. Learn something new today.

dan3460 left a reply on Wrong Character Display

I'm not sure. If i open the original file in VSC and the encoding is UTF-8 i get this:

<TR><TD></TD><TD>25</TD><TD>1 </TD><TD>Alexander Sykes  (752)</TD><TD></TD><TD></TD><TD>BYE</TD></TR>
<TR><TD></TD><TD>21</TD><TD>� </TD><TD>John Cornwell  (1271)</TD><TD></TD><TD></TD><TD>BYE</TD></TR>

if i change the encoding to ISO-8859-1 i get this:

<TR><TD></TD><TD>25</TD><TD>1 </TD><TD>Alexander Sykes  (752)</TD><TD></TD><TD></TD><TD>BYE</TD></TR>
<TR><TD></TD><TD>21</TD><TD>½ </TD><TD>John Cornwell  (1271)</TD><TD></TD><TD></TD><TD>BYE</TD></TR>

I think is Nginx or PHP that is applying UTF-8 to display.

dan3460 started a new conversation Wrong Character Display

I made a small web site for my local chess club and when displaying the results of the last round i'm getting an unknown character instead of the 1/2 symbol. The files that i display come directly from the USCF (US chess federation) and i store them as a blob on a mysql database. BTW the site is https://www.woodburychessclub.com the table can be seen at https://www.woodburychessclub.com/currentTournament

so far this is what i have done:

  • Changed the meta tag to charset="ISO-8859-1"
  • Changed the default_charset = "ISO-8859-1" in the php.ini file

If i look at the data using mysql workbench i see the 1/2 symbol, so its been lost either by Nginx or PHP. I'm guessing here, what do i know.

I think UTF-8 charset should be able to display 1/2 symbol, which i think is the default everywhere.

Thanks for the help.

25 Aug
3 weeks ago

dan3460 left a reply on Pagination Problem - Probably I'm Just Dumb

Thanks guys for the kind words, i'm taking them as kind :). To give some context and to prove that i'm not that dumb, i saw the error as soon i posted the question. i was giving the pagination function on a controller that didn't call the view where i needed the pagination.

24 Aug
3 weeks ago

dan3460 started a new conversation Pagination Problem - Probably I'm Just Dumb

disregards

04 Aug
1 month ago

dan3460 left a reply on Are You Also New? Is Your .env Showing?

A couple of years ago i looked at one of those shared hosting solutions and indeed they want everything hanging from one entry point. My solution was to get my own hosting, for about $6/month i have a linux machine that i complete control. I'm running 4 different web sites there. I have another machine that i run mail-on-a-box for a mail server.

30 Jul
1 month ago

dan3460 left a reply on Github Security Alerts - Yarn

@snapey thanks, i just did.

dan3460 left a reply on Github Security Alerts - Yarn

ok, understand. Thanks very much.

dan3460 left a reply on Github Security Alerts - Yarn

I don't think, at least on the project that i got the security alert, that i ever used npm to install any package. After i create the laravel project i run npm install and then npm run-dev to compile scss and any js that i have modified. I normally use composer to install any packages that i may need for the project. So i'm a little confused (sorry if this is way basic), is there an "yarn run-dev" and one for production?

dan3460 left a reply on Github Security Alerts - Yarn

This is a stupid question but, i have never used yarn. I think the yarn.lock files is installed when i run npm install. I try to run yarn upgrade and the bash window could not find yarn. Do i have to install yarn too?

dan3460 started a new conversation Github Security Alerts - Yarn

I'm trying to solve some security vulnerabilities that github is reviewing in my code. All the ones left are defined in yarn.lock file. How do i update the yarn.lock so the dependencies are up to date?

19 Jul
2 months ago

dan3460 left a reply on View()->share() Vs Compact()

I didn't mean to open a can of worms. It seems to me that in almost everything in life, there are mode than one way to skin a cat. My task is to learn more about view()->share().

dan3460 left a reply on View()->share() Vs Compact()

Thank, guys.

dan3460 left a reply on In Shared Hosting Environment, How To Hide .env File From Public?

That is correct, but you have to remember that the old websites "everything" was intended to be seen by the people browsing the site. I'm just guessing here but if you are using Laravel you are probably accessing a database and may be adding data and running procedures on that database. That requires a different level of security that in the old websites. If you look at the public folder in Laravel it almost have nothing, just a few files and the pictures you are showing in the site. Everything else is hidden to the public.

dan3460 left a reply on View()->share() Vs Compact()

Thanks, i understand. I see where you can easily get confused that you are calling for some data on a view that is coming from a buried function. One more question is i may: The OP of the thread had something like this

View::share('data', $data1);
View::share('otherData',$otherData);
.
.
.

return view('home);

That would not be different from:

return view('home',compact('data1','otherData');

Is this correct? as the share() occurred in the same function as the calling of the view.

Thanks again, learned something new today.

dan3460 started a new conversation View()->share() Vs Compact()

@snapey had a comment on a discussion about a blade returning 1. He said that uses the share method to pass data to the view. I have been using the compact() function when i'm passing data to the view (for example a drop down). Are there significant differences between the two methods?

BTW this is the post: https://laracasts.com/discuss/channels/laravel/blade-echoing-returning-1

10 Jul
2 months ago

dan3460 left a reply on Lite CMS Package

@jlrdw That is exactly what i did and the ones i found are complete crm systems. If i understand correctly you build the site around it. It seems like an overkill for what i'm trying to do.

dan3460 started a new conversation Lite CMS Package

Is there an lite CMS package out there? I'm working on a chess club website and i want to add a page that have the results of the current tournament. The person that will be updating this page has can barely use the email. All the CMS packages that i've seen are full blow applications. Is there something that i can use. BTW i have security in the site as i have a forum for the members. Thanks for the help.

22 Jun
2 months ago

dan3460 left a reply on Lavacharts Gauge Colors

@braunson endeed it seems to be just that.

Thanks for the post

21 Jun
2 months ago

dan3460 started a new conversation Lavacharts Gauge Colors

Is anyone using Lavacharts? Do you know if it is possible to to have more that 3 colors on the face of a gauge chart? Thanks

02 Jun
3 months ago

dan3460 left a reply on Datatable Draw Not Updating Post Variable

After several hours of working on this thing i think i have the answer, Indeed it looks like that way that i was constructing the ajax call is the static method https://datatables.net/reference/option/ajax.data. To be able to manipulate the data section of the ajax function has to be declared with a closure in this way:

ajax: {
    url: '/getBatches',
    type: 'post',
    data: function(d){
        d._token = "{{csrf_token()}}",
        d.type = $("#type").val()
    }
},

Thanks

dan3460 left a reply on Datatable Draw Not Updating Post Variable

@bobbybouwmann made the following change at the data portion of the ajax call:

data: {
    _token: "{{csrf_token()}}",
    type: $("#type").children("option:selected").val()
}

It didn't changed the result. It seems to me that when the table is declared is burned in memory and the function draw() only calls for that in memory to reprocess. It doesn't read again the variables. I place the same question in the DataTables web site,

dan3460 left a reply on Datatable Draw Not Updating Post Variable

Here is. I thought that the value may not be passing correctly so i selected a one of them and returns the correct data.

<div class="form-group">
    <select class="form-control" name="type" id="type">
        <option value=0>Pending</option>
        <option value=1 selected>Posted</option>
        <option value=2>All</option>
    </select>
</div>
01 Jun
3 months ago

dan3460 started a new conversation Datatable Draw Not Updating Post Variable

I'm using Yajra Datatables, I have a select that returns 0,1 or 2 and depending on that the datatable is populated. My problem is when changing the selection the "type" variable still the one on the first selection. In other words the type still 0 regardless of what was selected. The alert that i have in the change, shows the selection chaging, but the draw has the old data:

    $(document).ready(function(){
    var batchesTable = $('#batches').DataTable({
        processing: true,
        serverSide: true,
        ajax: {
            url: '/getBatches',
            type: 'post',
            data: {
                _token: "{{csrf_token()}}",
                type: $("#type").val()
            }
        },
        columns:[
            {data: 'id', name: 'id'},
            {data: 'name', name: 'name'},
            {data: 'debit', name: 'debit'},
            {data: 'credit', name: 'credit'},
            {data: 'updated', name: 'updated'},
            {data: 'posting', name: 'posting'},
            {data: 'action', name: 'action'}
        ]
    });

    $("#type").change(function(){
        alert($("#type").val());
        batchesTable.draw();
    });
})
25 May
3 months ago

dan3460 left a reply on Form With Sub-form With Multiple Lines

@bobbybouwmann . I did looked at some examples and got some ideas. I just didn't wanted for some one to say afterwards: "You should have used (i'm inventing a term here) @callOrderLines that display all the lines for the order"

Because i'm not a full time programmer it has happen to me before.

Thanks.

dan3460 started a new conversation Form With Sub-form With Multiple Lines

I'm upgrading a web site that present the user with an order, that order can have one or more lines (different services to be performed) and each line (service) can have one or more activities. The site uses Javascrip and a series of ajax calls to the database to add, delete or update the lines and sub-lines. As every time that i work with Laravel is something new, is there anything out there that can do this? Thanks for the help

22 May
3 months ago

dan3460 left a reply on Resource Route Not Taking Parameter

@devfrey but do you know why only works with the singular?

dan3460 left a reply on Resource Route Not Taking Parameter

@devfrey Hummmm! that works. I was using the name that the boiler plate gave to the variable. I assumed that could be named anything why the plural would affect the functioning of the method?

Thanks for your help.

PD. I named the variable xxx and doesn't work. Interesting, intrigued.

dan3460 started a new conversation Resource Route Not Taking Parameter

I have a weird problem that i don't know how to troubleshoot. I have a button with to edit an order, that hits the:

Route::resource('orders', 'OrdersController');

which goes to:

public function edit(Orders $orders)
{
    dd($orders);
    $customer = Customer::find($orders->customer_id);
    $equipments = Equipment::where('customer_id',$orders->customer_id)->get();
    $techs = User::where('tech',true)->get();

    return view('orders.edit', compact('orders','customer','equipments','techs'));
}

the dd there gives me an empty collection:

Orders {#1181 ▼
  #table: "orders"
  #connection: null
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: false
  +wasRecentlyCreated: false
  #attributes: []
  #original: []
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #fillable: []
  #guarded: array:1 [▶]
}

but if i do this:

Route::get('/orders/{order}/edit', function(Orders $order){
    dd($order);
});

returns the order:

Orders {#1188 ▼
  #table: "orders"
  #connection: "mysql"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:12 [▼
    "id" => 1
    "customer_id" => 32
    "equipment_id" => null
    "users_id" => null
    "date" => "2019-05-21 00:00:00"
    "update" => null
    "invoiced" => 0
    "notes" => null
    "warning" => null
    "created_by" => 1
    "created_at" => "2019-05-21 20:58:47"
    "updated_at" => "2019-05-21 20:58:47"
  ]
  #original: array:12 [▶]
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: []
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #fillable: []
  #guarded: array:1 [▶]
}

Where i can see what is being passed in the resource route?

21 May
3 months ago

dan3460 left a reply on VSC Blade Snippets Not Recognizing Blade.php

Found my problem, in the file association section i had:

    "files.associations": {
        "*.blade.php": "html",
        "*.tpl": "html",
        "*.php": "blade"
    },

I replace it with:

    "files.associations": {
        "*.blade.php": "blade",
        "*.tpl": "html"
    },

Don't know if this is correct but now everything is working.

dan3460 left a reply on VSC Blade Snippets Not Recognizing Blade.php

@yezawhein here is my settings.json, could be something there that is interfering with the autoselect lenguage?

 {
    "workbench.startupEditor": "newUntitledFile",
    "explorer.confirmDelete": false,
    "window.zoomLevel": -1,
    "git.enableSmartCommit": true,
    "cSpell.userWords": [
        "Khill",
        "Laravel",
        "accessorial",
        "describedby",
        "endauth",
        "endforeach",
        "endsection"
    ],
    "breadcrumbs.enabled": false,
    "terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe",
    "explorer.confirmDragAndDrop": false,
    "workbench.iconTheme": "material-icon-theme",
    "files.associations": {
        "*.blade.php": "html",
        "*.tpl": "html",
        "*.php": "blade"
    },
    "[html]": {},
    "emmet.triggerExpansionOnTab": true,
    "blade.format.enable": true,
    "emmet.includeLanguages": {
        "blade" : "html"
    }
}
20 May
3 months ago

dan3460 started a new conversation VSC Blade Snippets Not Recognizing Blade.php

I have VSC installed at my home and work computer. Both installations are identical as far i can see. One of the extensions that i have in both is Laravel Blade Snippets by Winnie Lin. At my home computer when opening a Blade file it automatically recognizes a blade file. On my work computer i have to manually change in the bottom left corner from "html" to "Laravel Blade". I have google to exhaustion and haven't been able to get a solution. Is not crucial, is just annoying.

Thanks guys,

12 May
4 months ago

dan3460 left a reply on Charts Not Rendering

After several hours i found my problem.

$chart->labels('One','two','three');

Needs to be given as an array.

dan3460 left a reply on Charts Not Rendering

By reading the installation guide i think i needed to add the following:

<script>
    {!! $chart1->script()!!}
</script>

Now i get all kind of errors. At Artisan serve:

[Sun May 12 08:15:16 2019] PHP Fatal error:  Method Illuminate\View\View::__toString() must not throw an exception, caught ErrorException: array
_walk_recursive() expects parameter 1 to be array, string given (View: C:\Users\Tony\Documents\Software\Test\test\vendor\consoletv
s\charts\src\Views\chartjs\script.blade.php) in C:\Users\Tony\Documents\Software\Test\test\storage\framework\viewsa165dbafd0838
f428939fa5fab9e0cea779a2c.php on line 0

On the developer console i see the internal server error followed by 29 errors which i think derive from the first error.

dan3460 left a reply on Charts Not Rendering

I started early this morning trying to solve this problem. I went to Charts.js, as i'm using that type of charts, and copy the sample on their usage page. That works. So now on my welcome page a have the waiting circle and the graph from the Charts.js below, this tells me that there is something that is not been rendered when using consoletv/charts. I'll keep looking.

11 May
4 months ago

dan3460 started a new conversation Charts Not Rendering

I need to put some charts on a web site. So i was testing on a new install to see how to use consoletvs/charts, which seems pretty powerful. I follow the instructions but only get a wait icon on the page. Here is what i have: my controller:


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Charts\TestChart;

class ChartController extends Controller
{
    public function index()
    {
        $chart = new TestChart;

        $chart->labels('One','two','three');
        $chart->dataset('First','line',[20,18,15,45]);

        return view('welcome',compact('chart'));
    }
}

The top of the welcome page:

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.js" charset="utf-8"></script>

and where the chart supposed to render:


            <div class="content">
                <div class="title m-b-md">
                    Laravel
                </div>
                {!!$chart->container()!!}


            </div>

I'm missing something else? Thanks for the help.

07 May
4 months ago

dan3460 left a reply on Error On Scss File From Bootstrap

I think i found the solution. Looking at the errors was complaining that also was a couple of variables missing: $carousel-transition and $carousel-transition-duration. I added the first instead of the semicolon and added the other and everything compiled.

dan3460 started a new conversation Error On Scss File From Bootstrap

I'm building a quick landing page for a web site. I grabbed a sample landing page and implemented it on the site. This landing page uses a _variable.scss that is coming with the downloaded page from Bootstrap. I was getting an error when i tried to run npm run dev got an undefined expected identifier. Looking a VSC i saw that _variables.scss had 2 errors:


$carousel-control-icon-width:        20px !default;

$carousel-control-prev-icon-bg:      str-replace(url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='#{$carousel-control-color}' viewBox='0 0 8 8'%3e%3cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3e%3c/svg%3e"), "#", "%23") !default;
$carousel-control-next-icon-bg:      str-replace(url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='#{$carousel-control-color}' viewBox='0 0 8 8'%3e%3cpath d='M2.75 0l-1.5 1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3e%3c/svg%3e"), "#", "%23") !default;

$-duration:       .6s !default;
$:    transform $-duration ease-in-out !default; // Define transform transition first if using multiple transitions (e.g., `transform 2s ease, opacity .5s ease-out`)


// Spinners

$spinner-width:         2rem !default;
$spinner-height:        $spinner-width !default;
$spinner-border-width:  .25em !default;

the errors are on:

$:    transform $-duration ease-in-out !default; // Define transform transition first if using multiple transitions (e.g., `transform 2s ease, opacity .5s ease-out`)

I don't think that $: is a valid parameter. Any ideas?

06 May
4 months ago

dan3460 left a reply on Table ID Conflict When Feeling A <select>

@cronix that was the problem.

Thank you sir

dan3460 started a new conversation Table ID Conflict When Feeling A <select>

I have a table(offices) that its id is a varchar(2) and it is the primary key. This table is needed when creating a new customer so i fill a select from this table:

<div class="form-group">
    <label for="officeID">Office</label>
    <select class="custom-select" required id="officeID" name="officeID">
        @foreach ($offices as $office)
            <option value="{{$office->id}}">{{$office->id}} {{$office->name}}</option>
        @endforeach
    </select>
    <div class="invalid-feedback">Example invalid custom select feedback</div>
</div>

my problem is that {{$office->id}} is bringing 0, it seems that Laravel is trying to get the index as a number which this is not. Is this correct, is there anyway to force it to come with the 2 letter code?

dan3460 left a reply on MySql Access Denied 'root'@'localhost'

@JLRDW - This did it.

Thanks

03 May
4 months ago

dan3460 started a new conversation MySql Access Denied 'root'@'localhost'

I think this problem belong here, sorry if i'm in the wrong channel. I'm setting up an application in a new server. Looking at the logs i'm getting the following error message: Access denied for user 'root'@'localhost' (using password: YES)

Here is my .env:

DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=commission DB_USERNAME=root DB_PASSWORD=root

I can access the mysql from the command line using the user and passwd from above. Is there a way that i can see how is laravel forming the call to the database?

09 Oct
11 months ago

dan3460 left a reply on Weird Behavior In Yajra Datables Controller Function.

@jaythanki Thanks for the answer. I spent several hours on this problem, testing and trying to get at the root of the problem. I created a test app and started to go over step by step. The problem was in the data. I'm connected to a test database with many orphan records, the program was crashing on a record that did not have a shipper. All is fine now.

08 Oct
11 months ago

dan3460 started a new conversation Weird Behavior In Yajra Datables Controller Function.

I have been working with Laravel Datatables for a while and i like them very much, until now... I don't know if people here are familiar with them but this is my problem. It worked until i added a column that uses a belongs to relationship.

    public function growerSearchLocal(Request $request)
    {
        $growers = Grower::where('grower_name', 'like', '%' . $request->growerText . '%')
            ->get();

        return DataTables::of($growers)
            ->addColumn('country', function(Grower $grower){
                return $grower->address->country->country_name;
            })
            ->addColumn('shipper', function(Grower $grower){
                return $grower->shipper->entity->entity_name;
            })
            ->make(true);
    }

The first column returns a has one relationship and the second is the one that returns belong to relationship. I get an error message because the return is null. I tested to make sure that i was returning the right thing:

    public function test()
    {
        $grower = Grower::find(9);

        dd($grower->shipper->entity->entity_name);
    }

The function above return the correct data. I even tried to force getting the shipper data but $shipper gives me null

    public function growerSearchLocal(Request $request)
    {
        $growers = Grower::where('grower_name', 'like', '%' . $request->growerText . '%')
            ->get();

        return DataTables::of($growers)
            ->addColumn('country', function(Grower $grower){
                return $grower->address->country->country_name;
            })
            ->addColumn('shipper', function(Grower $grower){
                $shipper = Shipper::where('entity_id', $grower->entity_id)->first();
                dd($shipper);
                return $shipper->shipper_name;
            })
            ->make(true);
    }

Any idea?

06 Oct
11 months ago

dan3460 left a reply on Yajra Datatables Returning Escaped Characters

In case that someone has the same problem i got the answer looking at the config file. There is a list of column names that are allowed to have raw data, just need to add column names there.

dan3460 started a new conversation Yajra Datatables Returning Escaped Characters

Don't know if someone here can help me here. I started using the plug in for Datatables and is fantastic. On my test app i have a Datatable that return a column with html code, works fine. On my real application for some reason the Datatable is returning especial characters instead of "<" or ">" this is my function returning the data:

public function getShippers()
{
    $shippers = Shipper::where('entity_belong', Auth::user()->entity_id)->get();

    return Datatables::of($shippers)
        ->addColumn('name', function(Shipper $shipper){
            return $shipper->entity->entity_name;
        })
        ->addColumn('country', function(Shipper $shipper){
            return $shipper->entity->address->country->country_name;
        })
        ->addColumn('documents', function(Shipper $shipper){
            return $shipper->documents->count();
        })
        ->addColumn('openLine', "<i class='fas fs-plus-square'></i>")
        ->addColumn('select', function(){
            return '<td><input type="checkbox" name="" id=""></td>';
        })
        ->make(true);
}

and here is the json:

{
"draw": 0,
"recordsTotal": 2,
"recordsFiltered": 2,
"data": [
{
"shipper_id": "8",
"entity_id": "21",
"entity_belong": "20",
"shipper_connected": 0,
"shipper_request": null,
"shipper_connect": 0,
"shipper_ds": null,
"id": "17",
"created_at": "2018-09-16 12:52:52",
"updated_at": "2018-09-16 12:52:52",
"name": "Exser Ltd",
"country": "Chile",
"documents": "1",
"openLine": "&lt;i class=&#039;fas fs-plus-square&#039;&gt;&lt;/i&gt;",
"select": "&lt;td&gt;&lt;input type=&quot;checkbox&quot; name=&quot;&quot; id=&quot;&quot;&gt;&lt;/td&gt;"
},
{
"shipper_id": "9",
"entity_id": "26",
"entity_belong": "20",
"shipper_connected": 0,
"shipper_request": null,
"shipper_connect": 0,
"shipper_ds": null,
"id": "17",
"created_at": "2018-09-27 21:07:54",
"updated_at": "2018-09-27 21:07:54",
"name": "La Rosa Sofruco",
"country": "Chile",
"documents": "1",
"openLine": "&lt;i class=&#039;fas fs-plus-square&#039;&gt;&lt;/i&gt;",
"select": "&lt;td&gt;&lt;input type=&quot;checkbox&quot; name=&quot;&quot; id=&quot;&quot;&gt;&lt;/td&gt;"
}
],
"input": []
}

Now the weird thing is that when I was building the function i created the select and i had the check box in the document. When i added the openLine is when i got the problem and after copying, moving around, switching and changing now none of them work.

04 Oct
11 months ago

dan3460 started a new conversation Seeding Database With 500 Users And Each User With Random Number Of Posts

I now how to seed 500 users. Now i'm trying to get them a random number of post from 2 to 15 per user. So I created a factory for the Posts:

use Faker\Generator as Faker;
use App\Posts;

$factory->define(Posts::class, function (Faker $faker) {
    return [
        'title' => $faker->sentence(5),
        'text' => $faker->text(),
        'user_id' => factory('App\User')->create()->id
    ];
});

and a seeder:


use Illuminate\Database\Seeder;

class PostsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        factory('App\Posts', rand(2,15))->create();
    }
}

but when i run php artisan db:seeder it only creates a random number of users (from 2 to 15) each with 1 post. How can an achieve what i want?

Thanks for the help,