Navigation

    Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Categories
    3. Web Development
    4. Laravel Framework
    • Problem on migration : products category foreign key

      Kasun Rathnayake

      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-constraint

      Cannot 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'); } }
      Laravel Framework
    • Laravel Auth user

      Nubelle

      I have two Laravel applications .

      example :

      one application is helpdesk application
      second application is document management system

      If user login with helpdesk application , can I share the user object with document management system.

      Laravel Framework
    • Laravel IPG Integration

      Anushka Deshan Dharmasena

      Hi All

      Laravel Walin IPG integrate karapu kawuruhari innawada. Mokadda Hodama widyta lankawe payment accept karanna

      Laravel Framework
    • Laravel Controller eka use karala wena site ehekata POST method eken Data Post

      rithu20
      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> </form

      Uda 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 one

      Payhere 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?
      Laravel Framework
    • How to properly integrate Payhere to Laravel ? Need Help

      Coding Labs

      can you help me the integrate payhere to laravel

      Laravel Framework
    • BOC payment gateway to Laravel ?

      Gayan Priyankara

      Has any one tried to implement BOC payment gateway to Laravel ?

      Laravel Framework
    • Laravel 5.8 Auth::guard($guard)->check() always return false

      hashan

      I have two separate logins using guards which customer & adminuser. I have checkRole middleware for adminuser login and it works perfectly. I used guest middleware (RedirectifAuthenticated) to customer login. When customer login check with Auth::guard($guard)->check() it always returns false. But Auth::guard('customer')->attempt returns true. I can't find a solution.

      here is the login controller for customer

      class LoginController extends Controller { use AuthenticatesUsers; public function __construct() { $this->middleware('guest:customer')->except('customerlogout'); } //login the customer public function customerLogin(Request $request) { $email = $request->get('email'); $password = $request->get('password'); //Getting user inputs and authenticate the customer $status = Auth::guard('customer')->attempt([ 'email' => $email, 'password' => $password ] ); //Check login if ($status) { //if login pass,redirect to customer account page return redirect()->intended('/customer_account'); }else{ //if login fail,redirect back to home page return redirect()->back(); } } //logout the customer public function customerlogout(Request $request) { Auth::guard('customer')->logout(); $request->session()->flush(); return redirect('/index'); } }

      here is the guest middleware

      public function handle($request, Closure $next, $guard = null) { if ($guard === "customer" && Auth::guard($guard)->check()) { return redirect('/customer_account'); } if (!Auth::guard($guard)->check()) { return redirect('/index'); } return $next($request); }

      Any help is appreciated, thanks!

      Laravel Framework
    • Mage laravel website eka MongoDb cluster ekka connect kranna giyama me error eka enava. meka fix karanne kohomada ?

      Nisal Vimukthi

      ![alt text](![0_1584632797802_erro.JPG](Uploading 100%) image url)

      Mage laravel website eka MongoDb cluster ekka connect kranna giyama me error eka enava.
      laravel version eka 6 mage.

      code eka config my conf/database.php vala

      'mongodb_conn' => [ 'driver' => 'mongodb', 'dsn'=>'mongodb+srv://myusername:[email protected]/test?retryWrites=true&w=majority', 'database' => 'mydbname', ],

      .env eke code eka

      APP_NAME=My_laravel_web APP_ENV=local APP_KEY=base64:jtvoXduyfwnIB6A5pCy8Cfa9bJYRvNgMKeRFdfiYYyc= APP_DEBUG=true APP_URL=http://localhost LOG_CHANNEL=stack DB_CONNECTION=mongodb_conn' DB_HOST=xxxx-shard-00-00-uggj0.mongodb.net DB_PORT=27017 DB_DATABASE=mydbname DB_USERNAME=myusername DB_PASSWORD=mypassword BROADCAST_DRIVER=log CACHE_DRIVER=file QUEUE_CONNECTION=sync SESSION_DRIVER=file SESSION_LIFETIME=120 REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379

      meka fix karanne kohomada

      error message eka

      php artisan serve InvalidArgumentException : Database [mongodb_conn'] not configured. at C:\xampp\htdocs\bloodDonation\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:152 148| // If the configuration doesn't exist, we'll throw an exception and bail. 149| $connections = $this->app['config']['database.connections']; 151| if (is_null($config = Arr::get($connections, $name))) { > 152| throw new InvalidArgumentException("Database [{$name}] not configured."); 153| } 154| 155| return (new ConfigurationUrlParser) 156| ->parseConfiguration($config); Exception trace: 1 Illuminate\Database\DatabaseManager::configuration("mongodb_conn'") C:\xampp\htdocs\bloodDonation\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:115 2 Illuminate\Database\DatabaseManager::makeConnection("mongodb_conn'") C:\xampp\htdocs\bloodDonation\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:86 Please use the argument -v to see more details.
      Laravel Framework
    • Laravel Web site ekak Node.js Api ekak ekka connect kranne kohomada ?

      Nisal Vimukthi

      Laravel walin develop karapu web site ekak Node.js Api ekata connect kranna ona CURD operations karanna and authentication ekata. denata website ekata local mysql db ekata thama connect krala thiyenne . mata denaganna ona website eken http requests yavanne komada kiyala API ekata authentications ekka sessions ema weda karanna ?

      Laravel Framework
    Log in to post
    • Newest to Oldest
    • Oldest to Newest
    • Most Posts
    • Most Votes
    • Nisal Vimukthi

      Laravel Web site ekak Node.js Api ekak ekka connect kranne kohomada ?
      api laravel mongodb • • Nisal Vimukthi

      8
      1
      Votes
      8
      Posts
      65
      Views

      dev_lak

      @Nisal-Vimukthi puluwan

    • Nisal Vimukthi

      Mage laravel website eka MongoDb cluster ekka connect kranna giyama me error eka enava. meka fix karanne kohomada ?
      database laravel mongodb • • Nisal Vimukthi

      2
      1
      Votes
      2
      Posts
      45
      Views

      dev_lak

      bro oyage env eke DB_CONNECTION=mongodb_conn' kyna eke anthimata ' ekak wadila, ekai aula

    • hashan

      Laravel 5.8 Auth::guard($guard)->check() always return false
      authentication laravel login php • • hashan

      4
      0
      Votes
      4
      Posts
      173
      Views

      root

      @hashan

      check this out

      https://laracasts.com/discuss/channels/laravel/why-my-custom-authentication-with-guard-not-working

    • Gayan Priyankara

      BOC payment gateway to Laravel ?
      laravel payment gateway php • • Gayan Priyankara

      2
      0
      Votes
      2
      Posts
      56
      Views

      root

      documentation ekak thiyenawa nam danna methana balamu develop karanna simple package ekak

    • rithu20

      This topic is deleted!
      • rithu20

      1
      0
      Votes
      1
      Posts
      1
      Views

      No one has replied

    • Coding Labs

      How to properly integrate Payhere to Laravel ? Need Help
      laravel payhere payment gateway • • Coding Labs

      11
      0
      Votes
      11
      Posts
      137
      Views

      Nano

      @Coding-Labs can you specify the error? you need to skip csrf token checking for that return url

    • rithu20

      Laravel Controller eka use karala wena site ehekata POST method eken Data Post
      html javascript json laravel php • • rithu20

      8
      0
      Votes
      8
      Posts
      65
      Views

      rithu20

      kohomd check karanne? 😞

    • Anushka Deshan Dharmasena

      Laravel IPG Integration
      laravel payment gateway visa • • Anushka Deshan Dharmasena

      16
      1
      Votes
      16
      Posts
      79
      Views

      Nubelle

      @Kasun-Rathnayake Bro you have to request API doc from them.

    • Nubelle

      Laravel Auth user
      laravel • • Nubelle

      3
      0
      Votes
      3
      Posts
      25
      Views

      Nubelle

      @root Thanks bro , let me try

    • Kasun Rathnayake

      Problem on migration : products category foreign key
      laravel • • Kasun Rathnayake

      4
      1
      Votes
      4
      Posts
      14
      Views

      Nubelle

      @kasun-rathnayake change data type of category_id as unsignedBigInteger()

    • 1 / 1
    • Privacy
    • Terms & Conditions
    • Donate
    • Contact Us

    © Copyrights and All right reserved Lanka Developers Community

    Made with in Sri Lanka

    | |