Skip to main content

Posts

Mysql columns creation in laravel

List of columns  $table->id(); // increment value $table->string('title')->comment('this is blog title'); $table->string('slug')->unique(); $table->text('short_desc'); $table->longText('description'); $table->boolean('is_published')->default(false); $table->integer('min_of_read')->nullable(true); $table->enum('status', ['Active', 'Inactive']); $table->float('discount'); $table->smallInteger('type_id'); $table->date('start_date')->nullable(); $table->timestamps(); $table->foreign('created_by')->references('id')->on('users'); // introducing foreign key $table->unsignedBigInteger('user_id'); //? $table->decimal('latitude', 9, 6)->nullable(true); // Let's say you want starting value from 1000 $table->id()->from(1000); // increment value start from 1000 ->nullabl

Vue Js (Basics 2)

Vue Data Data Now that our Vue app is hooked up to our HTML, we are ready to generate and display dynamic data. As discussed in Introduction to Vue, displaying and updating dynamic data for users is essential functionality for most front-ends. Most values on the web can change at any moment, such as the number of likes on a post or the current set of posts to display. We call constantly-changing data values like this dynamic data . We need a place to store dynamic data values so that we can still use them in our HTML even when we don’t know what their values will be at any given moment. There are many different ways to do this in Vue. The simplest way is the data property on the options object. The value of data is an object. Each key-value pair in this object corresponds to a piece of data to be displayed in the template. The key is the name of the data to use in the template and the value is the value to display when the template is rendered. We then use mustache sy

Vue JS (basics 1)

  INTRODUCTION TO VUE Creating Vue Apps Our project now has access to the Vue library. This gives us access to all of the code that will allow us to make Vue apps, web front-ends built using Vue, but doesn’t actually create one for us. We now need to write the code to actually make a Vue app. Vue makes it easy to make a new app by exporting a class called  Vue . Much like any other JavaScript class, we create instances of this class using the  new  keyword. Each of these  Vue  instances is a fully-functioning Vue app. Let’s look at an example: // app.js const app =  new Vue ({}); By invoking the  Vue  class constructor with the  new  keyword, we create a new instance of the  Vue  class which we name  app . The  Vue  constructor can set many properties on our Vue app when it is called. However, unlike many constructors, the  Vue  class does not take each of these properties as separate arguments. Rather, it only takes one argument. Vue apps require a lot of information — information t

AngularJs notes

 Two Requirements Add <script> tag pointing to angular.js Add an ng-app attribute in your HTML ng-app is an angular directive the ng is short for Angular <div ng-app> this is an example </div> To simple check that is angular js running or not, simple use {{ 4 * 4 }} in a plain html  <div ng-app> this is an example {{ 4 * 4 }} </div> siddhu

PHP encrypt and decrypt

 <?php $string_to_encrypt="Test"; $password="password"; $encrypted_string=openssl_encrypt($string_to_encrypt,"AES-128-ECB",$password); $decrypted_string=openssl_decrypt($encrypted_string,"AES-128-ECB",$password); echo $encrypted_string; echo "\n.............\n"; echo $decrypted_string; $data = [    ]; echo "<br/>"; $password = "siddhu**7**0"; foreach($data as $d) { echo $d."\n"; echo "<br/>"; echo openssl_decrypt($d,"AES-128-ECB",$password); echo "<br/>"; echo "<br/>"; } ?>

Laravel Commands

Laravale commands #Check route list php artisan route:list #Check upload files links php artisan storage:link #Check database connected or not php artisan db #Make Request file php artisan make:request YourNameRequest #Make Controller #(In this statement you used -r -> resources and -m -> model. It will create CustomersController and Customers Model files) php artisan make:controller CustomersController -r -m Customers #Make Resource file php artisan make:resource CustomersResource #To check migration files status that those files are running or not with below commands php artisan migrate:status #To check if there is any pending migrate files to run #(also this command shows us the mysql query before running migration file) php artisan migrate --pretend #To make a database table (in this example Products name as taken) php artisan make:migration create_products_table #To create a Request file php artisan make:request StoreProductRequest php artisan make:request Up

Laravel Template blade concept

 All Laravel view files need to store at resources folder.  Blade Document: https://laravel.com/docs/9.x/blade Blade template always have blade extension For ex: Home.php as Home.blade.php {{}} ==> it will print variable data simply act like PHP echo statements. @directive it is used for template or nested template, loops and conditions statements By default, Blade  {{ }}  statements are automatically sent through PHP's  htmlspecialchars  function to prevent XSS attacks. If you do not want your data to be escaped, you may use the following syntax: {!! $title !!} As refer above image, you can simply create a layout.blade.php for common page. Let take sample example html template In Layout Yield second parameter will be a default value if you doesn't set any title value.