mercredi 27 septembre 2017

heroku [Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Faker\Factory' not found

I have problems with heroku when I do : "heroku run php artisan db:seed"

 $ heroku run php artisan db:seed
 Running php artisan db:seed on jaquenews... starting, run.7385 (Free)
 Running php artisan db:seed on jaquenews... connecting, run.7385 (Free)
 Running php artisan db:seed on jaquenews... up, run.7385 (Free)
 **************************************
 *     Application In Production!     *
 **************************************

 Do you really wish to run this command? (yes/no) [no]:
 > yes
 yes

 Seeding: UsersTableSeeder

 [Symfony\Component\Debug\Exception\FatalThrowableError]
 Class 'Faker\Factory' not found



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wVVBTf
via IFTTT

Apache2 Ubuntu Default Page laravel homestead up

when I do vagrant up or homestead up

and open browser the apache default page is displayed

Ubuntu Logo Apache2 Ubuntu Default Page It works! This is the default welcome page used to test the correct operation of the Apache2 server after installation on Ubuntu systems. It is based on the equivalent page on Debian, from which the Ubuntu Apache packaging is derived. If you can read this page, it means that the Apache HTTP server installed at this site is working properly. You should replace this file (located at /var/www/html/index.html) before continuing to operate your HTTP server. If you are a normal user of this web site and don't know what this page is about, this probably means that the site is currently unavailable due to maintenance. If the problem persists, please contact the site's administrator. Configuration Overview Ubuntu's Apache2 default configuration is different from the upstream default configuration, and split into several files optimized for interaction with Ubuntu tools. The configuration system is fully documented in /usr/share/doc/apache2/README.Debian.gz. Refer to this for the full documentation. Documentation for the web server itself can be found by accessing the manual if the apache2-doc package was installed on this server. The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows: /etc/apache2/ |-- apache2.conf | `-- ports.conf |-- mods-enabled

the solution is to run commande line: (homestead or vagrant)

  1. homestead ssh
  2. sudo nginx -t -c /etc/nginx/nginx.conf
  3. sudo service nginx start
  4. exit
  5. homestead up


from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xFTOW5
via IFTTT

pass the controller fetched value in blade file to query

I have fetch ed the controller value in blade file as .I want to pass the value to query in same blade file .

sample.blade.php


$test=db::table('department')->where('department.parent_department','=','')->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fP8dpw
via IFTTT

Blade Custom Directive receives value as a string instead of its original value

I'm newbie in Laravel, researched but i can't find a solution for something so simple. I created a custom directive namely "test" for Blade in the app/Providers/AppServiceProvider.php file:

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

use Illuminate\Support\Facades\Blade;

class AppServiceProvider extends ServiceProvider
{
    /**
    * Bootstrap any application services.
    *
    * @return void
    */
    public function boot()
    {
        Blade::directive('test', function($expression){
            // Dumps as well: "$var1 , $var2"
            dump($expression);

            list($arg1, $arg2) = explode(',',str_replace(['(',')',' '], '', $expression));

            // will print: $var1 , $var2
            return "<?php echo '$arg1 , $arg2'; ?>";
        }); 
    }

    /**
    * Register any application services.
    *
    * @return void
    */
    public function register()
    {
        //
    }
}

Theoretically, its usage should be very simple inside a blade template, however as shown in the following example the directive is printing the literal value of the arguments e.g $var1 is printing $var1 instead of its real content "test a":

<?php 
    $var1 = 'test a'; 
    $var2 = 'test b'; 
?>

// Prints: $var1 , $var2
// Expected: "test a test b"
@test($var1 , $var2)

Already tried to print their values using multiple tags:

@test( , )
@test( {!! $var1 !!}, {!! $var2 !!})
@test( }, })

But doesn't work neither, the directive is always receiving the name of the variable instead of its content. What am I ignoring in this case? Any help is appreciated. I am using Laravel 5.4.*.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wjyMt9
via IFTTT

Using Laravel Blade in Javascript with Dropzone -> Max total Files uploaded

I'm using Dropzone within my Laravel application. In Dropzone, I can limit the maximum number of files uploaded at one time. However, after refreshing the page, users can then upload more photos.

Dropzone.options.addPhotosForm = {
  maxFiles: 5,
};

I am able to remove this ability on the front end by counting the number of photos that this user has already uploaded for this page and then changing the class to display:none; and giving a warning as follows:

<div class="@if(count($rooms->photos) >= 10) d-none @endif">
  <form action="" method="POST" class="dropzone" id="addPhotosForm">
    
  </form>
</div>
<div class="@if(count($rooms->photos) < 10) d-none @endif">
  <p>You have uploaded  photos. This is too many.</p>
</div>

The problem here is that if a user has uploaded 9 photos, they can then upload 5 more and get a total of 14 instead of 10 photos, which is the desired maximum. Furthermore, if the user is malicious, they can simply go to Inspect Elements, remove the display: none; style and upload as many photos as they want.

I would like to disable a user's ability to upload more photos within the Javascript and I am trying to use Laravel's Blade to do this, but with some problems.

So, I have a few questions:

1) Can I use Blade within Javascript?

I have tried this by, for example using:

 var count = count($rooms->photos);

I then get the error,

Uncaught SyntaxError: Unexpected token >

If I could get this to work, my idea was to do this within the Dropzone options.

init: function(file) {
  if (count >= 10){
      myDropzone.removeFile(file);
  };

2) Is there be a better way to limit all uploads to Dropzone?
I have tried a few of the suggestions here on SO with no luck.

Thanks!

Brad



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2xK8wM5
via IFTTT

How can I configure an SCP/SFTP file storage?

My Laravel application should copy files to another remote host. The remote host is accessible only via SCP with a private key. I would like to configure a new file storage (similarly as FTP), but I have found no information, how to define an SCP driver.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hxmRFz
via IFTTT

Know if Mail in queue has been sent Laravel 5.4

I have a webapp built with laravel 5.4. Now I have developed a function that send to all users a comunication.

So i have create a class Mailable:

class Comunication extends Mailable
{
    use Queueable, SerializesModels;

    private $data;
    private $recipient;
    private $fromR;
    private $subjectR;
    private $template;

    public function __construct($template, $data,$recipient,$from,$subject)
    {
        $this->data = $data;
        $this->recipient = $recipient;
        $this->fromR = $from;
        $this->subjectR = $subject;
        $this->viewData = $data;
        $this->template = $template;
    }
    public function build()
    {
        return $this->from($this->fromR)->to($this->recipient)->subject($this->subjectR)->view( $this->template, $this->viewData);
    }

And in my controller I have a function send like:

foreach ($users as $user){
   Mail::queue(new Comunication('mail.comunication', array("user"=>"test"), $user->email, 'mytest@test.it', "subject"));
}

And it works and put a mail in my table Jobs on db, but I would know if is possible check, when I run:

php artisan queue:listen

If mail is real sent or finish in failed jobs.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wUb5vW
via IFTTT