Tag

Laravel

Browsing

Renaming the server.php to index.php Copy the .htaccess from public folder to root folder Changing .htaccess it a bit as follows for statics: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC] </IfModule>

Example 1: public function admin() { $admin = Admin::select(‘name’,’id’) ->where(‘id’, $adminID) ->where(‘name’, $name) ->get(); dd($admin); } Example 2: public function admin() { $admin = Admin::select(‘*’) ->where([ [’id’, $adminID], [’name’, $name] ]) ->get(); dd($admin); }

Step 1: Install Laravel 7 Project I am going to install a laravel project using composer. composer create-project –prefer-dist laravel/laravel laravel7 Step 2: Going inside of project using the command cd laravel7 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=laravel7 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.…

Step 1: Install Laravel 7 Project I am going to install a laravel project using composer. composer create-project –prefer-dist laravel/laravel laravel7 Step 2: Going inside of project using the command cd laravel7 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=laravel7 DB_USERNAME=root DB_PASSWORD=root@123 Step 4: Create employee_images Table and Model also. Here, I have created migration for employee_images using Laravel 7 php artisan command, you can check…

Today, I am going to show you how to create a custom 404 page in laravel 7.First, you need to create a page inside of resources/views/errors/404.blade.phpNow, Code inside of 404.blade.php <!DOCTYPE html> <html lang=”en”> <head> <link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css”> <script src=”https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js” ></script> <style type=”text/css”> *{ transition: all 0.6s; } html { height: 100%; } body{ font-family: ‘Lato’, sans-serif; color: #888; margin: 0; } #main{ display: table; width: 100%; height: 100vh; text-align: center; } .fof{ display: table-cell;…

Step 1: Install Laravel Project I am going to install a laravel project using composer. composer create-project –prefer-dist laravel/laravel laravel7datatables Step 2: Going inside of project using the command cd laravel7datatables 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=laravel7datatables DB_USERNAME=root DB_PASSWORD=root@123 I have done local database credentials. Now migrate database php artisan migrate Step 4: Install yajra Package We going to install the yajra/laravel-datatables-oracle package by…

Step 1: Install the laravel project using the command line. composer create-project –prefer-dist laravel/laravel laravel7ajax Step 2: Open project in code and use vs code terminal. Step 3: find .env file in root directory than setup database configuration. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=database_name DB_USERNAME=database_username DB_PASSWORD=database_password Step 4: run Migration command php artisan make:migration create_books_table Now go to app/datatabase/migrations and open books migration file and put code within migration file app/database/timestamp_create_books_table.php the below code here : <?php…