mardi 17 octobre 2017

Laravel 5.3 - Authentication is broken

About a year ago we took over an existing Laravel 5.1 site and upgraded to 5.3 - We recently became aware that an admin panel that was part of the old site no longer works (or unable to authenticate).

The original routes file contains the following:

//Login
 Route::controllers([
     'auth' => 'Auth\AuthController',
     'password' => 'Auth\PasswordController',
 ]);
//Admin
//Dashboard
Route::group(array('prefix' => 'admin', 'middleware' => 'auth'), function() {

    //Dashboard
    Route::get('/webadmin', array('as' => 'dashboard', 'uses' => 'Admin\DashboardController@index'));

});

Which after the upgrade stopped working as I understand the Route::controllers method was depreciated. We changed it to the following as I understand that was the replacement:

//Login
Route::resource('password','Auth\PasswordController');
Route::resource('auth','Auth\LoginController');
//Admin
//Dashboard
Route::group(array('prefix' => 'admin', 'middleware' => 'auth'), function() {

    //Dashboard
    Route::get('/webadmin', array('as' => 'dashboard', 'uses' => 'Admin\DashboardController@index'));
});

However, when we access the sites admin panel by http://ift.tt/2yp8ycW we are automatically redirect to example.com/login which then displays the dreadful NotFoundHttpException in compiled.php

This leads me to believe that the authentication middleware is not registered correctly. I am not sure what the correctly route is to take so will gladly appreciate any assistance :)



via Chebli Mohamed

Menu controller is not found laravel 5.5.check my code please and help me where am wrong

check my code please and help me where am wrong. am try to get date from Menu and SubMenu table using Eloquent model instead of join etc. my Menucontroller

class MenuController extends Controller
{
// Where ever you want your menu
    public function menu()
    {

        $menu = Menu::all()->load('submenu');

        return view('menu',['users' => $menu]);
    }
}

my menu Model is

use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{


    public function submenu()
    {
        return $this->hasMany(SubMenu::class);
    }
}

my submenu model is

use Illuminate\Database\Eloquent\Model;
class SubMenu extends Model
{
    public function menu()
    {
        return $this->belongsTo(Menu::class);
    }
}



via Chebli Mohamed

Package egeloen/http-adapter is abandoned, you should avoid using it, How to fix on composer update

I'm using a PHP Laravel website on a Ubuntu server,

Package egeloen/http-adapter is abandoned, you should avoid using it. Use php-ht
tp/httplug instead.

the above message appears when I try to run composer update. I also tried composer require egeloen/http-adapter , but it shows new error massage now as follows.

Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1 - infusionsoft/php-sdk 1.2.2 requires egeloen/http-adapter ~0.6 -> no matchi
ng package found. - infusionsoft/php-sdk 1.2.2 requires egeloen/http-adapter ~0.6 -> no matchi
ng package found. - infusionsoft/php-sdk 1.2.2 requires egeloen/http-adapter ~0.6 -> no matchi
ng package found. - Installation request for infusionsoft/php-sdk == 1.2.2.0 -> satisfiable by
infusionsoft/php-sdk[1.2.2].

I'm new for these things,Thank You



via Chebli Mohamed

FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found

            PaymentController.php 

            <?php 
            namespace App\Http\Controllers;
            use Paypalpayment;
            class paymentController extends Controller 
            {
                private $_apiContext;
                function __construct()
                {
                    $this->_apiContext = Paypalpayment::apiContext(config('paypal_payment.Account.ClientId'
                    ), config('paypal_payment.Account.ClientSecret'));

                }
                public function store()
                {
                    $addr= Paypalpayment::address();
                    $addr->setLine1("3909 Witmer Road");
                    $addr->setLine2("Niagara Falls");
                    $addr->setCity("Niagara Falls");
                    $addr->setState("NY");
                    $addr->setPostalCode("14305");
                    $addr->setCountryCode("US");
                    $addr->setPhone("716-298-1822");
                    $card = Paypalpayment::creditCard();
                    $card->setType("visa")
                        ->setNumber("4758411877817150")
                        ->setExpireMonth("05")
                        ->setExpireYear("2019")
                        ->setCvv2("456")
                        ->setFirstName("Joe")
                        ->setLastName("Shopper");
                    $fi = Paypalpayment::fundingInstrument();
                    $fi->setCreditCard($card);
                    $payer = Paypalpayment::payer();
                    $payer->setPaymentMethod("credit_card")
                        ->setFundingInstruments(array($fi));
                        $item1 = Paypalpayment::item();
                    $item1->setName('Ground Coffee 40 oz')
                            ->setDescription('Ground Coffee 40 oz')
                            ->setCurrency('USD')
                            ->setQuantity(1)
                            ->setTax(0.3)
                            ->setPrice(7.50);
                    $item2 = Paypalpayment::item();
                    $item2->setName('Granola bars')
                            ->setDescription('Granola Bars with Peanuts')
                            ->setCurrency('USD')
                            ->setQuantity(5)
                            ->setTax(0.2)
                            ->setPrice(2);
                    $itemList = Paypalpayment::itemList();
                    $itemList->setItems(array($item1,$item2));
                    $details = Paypalpayment::details();
                    $details->setShipping("1.2")
                            ->setTax("1.3")
                            //total of items prices
                            ->setSubtotal("17.5");

                    //Payment Amount
                    $amount = Paypalpayment::amount();
                    $amount->setCurrency("USD")
                            // the total is $17.8 = (16 + 0.6) * 1 ( of quantity) + 1.2 ( of Shipping).
                            ->setTotal("20")
                            ->setDetails($details);


                    $transaction = Paypalpayment::transaction();
                    $transaction->setAmount($amount)
                        ->setItemList($itemList)
                        ->setDescription("Payment description")
                        ->setInvoiceNumber(uniqid());



                    $payment = Paypalpayment::payment();

                    $payment->setIntent("sale")
                        ->setPayer($payer)
                        ->setTransactions(array($transaction));
                        try
                     {

                       $payment->create($this->_apiContext);
                          }
                     catch (\PPConnectionException $ex) 
                     {
                        return  "Exception: " . $ex->getMessage() . PHP_EOL;
                        exit(1);
                    }

                    dd($payment);
                } 
            }

            ?>

        Composer.json 
        {
            "name": "laravel/laravel",
            "description": "The Laravel Framework.",
            "keywords": ["framework", "laravel"],
            "license": "MIT",
            "type": "project",
            "require": {
                "php": ">=5.5.9",
                "laravel/framework": "5.1.*"
                 "laravelcollective/html": "5.1.*"
               "anouar/paypalpayment" : "~1.0"
            },
            "require-dev": {
                "fzaninotto/faker": "~1.4",
                "mockery/mockery": "0.9.*",
                "phpunit/phpunit": "~4.0",
                "phpspec/phpspec": "~2.1"
            },


        FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
        i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found


        FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
        i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
    FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
        i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
        i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
    FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found
        i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found

FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found i m getting this error FatalErrorException: Class 'anouar\Paypalpayment\PaypalpaymentServiceProvider' not found



via Chebli Mohamed

lundi 16 octobre 2017

¿How to capture a value from a select in the login view and declare it global?

I can not manage to capture a value from a combo from my login view, to use it in the user registry. I am trying to use the HTTP routes methods as described in the laravel 5.1 documentation, but without any success.

Here is the combo cboFranquicias in the view of login.blade.php, whose value I want to capture to pass it to the user registry view:

<form method="POST" action="">
    {!! csrf_field() !!}
    <div class="row margin">
      <div class="input-field col s12">
    <i class="mdi-social-person-outline prefix"></i>
    <input type="text" name="usuario" id="usuario" value="" required>
    <label for="usuario" class="center-align">Usuario</label>
    </div>
  </div>
  <div class="row margin">
    <div class="input-field col s12">
      <i class="mdi-action-lock-outline prefix"></i>
      <input type="password" name="password" id="password" required>
      <label for="password">Contraseña</label>
    </div>
  </div>

 <!--COMBO TO LIST FRANQUICIAS -->
   <br><div class="input-field col m12 s12" style="right:-1%">
    {!!Form::select('Franquicias', $combo_franquicias, null, ['placeholder'=>'--Selecciona--','id'=>'cboFranquicias','name'=>'cboFranquicias'])!!} 
    {!!Form::label('Franquicias')!!}
  </div><!--END COMBO -->


  <div class="row">
      <!--ACOMODADO TAMAÑO DEl BOTON ENTRAR-->
    <div class="input-field col s12 m12">
      <button type="submit" class="btn waves-effect waves-light col s12 m12 19">Entrar</button>
    </div>
  </div>
</form>

Later, in routes.php, I declare a route that takes by the method the values entered in the login, to the function that will return the user registry view:

Route::get('registrar', 'Auth\AuthController@VistaRegistraUsuario'); Route::post('auth/login', 'Auth\AuthController@VistaRegistraUsuario');

And here is the function that returns to the user registry view in the AuthController.php file:

`public function VistaRegistraUsuario(Request $request)
  {
 $id_franquicia = $request->input('cboFranquicias');
 //dd($id_franquicia);
 $cargos = cargos_usuarios::lists('descripcion', 'id');

 return view('auth.register', compact('cargos','id_franquicia'));
  }`

However, the value never reaches the user registry view, which should pass to fill my hidden input in that view register.blade.php:

{!!Form::input('Id_franquicia', $id_franquicia, null, ['type'=>'hidden','name'=>'id_franquicia', 'id'=>'id_franquicia'])!!}

How do I capture the value of the franquicias combo in the login view and save it to a global variable, to pass that value to the user registration view?



via Chebli Mohamed

samedi 14 octobre 2017

Cancel a running Laravel job

Because of long running jobs (~3hrs, multiple jobs, cannot just cancel all of them), I am attempting to stop/cancel a single running Laravel job.

The job class is prepared and sent to the queue with $this->dispatch($job).

Using database for the queue driver with supervisor installed, which was setup as stated in the Laravel documentation.

Any help in the right direction would be appreciated, thanks.



via Chebli Mohamed

vendredi 13 octobre 2017

Email Sending Using IBM Notes in Laravel

Good day.

I was tasked to send an email using IBM Notes. I am using Laravel and hardly know where to start. I have some basic knowledge about sending email using gmail but not with IBM Notes email.

Any help would be appreciated. Thanks.



via Chebli Mohamed