dan3460

dan3460

Member Since 1 Year Ago

Haddon Hts

Experience Points 13,400
Experience Level 3

1,600 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 92
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.

22 May
2 days 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.

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 days 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"
    },

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
4 days 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
1 week 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 looing.

11 May
1 week 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: `` Laravel

    <!-- 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
2 weeks 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
2 weeks 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: '

Office @foreach ($offices as $office) {{$office->id}} {{$office->name}} @endforeach Example invalid custom select feedback ' 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
3 weeks 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
7 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
7 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
7 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
7 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. 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,

30 Sep
7 months ago

dan3460 left a reply on Serialization Of Closure Is Not Allowed, In Queuing A Mail

For some reason the mail enters on a loop when i do the proposed solution. To test i'm not using the $request anywhere, i only passing it as shown by @lostdreamer_nl to the SendDocument Mailable. I took all references also from the SendDocument.blade.php. Here is the Mailalble:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\File;
use App\Jobs\DeleteFiles;
use App\Document;

class SendDocuments extends Mailable
{
    use Queueable, SerializesModels;

    public $files;
    public $request;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($files, $request)
    {
        $this->files = $files;
        $this->request = $request;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {

        $message = $this->markdown('mails.sendDocuments');
        if ($this->files) {
            foreach ($this->files as $file) {
                File::copy(storage_path('app/' . $file->file_id), public_path($file->file_id));
                $message->attach(public_path($file->file_id), [
                    'as' => $file->type->document_type_name . '-' . $file->audit . '.pdf',
                    'mime' => 'application/pdf'
                ]);
                DeleteFiles::dispatch(public_path($file->file_id))->delay(now()->addSeconds(config('system.deleteTime')));
            }
        }

        return $message;
    }
}

dan3460 started a new conversation Serialization Of Closure Is Not Allowed, In Queuing A Mail

I have a simple email that sends files to a customer.

