#Laravel
PHP >= 5.4, PHP < 7
//How display image in Laravel 5.x
{!! Html::image('img/logo.png') !!}
<img src="{{ asset('images/ImageName.jpg')}}" alt=""/>
Warning: require(D:\xampp\htdocs\projects\your-project-name\backend/laravel/vendor/autoload.php): failed to open stream: No such file or directory in D:\xampp\htdocs\projects\your-project-name\backend\index.php on line 24
Fatal error: require(): Failed opening required 'D:\xampp\htdocs\projects\your-project-name\backend/laravel/vendor/autoload.php' (include_path='D:\xampp\php\PEAR') in D:\xampp\htdocs\projects\your-project-name\backend\index.php on line 24
-
composer install
run this command -
composer dump-autoload
This command will clean up all compiled files and their paths.
Open commandline and type
composer install
Note: check storage
folder has following folders
framework
cache
sessions
testing
views
logs
laravel\vendor/symfony/polyfill-mbstring/bootstrap.php): failed to open stream: No such file or directory in
Open command line and run
composer update --no-scripts
this issue will fix.
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from users
where email
= user@domain.com limit 1)
Check yout ```.env`` file, make sure you have enter correct values for SQL database
// ...
DB_DATABASE=portfolio
DB_USERNAME=root
DB_PASSWORD=
// ...
<script>
<?php
if($user = Auth::user())
{
echo 'jQuery("body").addClass("login");';
}else{
echo 'jQuery("body").addClass("logout");';
}
?>
</script>
@foreach($shippings as $shipping)
<li>
{!! Form::radio('shipping_id', $shipping->id, true, ['class' => '', 'id' => 'selectyourshipping_'.$shipping->id ]) !!}
<label for="selectyourshipping_<?php echo $shipping->id; ?>">
<?php echo $shipping->name; ?> + {{ $currency[Config::get('params.currency_default')]['symbol']}} <?php echo $shipping->price; ?>
</label>
</li>
@endforeach
<?php echo nl2br($row->message); ?>
##Getting a data from mySQL in Laravel
//File: xyzController.php
public function vendorsList()
{
//$model = xyzVendors::where('id', '=', $id)->get();
//$result = DB::table('xyz_vendors')->paginate(15);
$result = DB::table('xyz_vendors')->simplePaginate(5);
$page_title = "xyz Vendors";
return view('front.association.xyz.vendorlist', compact('result', 'page_title'));
}
//routes.php
Route::get('rfp/vendors/list','RFPController@vendorsList');
//File: xyzview.blade.php
<table class="table table-bordered">
<tbody>
@foreach($result as $data)
<tr>
<td>{{ $data->id }}</td>
<td>{{ $data->rfp_id }}</td>
<td>{{ $data->created_at }}</td>
</tr>
@endforeach
</tbody>
</table>
{{ dd(request()->route()->getAction()) }}
* Open xampp -> PHP -> php.ini
* Open the file php.ini in any text editor
* Press <code>CTRL + F</code> and Search for openssl
* Comment the line <code>extension=php_openssl.dll</code> by placing a semi-colon at the beginning: <code>;extension=php_openssl.dll</code>
Note : If you want to enable it again remove the semicolon
Go to Laravel folder and run these commands
php artisan migrate
rollback migration first which will destroy last migration tables with all data
php artisan migrate:rollback
@foreach($categories as $key => $category)
<li @if ($key === 0) class="active" @endif>
<a href="#tab_c{{$key+1}}" role="tab" data-toggle="tab">
{{$category->name}}
</a>
</li>
@endforeach
1: Install npm dependencies:
$ npm install browser-sync browser-sync-webpack-plugin webpack-dev-ser
2: Open webpack.mix.js and append following code:
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
mix.webpackConfig({
plugins: [
new BrowserSyncPlugin({
open: 'external',
host: 'projectname.local',
proxy: 'projectname.local',
files: ['resources/views/**/*.php', 'app/**/*.php', 'routes/**/*.php']
})
That’s it for the configuration! Note: see Virtual Host configuration details(#xampp-virtual-host-for-sub-directory)
3: To Webpack and then Browsersync your app:
$ npm run watch
- Open
routes.php
fileapp/Http/routes.php
...
Route::get('/new-page', 'NewPageController@NewPage');
...
- Open
app\Http\Controllers
and create file with same name of routesProductQouteController.php
2.1 Add following code
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Auth,
Config;
use App\Cart;
use App\CartQuote;
use App\General;
use View;
use DB;
class NewPageController extends Controller {
private $sessionId;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct() {
}
public function NewPage() {
return view('front.newpage.index');
}
}
-
Open
resources\views\front\newpage
Createindex.blade.php
file 3.1// Write your code or markup etc..
-
Open this url on your browser
http://localhost/project-name/new-page
Point all domains to root folder and one/specific domain to a subfolder in the root folder
-
Open this file.
I:\xampp\apache\conf\extra\httpd-vhosts.conf
-
Paste this code
<VirtualHost *:80>
DocumentRoot "I:/xampp/htdocs/projects"
ServerName _default_
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@doamin.com
DocumentRoot "I:/xampp/htdocs/projects/myProjectName/"
ServerName student.breakoutedu.com
ErrorLog "logs/sub.domin.com-error.log"
CustomLog "logs/sub.domin.com-common.log" common
</VirtualHost>
-
Open this file.
C:\Windows\System32\drivers\etc\hosts
-
Paste this code
127.0.0.1 sub.domin.com
list($one, $two) = explode("-", "59-l<3veR!f@t", 2);
First make sure you have created migration file under
{project-name}/database
=====================/factories
=====================/migrations
=====================/seeds
Open cmd and run this line.
php artisan migrate
We have to do is edit {Project-name}/App/Providers/AppServiceProvider.php
file.
use Illuminate\Support\Facades\Schema; // <-- add this line
public function boot()
{
Schema::defaultStringLength(191); // <-- add this line
}
It will happend when migrate and it broke half way.
Run this command
php artisan migrate:fresh
It will drop all the existing tables without rolling back or calling down method of migrations.
php artisan db:seed
The key will be written automatically in your .env
file.
APP_KEY=YOUR_GENERATED_KEY
php artisan key:generate
- Make sure
laravel/passport
installed
composer require laravel/passport
-
Register the service provider inside config/app.php ```Laravel\Passport\PassportServiceProvider::class,``
-
Run the migrations
php artisan migrate
-
Generate the keys using
php artisan passport:install
-
Check now!
-
git stash
-
Do other codes...
-
Check stash
git stash list
stash@{0}: WIP on design: e4c0g98... Some changes ABC stash@{1}: WIP on design: fex0u57... Some changes XYZ
-
Megre stash changes
git stash apply
-
apply one
git stash apply 1
// stash@{1} -
remove one
git stash pop 1