Posts

Showing posts with the label php

Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))

use Illuminate\Support\Facades\Schema;  public function boot()   {      Schema::defaultStringLength(191);    }

laravel: command not found

export PATH="$HOME/.composer/vendor/bin:$PATH" source ~/.bash_profile

send data to view from controller in laravel

There are many ways to send data to views from controller i am assuming $data you have to send in view return view('layout',['data' => $data]); return view('layout',compact('data'));  return view('layout')->with(compact('data'));  return view('layout')->withData($data);  return view('layout')->with('data',$data);

Base table or view not found: 1146 Table 'links.blogs' doesn't exist

make sure you are using create instead of table. use Schema::create to create new. Schema::create('links', function (Blueprint $table) {       $table->increments('id');       $table->timestamps(); }); some this like this

create table through migration in laravel

php artisan make:migration create_YOUR_TABLE_NAME_table --create=YOUR_TABLE_NAME For example i am creating links table php artisan make:migration create_links_table --create=links this command will generate migration like this Schema::create('links', function (Blueprint $table) {       $table->increments('id');       $table->timestamps(); });

Laravel Error 500 Whoops, looks like something went wrong – Exception

php artisan key:generate generate key php artisan config:clear clear project cache php artisan config:cache php artisan serve start server again

Naming convention in SQL Sql Tutorial -4

Image
Naming Convention in SQL Rules to follow before specifying names(Object names, Column Names and Variable Names). Each name should begins alphabet Valid character set is a-z,A-Z,0-9,@,$,# and _ (underscore) Ex:  Emp123   Emp_o11 Names are not case sensitive Already existed names are not allowed Pre defined keywords (ReservedWords) are not allowed as names. Blankspace within a name is not allowed Max length of any name is 32 chars

Is-a and Has-a RelationShip

In java or other object oriented programming language is-a and has-a are two type of relationship under the concepts of inheritance. suppose we have three class Car. subaru. engine. subaru is a car — its a is-a  relationship  between  class  subaru and  class  car. car has a engine — its a has-a  relationship  between  class  car and  class  engine.

my input a=12, but how do I print this in 3 digits?

There are many ways to do this. I am using the simplest way to print two digit number in three digit number. import java . util . Scanner ; class Digit { public static void main ( String [] args ) { Scanner sc = new Scanner ( System . in ); System . out . println ( "please enter any two digit number:" ); int n = sc . nextInt (); int k = 0 ; if ( n > 9 && n < 100 ) { k = n * 10 ; } else { System . out . println ( "please enter any two digit number:" ); } System . out . println ( "you entered " + n + " and three digit output of this number is " + k ); } Read More

Header Function || How to Redirect in php

Header Function || How to Redirect in php Header is a fuction which is used to Redirect current page to specified page. syntax. 1).header(‘Location: specified_page_name ’); 2).header(“refreash;1;url= specified_page_name ”);       2nd statement takes you on specified page after 1 second.