Author

Siddharth Shukla

Browsing

Step 1: Install Laravel 8 Project I am going to install a laravel project using composer. composer create-project –prefer-dist laravel/laravel laravel8 Step 2: Going inside of project using the command cd laravel8 Step 3: Setup MySQL database Now, configure this database in the .env file. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel8 DB_USERNAME=root DB_PASSWORD=root@123 Step 4: Route Setup Here I am going to create routes to get and post method. now open “routes/web.php” file and put below code.…

How to send mail in Laravel 8 Step 1: Create a Laravel 7 project Step 2: Open laravel project set .env configuration MAIL_DRIVER=smtp MAIL_HOST=smtp.googlemail.com MAIL_PORT=465 [email protected] MAIL_PASSWORD=gmail_password MAIL_ENCRYPTION=ssl Step 2: Add Route with routes/web.php Route::get(‘send-mail’,’MailSend@mailsend’); Stage 3: Create Mail In this progression, we will make mail class SendMail for email sending. Here we will compose code for which view will call and the question of the client. So we should run cry direction. you can…

Step 1: Install Composer in your system Step 2: Download laravel using composer package composer create-project –prefer-dist laravel/laravel laravel8imageupload Step 3: Configure your database in .env file DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=multipleImage DB_USERNAME=root DB_PASSWORD=root@123 Step:4 Now, run command for creating model and migration php artisan make:model file -m Update your migration field for inserting image path public function up() { Schema::create(‘files’, function (Blueprint $table) { $table->id(); $table->string(‘filenames’); $table->timestamps(); }); } Now, run migrate command. php artisan…

Laravel 8 CRUD Step 1: Install Laravel 8 first of all, we need to get fresh Laravel 8 version application using bellow command, So open your terminal OR command prompt and run bellow command: git clone -b develop https://github.com/laravel/laravel.git Step 2: Database Configuration Open laravel and set hostname, username, password and database name in .env file DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel_blog DB_USERNAME=root DB_PASSWORD=root Step 3: Create Migration Now we are going to create a blog. so…

By default, Eloquent converts created_at and updated_at columns to instances of Carbon. So if you are fetching the data using Eloquent, then you can do it as below. $object->updated_at->diffForHumans(); If you want to customize the fields that will be mutated automatically, then within your model, you can customize them as you wish. // Carbon instance fields protected $dates = [’created_at’, ‘updated_at’, ‘deleted_at’];

<form class=”newsletter” id=”newsletter”> @csrf <input type=”email” placeholder=”Enter your email address” name=”email” required=””> <button type=”submit”>Subscribe</button> </form> <script> $(‘.newsletter’).on(‘submit’, function(e) { e.preventDefault(); $.ajax({ type: “POST”, url: ‘newsletter’, data: $(this).serialize(), success: function(msg) { document.getElementById(“newsletter”).reset(); swal(“thank you for subscribing newsletter!”); } }); }); </script>

Return from controller return Redirect::back()->withErrors($validator)->withInput(); View part <input type=”text” class=”form-control” name=”name” value=”{{ old(‘name’) }}”> @if($errors->has(‘name’)) <p class=”alert alert-danger print-error-msg”><span class=”glyphicon glyphicon-exclamation-sign” aria-hidden=”true”></span> {{ $errors->first(‘name’) }} </p> @endif