    public function storeReceiver(Request $request)
    {
        $files = Document::whereIn('document_id',explode(',',$request->fileList))->get();
        $receiver = Receiver::find($request->receiverID);

        Mail::to($receiver->entity->entity_contact_email)->queue(new SendDocuments($files));
    }

That works fine, but in the request i also have some text that i want to put in the body of the email. So when i do this:

Mail::to($receiver->entity->entity_contact_email)->queue(new SendDocuments($files,$request));

Gives me the error in the title. If i replace queue by send, works fine. So its clearly complaining about the two parameters in the mail object when sent to the queue. Is there any way around this?

27 Sep
7 months ago

dan3460 left a reply on Unable To Find Socket Transport Starttls

Thanks for the idea. I will try this weekend.

dan3460 left a reply on Unable To Find Socket Transport Starttls

I could not solve this problem, i don't know if this is a web server problem or a mail server problem. Because i have to move on, i created a gmail account that I'm using to manage the emails from the site. Not the best solution but will have to do in the meantime.

26 Sep
7 months ago

dan3460 left a reply on Unable To Find Socket Transport Starttls

I setup a test site on the server and loaded a basic Laravel app that sends a test email. On my developing machine it sends emails no problem using the credential set above. On the test site doesn't work, so it is definitely a server problem. Now, on that same server i have a couple of applications that send email, they where built on Laravel 5.2, i was supposed to upgrade them to 5.7 to add more functions to the sites but that is on hold now. (good thing that i fund this problem before, other wise i will be in trouble). So, probably the email system in 5.7 got upgraded and now is checking for something that the old version did not checked for.

Any ideas will be appreciated.

25 Sep
7 months ago

dan3460 left a reply on Unable To Find Socket Transport Starttls

I have worked for about 6 hours on this problem and i'm not getting anywhere. I downloaded the Ca bundle certificates made sure that php.ini openssl.cafile is pointing to the downloaded certificate and nothing. I hit a roadblock. Don't know where to turn. Anyone has ideas?

24 Sep
8 months ago

dan3460 left a reply on Unable To Find Socket Transport Starttls

I'm done testing today. I setup my development computer with the credentials above and worked fine, with encryption as TLS. I think there is definitely something not correctly configured in my production box.

dan3460 left a reply on Unable To Find Socket Transport Starttls

I tried both on the .env file:

MAIL_DRIVER=smtp
MAIL_HOST=box.kolbach.biz
MAIL_PORT=587
MAIL_USERNAME=xxxxxxxxxx
MAIL_PASSWORD=xxxxxxxxxx
MAIL_ENCRYPTION=TLS

I get different errors: with TLS:

Production.ERROR: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed {"exception":"[object] (ErrorException(code: 0): stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed at /var/www/fsmadm.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:94)

with STARTTLS:

[2018-09-25 00:08:41] Production.ERROR: Connection could not be established with host box.kolbach.biz [Unable to find the socket transport "starttls" - did you forget to enable it when you configured PHP? #32686] {"exception":"[object] (Swift_Transpor$
[stacktrace]

dan3460 left a reply on Unable To Find Socket Transport Starttls

Found the directory where the extensions are stored: /usr/lib/php/20160303. There is a bunch of .so files but php_openssl.so is not there.

dan3460 left a reply on Unable To Find Socket Transport Starttls

Sorry, running ubuntu.

23 Sep
8 months ago

dan3460 started a new conversation Unable To Find Socket Transport Starttls

I'm testing a new mail server provider which requires a smtp connection with STARTTLS. Is showing me the following message:

[Unable to find the socket transport "starttls" - did you forget to enable it when you configured PHP? #32686]

I fund in php.ini php_openssl which i un-commented but did not solved the problem and when taking the server up or down gave an error saying that could not find php_openssl.dll.

Also reading on the web seem to indicate that un-commenting php_openssl only works on windows. Does anyone knows how to solve this issue?

21 Sep
8 months ago

dan3460 left a reply on Delete File After Viewing Or Disconecting

In case any one reads this post. I took @Cronix idea and created a Queue to delete the file. Actually was quite easy. I created a job called DeleteFiles to which i pass the URL of the file, x amount of seconds latter the file is gone. I will put the number of seconds on a setup file so it can be controlled and fine tuned.

20 Sep
8 months ago

dan3460 left a reply on Delete File After Viewing Or Disconecting

Understood and agree. Thanks for the help.

dan3460 left a reply on Delete File After Viewing Or Disconecting

Thanks Cronix, sound very interesting.

dan3460 started a new conversation Delete File After Viewing Or Disconecting

I'm presenting a PDF file on a iframe to the user. This file is stored on the storage folder and i make a copy to the public folder for presentation. I'm trying to figure out the best way to delete such file after the user has viewed the file or it has disconnected. The way that i have solved for now is to delete any file that is X hours old. What i would like to do is if the user leaves the page, delete the file. Or if the user logout, delete the file. Or if the user looses connection, delete the file.

13 Sep
8 months ago

dan3460 left a reply on Method Not Allowed, But Is There

I feel stupid!!! you are complete right.

Time to go for a drink!!

Thank you sir,

dan3460 started a new conversation Method Not Allowed, But Is There

Normally i get this type of error when trying to hit as route because of misspelling or the method is the wrong one. I have been stuck on this one for more than an hour and i do not understand what is going on. Here is the section where i set up the route:

Route::get('/tables/languageNew', '[email protected]');
Route::post('/tables/languageNew', '[email protected]');
Route::get('/tables/languageEdit/{languageID)', '[email protected]');
Route::put('/tables/languageEdit/{languageID}', '[email protected]');
Route::delete('/tables/language/{languageID}', '[email protected]');

here is the call to the route:

                            <td class="d-flex justify-content-between">
                                <a href="/tables/languageEdit/{{$language->language_id}}" class="btn btn-sm btn-info">Edit</a>
                                <form action="/tables/language/{{$language->language_id}}" method="POST">
                                    @csrf @method('delete')
                                    <button type="submit" class="btn btn-sm btn-danger">Delete</button>
                                </form>
                            </td>

I'm calling the edit between the a tags.

and here are the headers from Chrome tools:

Request URL: http://127.0.0.1:8000/tables/languageEdit/2
Request Method: GET
Status Code: 405 Method Not Allowed
Remote Address: 127.0.0.1:8000
Referrer Policy: no-referrer-when-downgrade

What i'm not seeing? Thanks for the help,

11 Sep
8 months ago

dan3460 left a reply on Reading The Upload % Of A File.

I'm not using axios. I think!. On the controller i grab the file name and use the following to upload the file:

$request->file("filename")->store('folderName");

With that there is a % shown on the bottom left of the browser showing the progress of the upload.

10 Sep
8 months ago

dan3460 started a new conversation Reading The Upload % Of A File.

When i upload files on the application that i'm building there is a % that shows up at the bottom left hand side of the window. How can i grab that number?

dan3460 left a reply on Update Table Depending On Selection

In case someone wants to know. I used datatables functionality to do this. I placed a select for the shippers. I created a function with JQuery that reads what has been selected and pass that value to the datatable.

09 Sep
8 months ago

dan3460 started a new conversation Update Table Depending On Selection

I'm creating a page that manages growers that belong to a shipper. At the top of the page is a select, then is a table that displays the growers that belong to the selected shipper. In the old application we used JQuery and Javascript to redraw the table after a selection. This time i'm using a JQuery Datatable extension to format and give functionality to the tables. Is there a function in Laravel that can do this more easily than a bunch of javascrip functions? I think Datatable has some of that functionality but i need to read more about it. Any ideas how to do this?

08 Sep
8 months ago

dan3460 left a reply on Massing $request To A Markdown

I just discovered my error, when assigning the the variable in the constructor i put a "$" on the $this key word.

Should be:

$this->request = $request;

dan3460 started a new conversation Massing $request To A Markdown

At the end of the function that creates a new user i'm passing the request to a mail object:

        $user->expire = $request->expire;
        $user->active = $request->active;
        $user->settings_id = $settings->settings_id;
        $user->save();

        Mail::to($user)->send(new SystemNewUser($request));

        return redirect('/systemUser/manager');

here is the mail object where i tried to capture the $request to pass to the markdown:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Http\Request;

class SystemNewUser extends Mailable
{
    use Queueable, SerializesModels;

    public $request;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(Request $request)
    {
        $this->$request = $request;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('mails.systemNewUser');
    }
}

I think i'm not seeing the $request at the markdown level, printing the first name of the user $request->first generates an error of variable not fund. I used the same variable when creating the user and that works fine. I hope i explained ok.

03 Sep
8 months ago

dan3460 left a reply on Displaying A File On The Browser That Is Under The Storage Folder

Starting to remember the problem that we have the first time. When you use the download function it just download the file. In chrome shows on the bottom of the page where you can click and will open on a new tab. That is not the behavior that we are looking for. When the user clicks on the view button, we want the document to show up on the same page on a little iframe. To be able to push something on a iframe has to be publicly available, i think. That is why we grabbed a copy and put it on a temporary file under the public folder.

dan3460 started a new conversation Displaying A File On The Browser That Is Under The Storage Folder

I'm revamping an application that stores and display pdf files. When a file is uploaded is store under the storage folder which is not accessible from the browser. That is good. In the old application when an authenticated user wanted to see the file, we made a copy to a temporary folder under the public folder, from where it was uploaded to a . After reading the temporary file was deleted.

Is there another way to do this? I was reading about a function Storage::setVisibility, maybe i thought you can turn the visibility on and off to allow for the browser to read the file. But i don't know if that would work.

01 Sep
8 months ago

dan3460 left a reply on Company Change At Nav Level

Thanks for the answer, that is exactly what i was looking for. I'm revamping an old application so i'm limited on the name of the columns. The only table on the data base that has 'id' for the index is the users table. All other tables has "tableName_id" as the index. The assignment table looks like this:

assignment_id
id  <<-- the user
company_id

There are some other information fields that are not important for this example.

Thank you again

31 Aug
8 months ago

dan3460 started a new conversation Company Change At Nav Level

I have users that can enter information for different companies on a application. So i put a dropdown at the nav level which can be filled (foreach loop) from the controller that calls the index.blade, with something like this:

$companies = Assignment::where('id',Auth::user()->id)->get()

return view(user.index, compact('companies')

I have not tried it yet, but i think it should work. My question is: every time that i call a new view i will have to add the $companies and pass that to the view. Is there like a global way to do this?

29 Aug
8 months ago

dan3460 left a reply on Bootstrap Behaves Different From Developing And Testing Web Site

Thanks for the help. Last time that i worked on the system i had setup git to ignore some files, why? i don't know. fixed the git ignore and now is working.