Results: 71
Shows all the routes that we have in our application
 php artisan route:list
create table
Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->mediumText('content');
    $table->timestamps();
});
$table->id()
- creates
bigint(20)
unsigned auto-increment field
$table->string('title')
- creates
varchar(255)
utf8mb4_unicode_ci field
$table->mediumText('content')
- creates
mediumtext
utf8mb4_unicode_ci field
$table->timestamps()
- creates
created_at
and
updated_at
timestamps
.env
file contains database config information that needs to be changed to use the database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lara4db
DB_USERNAME=root
DB_PASSWORD=
ctrl + p
-> search
ext install laravel blade
-> install
laravel blade snippets
extension
Difference between route:clear and route:cache
php artisan route:cache
This command will generate a cached version of our routes. Once the routes are cached,
Laravel
will use the cached version instead of parsing and compiling the routes on each request, which helps to improve the overall performance of your application When we make changes to our routes, we need to regenerate it to reflect the updated routes
php artisan route:clear
This command will remove the cached routes, and the application will revert to parsing and compiling the routes dynamically
Laravel could not read .env file
Solution to the problem:
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
Error log file address
Error log file location:
/var/www/website.com/storage/logs/laravel.log
Include .blade.php file
Includes
.blade.php
file located at:
\resources\views\external\calculator
<div class="container">
    
    @include('external.calculator.panel')

</div>
Makes the array member stay filled after backend validation is failed
Makes the array member stay filled if the form is not successfully validated on the backend:
$item_presale_tokens = old('values.0');
$item_liquidity_tokens = old('values.1');
Form html looks like this:
<div class="form-group d-flex border-bottom-0">
    <div class="form-equal-inputs">
        <input type="number" step="1" min="1" value="{{ $item_presale_tokens }}" class="form-control {{ $errors->has('values.0') ? 'is-invalid' : '' }}" name="values[]" placeholder="Value"/>
    </div>
    

</div>

<div class="form-group d-flex border-bottom-0">
    <div class="form-equal-inputs">
        <input type="number" step="1" min="1" value="{{ $item_liquidity_tokens }}" class="form-control {{ $errors->has('values.1') ? 'is-invalid' : '' }}" name="values[]" placeholder="Value"/>
    </div>
</div>
Both ID Name URL support
Both ID and Name of the record is supported with GET URL
public function showUpcomingProject($id){

    if (intval($id)) {
        $item = UpcomingProject::with('projectBlockchain')->findOrFail($id);
    } else {
        $item = UpcomingProject::with('projectBlockchain')->where('token_name', $id)->first();
    }
    if (!$item) {
        return abort(404);
    }
    $blockchains = Blockchain::all();

    return view(strtolower($this->title).'.home.upcoming_project', compact('item', 'blockchains'))->with('svg_renderer', SvgHelper::getBlockchainSvgs($blockchains));

}
If number is passed to the function as the record ID then
if statement
will run. If the
token_name
is passed then
else
will run. If the record is not found, then
404
error is thrown to the client Route Code for the feature:
    Route::get('/upcoming-projects/{id}', [ExternalController::class, 'showUpcomingProject']);
Results: 71