mardi 1 septembre 2020

Laravel QUEUE can save status of a failed mail server? or cache of failed jobs?

Some jobs was created between my mail server was offline.

And got that exception:

production.ERROR: Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients

Now my mail server is running and my new jobs are done correctly. But my olds failed jobs trying to execute and get the same exception:

production.ERROR: Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients

Laravel save in any place the state of the mail server or cache of the old jobs?

I using : php: 7.1.3 laravel/framework: 5.8



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/34UgXF2
via IFTTT

Laravel - get last time a table was updated

I am interested in getting the last time a table was updated (which is not necessarily the newest entry - entries might be deleted as well).

In SQL, the solution is easy:

SELECT UPDATE_TIME FROM information_schema.tables
WHERE  TABLE_SCHEMA = 'myDb' AND TABLE_NAME = 'myTable';

However, the only way I manage to do so is to create a new connection.
Assume that my connection is called mysqlConn, my new conenction will look like:

'mysqlConnScheme' => [
    'driver'      => *** same as mysqlConn ***,
    'host'        => *          - " -        *, 
    'port'        => *          - " -        *, 
    'username'    => *          - " -        *, 
    'password'    => *          - " -        *, 
    'database'    => 'information_schema',
],

Then I can retrieve it by:

$updateTime = DB::connection('mysqlConnScheme')
    ->setDatabaseName('information_schema')
    ->table('tables')
    ->select('UPDATE_TIME')
    ->where('TABLE_SCHEMA', '=', 'myDb')
    ->where('TABLE_NAME', '=', 'myTable')
    ->first();

I wonder if there is any way to do so without creating another connection.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32LORt1
via IFTTT

Update multiple values at once in Laravel using Eloquent

I have database table structure like:

   id       | column1 |  column2 | column n 

rowid1  -         -         -        -
rowid2  -         -         -        -
rowidn  -         -         -        -

Now i have multiple id and column names i want to update row with id using some sort of batch operations.



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

SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE'

could not find driver (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

I tried all the previous post solution :- Artisan migrate could not find driver sone one can help me to come out of this problem



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32JlSGq
via IFTTT

Method App\\Http\\Controllers\\Controller::show does not exist

I just have upgraded one of my project from laravel version 5.2 to 7.1 But now I have started getting following error

Method App\\Http\\Controllers\\Controller::show does not exist.

I know there is not a function named show in my controller class. But if there is any way to trigger custom named method instead of show() while declaring resource attribute in web.php file. Here is my resource declaration in web.php

Route::resources([
      'first', 'FirstController',
      'second','SecondController'
]);

Can I make some customization to tackle this situation.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3jz5ZJc
via IFTTT

Laravel | How can i add an UploadedFile to $request->files manually

I want to upload a file which is already there in storage directory using code I want to merge that with my request.

can anyone help me how can I upload a file by code by passing $request->file manually to request?



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

lundi 31 août 2020

customer guard is not accessible in package's routes in laravel?

I have two guards in project default web and customer .both works fine. in project route when I check Auth::guard('customer')->check() it shows me true but at the same time when check it in my package's controller which is present inside vendor directory it shows me false . In the result it doesn't allow user to visit the route.

Strange thing is that when i use one guard at a time it work fines. but i cant use both at a same time. it also work fine when use different route for both guards I dont know why customer guard is not authenticated in package

package's routes

<?php

Route::group(['namespace' => 'Coldxpress\Ticket\Http\Controllers'], function () {
    Route::group(['middleware' => 'web'], function () {
        
        Route::group(['prefix' => 'tickets','middleware'=>['auth','auth:customer']], function () {
            Route::get('/{filter}', 'TicketController@index')->name('tickets.index');
            Route::post('/store', 'TicketController@store')->name('tickets.store');
            Route::post('/update', 'TicketController@updateTicket')->name('tickets.update');
            Route::get('/filtered_tickets/{filter}', 'TicketController@filteredTickets')->name('tickets.filtered');
            Route::get('/get_replies/{ticket_id}', 'TicketController@getReplies')->name('tickets.replies');
            Route::post('/store_reply/{ticket_id}', 'TicketController@storeReply')->name('tickets.store.reply');
            Route::post('/store_replies_image', 'TicketController@uploadReplyImage');
        });
        
    });
   
});

Package's Service Provide

<?php

namespace Coldxpress\Ticket;

use App\Models\Admin\Customer;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class TicketServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to your controller routes.
     *
     * In addition, it is set as the URL generator's root namespace.
     * 
     * @var string
     */
    protected $namespace = 'Coldxpress\Ticket\Http\Controllers';

    public function boot()
    {
        dd(\Auth::guard());
        //dd(asset('ticket/assets/plugins/global/plugins.bundle.css'));
        $this->loadRoutesFrom(__DIR__ . '/routes/web.php');
        // $this->loadRoutesFrom(__DIR__ . '/routes/api.php');
        $this->loadViewsFrom(__DIR__ . '/resources/views', 'ticket');
        $this->loadMigrationsFrom(__DIR__ . '/database/migrations');
        $this->mapApiRoutes();

        //      $this->publishes([__DIR__.'/resources/ticket' => public_path()],
        //        'views');

    }

    public function register()
    {
    }


    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::prefix('api')
            ->middleware('api')
            ->namespace($this->namespace)
            ->group(__DIR__ . '/routes/api.php');
    }
}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3gMZzo9
via IFTTT