Mehmet Ali Kandemir - Anasayfa
Mehmet Ali Kandemir Mehmet Ali Kandemir
“De ki: Hiç bilenlerle bilmeyenler bir olur mu?” Zümer sûresi , 9
×

Laravel

tek bir tablo oluşturma Laravel php Migrate

php artisan migrate:refresh --path=/database/migrations/fileName.php
2019-05-21 15:27:32 devamı ...

Laravel - multiple accounts with multiple users and separated data

https://stackoverflow.com/a/57308774/6280100
2019-08-01 17:16:49 devamı ...

Laravel .env ip değişikliği

bootstrap/cache/config.php dosyasını silin php artisan cache:clear çalıştırın
2019-11-27 14:55:13 devamı ...

Laravel Session Problemi

Laravel Session Problemi,

SSL olmadığı zaman aşağıdaki Laravel kodu session ı kaydetmiyor.

 redirect('sayfa')->with('sessionkey', deger);
2020-10-21 18:45:00 devamı ...

Docker container üzerinde laravel job, crontab, cron çalıştırma

docker exec -t <container-name> php artisan schedule:run >> /var/log/<container-name>.log 2>&1

2021-08-31 17:00:39 devamı ...

laravel rabbitmq

composer require vladimir-yuldashev/laravel-queue-rabbitmq

docker run -d --hostname my-rabbit --name rabbitmq -p 8080:15672 -p 5672:5672 rabbitmq:3-management

queue.php

'rabbitmq' => [

    'driver' => 'rabbitmq',
    'queue' => env('RABBITMQ_QUEUE', 'statusOfBill'),
    'connection' => PhpAmqpLib\Connection\AMQPLazyConnection::class,

    'hosts' => [
        [
            'host' => env('RABBITMQ_HOST', '127.0.0.1'),
            'port' => env('RABBITMQ_PORT', 5672),
            'user' => env('RABBITMQ_USER', 'guest'),
            'password' => env('RABBITMQ_PASSWORD', 'guest'),
            'vhost' => env('RABBITMQ_VHOST', '/'),
        ],
    ],

    'options' => [
        'ssl_options' => [
            'cafile' => env('RABBITMQ_SSL_CAFILE', null),
            'local_cert' => env('RABBITMQ_SSL_LOCALCERT', null),
            'local_key' => env('RABBITMQ_SSL_LOCALKEY', null),
            'verify_peer' => env('RABBITMQ_SSL_VERIFY_PEER', true),
            'passphrase' => env('RABBITMQ_SSL_PASSPHRASE', null),
        ],
        'queue' => [
            'job' => VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob::class,
        ],
    ],

    /*
     * Set to "horizon" if you wish to use Laravel Horizon.
     */
    'worker' => env('RABBITMQ_WORKER', 'default'),

],

 

.env 

QUEUE_CONNECTION=rabbitmq

 

publisher

php artisan make:job TestJob

class TestJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $data;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {

    }
}

php artisan make:command FireEvent

class FireEvent extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'fire';


    public function handle()
    {
        TestJob::dispatch(MemorizedPage::find(1)->toArray());
    }
}

 

 

 

 

Consumer

php artisan make:job TestJob

class TestJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $data;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        echo 'Event: UserCreated' . PHP_EOL;
        echo json_encode($this->data) . PHP_EOL;
        // TODO: Event User Created
    }
}

 

BankExtreJob::dispatch( $exception)->onConnection('rabbitmq')->onQueue('default');

EventServiceProvider.php
public function boot()
{
    \App::bindMethod(TestJob::class . '@handle', fn($job) => $job->handle());
}
2021-09-12 23:33:31 devamı ...

Laravel Route resource

Route::resource('users', 'UsersController');

Gives you these named routes:

Verb          Path                        Action  Route Name
GET           /users                      index   users.index
GET           /users/create               create  users.create
POST          /users                      store   users.store
GET           /users/{user}               show    users.show
GET           /users/{user}/edit          edit    users.edit
PUT|PATCH     /users/{user}               update  users.update
DELETE        /users/{user}               destroy users.destroy
2021-11-13 00:13:25 devamı ...

Laravel Telegram

https://def-studio.github.io/

https://api.telegram.org/bot<YourBOTToken>/getUpdates

2022-04-14 16:19:45 devamı ...

gitlab ci cd sample ssh

image: malikandemir/laravel-application:0.1.0

before_script:

  - apt-get update -qq

  - apt-get install -qq git

    # Setup SSH deploy keys

  - 'which ssh-agent || ( apt-get install -qq openssh-client )'

  - eval $(ssh-agent -s)

  - ssh-add <(echo "$SSH_PRIVATE_KEY")

  - mkdir -p ~/.ssh

  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'

 

deploy_staging:

  stage: build

  environment:

    name: staging

    url: example.com'

  script:

    - ssh user@host "cd /home/testpaysystem/ && git pull && npm run dev && exit"

  only:

    - main

2022-10-11 16:59:35 devamı ...