@Nisal-Vimukthi puluwan
-
-
-
In this article, i'll explain how to redirect HTTP to HTTPS in Laravel. Whether you're using Laravel 6, 7, 8, 9 or 10 we've got you covered!
We have to modify AppServiceProvider boot method, i also disable HTTPS redirect in local.
in app/Providers/AppServiceProvider.php.
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Pagination\Paginator; class AppServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public function register() { } /** * Bootstrap any application services. * * @return void */ public function boot() { if ($this->app->environment('production')) { \URL::forceScheme('https'); } Paginator::useBootstrap(); } } -
Software testing වලදි cypress වැදගත් වෙන්නේ ඇයි? Cypress කියනේ මොකද්ද? කියලා අද ඔයාලාට දැන ගන්න පුලුවන් .
Cypress කියලා කියන්නේ සම්පුර්ණයෙන් ම Javascript මත පදනම් වු testing tool එකක්. Cypress අපි භාවිතා කරන්නේ Automation testing වලදි. මේ Cypress ගොඩක් ජනප්රිය වෙලා තියෙන්නේ Unit testing , Integration testing සහ End to end testing සදහා යි.
Cypress built කරලා තියෙන්නේ Node.js වලින් නිසා එහි node modules අන්තර්ගත වෙනවා. එනිසා Cypress වල testcases ලියන්න භාවිතා කරන්නේ javascript. ඒ නිසා Cypress use කරනවා නම් js ගැන හොද අවබෝධයක් තියෙන එක ගොඩක් හොදයි.
Cypress භාවිතා කරන්නේ ඇයි කියලා අපි බලමු.
1.Easy-to-use interface
Cypress වල interface එක ඉක්මනට තේරුම් ගැනිමට පහසු නිසා ඉක්මනින්ම හා කාර්යක්ශම ව testing කරන්න පුලුවන් .
2.Built-in Support for assertion library
Cypress වල built-in support සදහා assertion libraries වේ. මෙය web testing සදහා නමය්ශිලි බවක් දක්වයි.3.Javascript framework-friendly
Run natively in your browser
Cypress JS framework එක මත built කර ඇති නිසා මෙහි testcases සියල්ලම Js වලින් ලියයි. එබැවින් cypress, selenium සමග සන්සන්දනය කරන විට fast ව testing කිරිමේ හැකියාව cypress වලට ඇත.
Cypress directly browser මත run වේ.5.Debugging Live inspect with chrome Dev Tools
Chrome dev tool එකට එය enable කර ඇති නිසා directly browser එකෙන් console එක බලා ගන්න පුලුවන් .What is cypress කියන topic එක ගැන තමා මම මේ article එකේ සදහන් කලේ. Next articles වලින් මම ඔයාලට කියලා දෙන්නම් කොහොමද cypress insatalla කර ගෙන testcases ලියන්නේ, ඒ වගේම cypress කොහොමද අපේ projects වලට apply කරන්නේ කියලා..
Copy Rights
QA Journal by Ish
-
I want to Redirect to two different routes in the controller at the same time ( New blade view and LoadView pdf ).
-
guys I need a help, I deployed a laravel app inside domain/external folder and in the laravel app index.php i changed the paths to /../external/storage etc.
when I go to the domain it will redirect me to domain/external perfectly but however after I login in the laravel app the Auth module will redirect me to domain/ instead of domain/external
how to fix it,
I already tried this inside authcontroller but won't work
protected function redirectTo()
{
return '/path';
} -
-
How disable laravel multi language routes
ex
example.com/en
example.com/fr
example.com/ar -
-
-
I have small issue with Laravel application , currently I am using two database connection and I want to change the connection in whereHas method.
here is my code .
//Relation Ship Methods public function technician(){ return $this->setConnection('common_database')->belongsTo('App\User', 'technician_id'); } public function commitee(){ return $this->setConnection('common_database')->belongsTo('App\User', 'commitee_validator_id'); } //controller functions $practices->whereHas(‘technician’, function($q) use($search) { $q->where(‘first_name’, 'like', '%' . $search . '%'); }); -
on laravel8 framework , can anyone help me with this i also used ,
this way but still it doesn't work
https://stackoverflow.com/questions/22615926/migration-cannot-add-foreign-key-constraintCannot add foreign key constraint..
Error is as below SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `products` add constraint `products_category_id_foreign` foreign key (`category_id`) references `categories` (`id`)) at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678 674▕ // If an exception occurs when attempting to run a query, we'll format the error 675▕ // message to include the bindings with SQL, which will make this exception a 676▕ // lot more helpful to the developer instead of just the database's errors. 677▕ catch (Exception $e) { ➜ 678▕ throw new QueryException( 679▕ $query, $this->prepareBindings($bindings), $e 680▕ ); 681▕ } 682▕ +9 vendor frames 10 database/migrations/2021_01_19_074944_create_products_table.php:38 Illuminate\Support\Facades\Facade::__callStatic("create") +21 vendor frames 32 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))code on the migration
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateProductsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('products', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('slug')->unique(); $table->string('Short_Description')->nullable(); $table->string('description'); $table->decimal('regular_price'); $table->decimal('sale_price')->nullable(); $table->string('SKU'); $table->enum('stock_status',['instock','outstock']); $table->boolean('Featured')->default(false); $table->unsignedInteger('quantity')->default(10); $table->string('image')->nullable(); $table->string('images')->nullable(); $table->integer('category_id')->nullable()->unsigned(); $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('products'); } } -
-
-
Mage requirement eka,
Laravel Controller eka use karala wena site ehekata POST method eken Data Post karanna
<form action="anotherweb.com" method="post"> <input type="hhh" value="ccc"> ..... <button type="submit"></button> </formUda code eke tiyenne view eken another site ehekata data post karanna form eken, But mata one view eken nathuwa controller eka use karala uda code eke tiyena ekama karanna
Ai mata ehema karanna onePayhere Integration ekata, Js ekak dala payhere submit karanna puluwan but eka security less, Js code eka run wenna yana time eke page eke code eka view karala url blind karala less payment ekak karanna puluwan
$client = new GuzzleHttp\Client(); $response = $client->request('POST', 'http://httpbin.org/post', [ 'form_params' => [ 'field_name' => 'abc', 'other_field' => '123', 'nested_field' => [ 'nested' => 'hello' ] ] ]);Mama guzzle try kara but, meka wor karanne na methanadi wenne post method eka ape site eka request karana eka, Site ekata request karata wadak naha payhere support naha
Controller eka athule idan payhere or wena onema site ekakata data form ekak post karanne kohomada? -
-
This topic is deleted!
• rithu20 -
This topic is deleted!
• Kasun Rathnayake