zaster

zaster

Member Since 4 Years Ago

Experience Points
20,440
Total
Experience

4,560 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
56
Lessons
Completed
Best Reply Awards
4
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 5
20,440 XP
Jul
15
3 weeks ago
Activity icon

Replied to Laravel Installation Problem

@safoura

If you are on windows i suggest

https://laragon.org/download/

There will be no issues, you can easily install laravel with few clicks

Jul
14
3 weeks ago
Activity icon

Replied to Possibility Of Adding A Foreign Key Constraint For A Used Table

@michaloravec

ok then i am marking @ajithlal 's answer as Best Reply

Activity icon

Replied to Possibility Of Adding A Foreign Key Constraint For A Used Table

@michaloravec i just wanted others to have the cleaner answer (without any errors). Isn't that the way ? I gave the heart sign to ajithal now.

Activity icon

Replied to Possibility Of Adding A Foreign Key Constraint For A Used Table

@ajithlal

Thanks for the support but your code had some issues(Duplicate field etc..). The below worked for me.

Schema::table('bill_items', function (Blueprint $table) {
            $table->foreignId('bill_id')->change()->constrained('bills')->onDelete('cascade');
            $table->foreignId('item_id')->change()->constrained('items')->onDelete('cascade');
        });	
Activity icon

Started a new Conversation Possibility Of Adding A Foreign Key Constraint For A Used Table

Is it possible to add a foreign key constraint for a table which is already filled with live data ?

Jul
13
3 weeks ago
Activity icon

Awarded Best Reply on Unable To Delete A Record

@jamalroger

The issue was with naming conversions. Sorted now.

Activity icon

Replied to Unable To Delete A Record

@jamalroger

The issue was with naming conversions. Sorted now.

Jul
07
1 month ago
Activity icon

Replied to Hello How To List Data Depend On Visitor IP Address

@respect

Please mark this as "Best Answer" if it answered your question

Jul
04
1 month ago
Activity icon

Replied to Unable To Delete A Record

@jamalroger

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBillItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bill_items', function (Blueprint $table) {
            $table->id();
            $table->integer('bill_id')->nullable();
            $table->integer('item_id')->nullable();
            $table->string('description')->nullable();
            $table->float('value', 15, 2)->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('bill_items');
    }
}
Activity icon

Started a new Conversation Unable To Delete A Record

I am unable to delete a record.

Tried troubleshooting and the destroy function returns NULL

dd($billItem->id);

it gives

NULL

bills.show.blade.php

 <table class="table table-striped bg-dark">
                   <thead class="text-white">
                     <tr>
                      <th>Name</th>
                      <th>Description</th>
                      <th>Value</th>
                      <th></th>
                     </tr>
                   </thead>
                   <tbody class="text-white">
                    @foreach ($bill->billItems as $billItem)
                      <tr>
                        <td>{{$billItem->item->name}}</td>
                        <td>{{$billItem->description}}</td>
                        <td align="right">{{number_format($billItem->value, 2)}}</td>                        
                        <td align="right">                        
                              
                  <form action="{{ route('billitem.destroy',$billItem->id) }}" method="POST">
                    @csrf
                    @method('DELETE')
                    <button type="submit" class="btn btn-danger">Delete</button>
                  </form>
                        </td>
                      </tr>                     
                    @endforeach                                     
                   </tbody>
                 </table>  

BillItemController.php

    public function destroy(BillItem $billItem)
    {
        dd($billItem->id);
        $billItem->delete();
        return back()->with('success', 'Bill Item deleted Successfully');        
    }

web.php

Route::resource('/billitem', 'BillItemController');
Jun
22
1 month ago
Activity icon

Replied to Laravel CMS - What Do You Suggest

@kbuczynski I think you misunderstood my question. What i want is some guide on implementing a laravel based cms. Especially my customer should be able to edit articles and place images by him self.

Activity icon

Started a new Conversation Laravel CMS - What Do You Suggest

I need to use laravel to build a cms. I tried October CMS but i think customizing it would be difficult(Need the default laravel flexibility).

I need to give the customer the ability to edit his content including image positioning along with text

What do you suggest?

May
25
2 months ago
Activity icon

Awarded Best Reply on Nginx: Configuration File /etc/nginx/nginx.conf Test Failed

@noblemfd check your site1.conf and site2.conf check for proper spacing , semicolons , typos etc...

May
24
2 months ago
Activity icon

Replied to I Work By Framework Like Laravel 6

@chargui your question is not clear enough

Activity icon

Replied to Nginx: Configuration File /etc/nginx/nginx.conf Test Failed

@noblemfd check your site1.conf and site2.conf check for proper spacing , semicolons , typos etc...

Activity icon

Replied to Undefined Offset Error

@michaloravec

I want to get the total value of each PO

Activity icon

Replied to Undefined Offset Error

@tykus

I didn't get what you meant. Finally what i want is to get the total value of each PO.

Activity icon

Started a new Conversation Undefined Offset Error

 foreach ($pos as $po) {
            $po_value[] = 0;
            $po_item_total = 0;
            foreach ($po->po_items as $po_item) {
                $po_item_total = $po_item->qty * $po_item->rate;
                $po_value[$po->id] = $po_value[$po->id] + $po_item_total;
            }
        }

This line

$po_value[$po->id] = $po_value[$po->id] + $po_item_total;

Causes Undefined Offset error. Could you please help

May
09
3 months ago
Activity icon

Replied to Technology Stack Suggestion + Common Pitfalls On Building A SAAS

@mjsarfatti Yes. I thought of using Vue. Yes this site will rely alot on REST APIs. What about the frontend framework ?

I still can use bootstrap without using jquery (To create the layout etc...) right ?

May
07
3 months ago
Activity icon

Started a new Conversation Technology Stack Suggestion + Common Pitfalls On Building A SAAS

I am going to work on a SAAS (Software As A Service) Project and need to finalize my technology stack.

I currently have some experience on laravel, Bootstrap, Jquery and MySQL

For this project i thought of using Laravel, Vue and MySQL

Could you give me some suggestions on the Fronend Framework or Maybe the other Tools as well.

Also appreciate if you could enlighten me on avoiding common pitfalls etc...

May
06
3 months ago
Activity icon

Replied to SQLSTATE[HY000] [1045] Access Denied For User 'root'@'localhost' (using Password: YES) - In Laravel 7

@michaloravec I corrected the password in the .env file and everything is fine now

Activity icon

Awarded Best Reply on SQLSTATE[HY000] [1045] Access Denied For User 'root'@'localhost' (using Password: YES) - In Laravel 7

My database password was wrong

I was confused between the Database Connection Password and Database Password

Activity icon

Replied to SQLSTATE[HY000] [1045] Access Denied For User 'root'@'localhost' (using Password: YES) - In Laravel 7

My database password was wrong

I was confused between the Database Connection Password and Database Password

May
04
3 months ago
Activity icon

Started a new Conversation SQLSTATE[HY000] [1045] Access Denied For User 'root'@'localhost' (using Password: YES) - In Laravel 7

I am getting this error when i run (I am using laravel 7.9.2)

php artisan migrate
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = mydb and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675|

      +34 vendor frames
  35  artisan:37

Everything runs smoothly in the local environment

tried

php artisan config:cache
php artisan cache:clear

I can access the production database without any issue

My .env file should be good ( I am using other laravel versions in production and i haven't experienced any such issue)

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mydb
DB_USERNAME=root
DB_PASSWORD=mypassword

Note : I have upgraded the php version to 7.4.5

Apr
27
3 months ago
Activity icon

Awarded Best Reply on Collection - Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

I did something like this

@foreach($activities as $activity)
 {{collect($activity->changes->get('attributes'))}}
@endforeach

Converted the array in to a collection

it worked.

Activity icon

Replied to Collection - Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

I did something like this

@foreach($activities as $activity)
 {{collect($activity->changes->get('attributes'))}}
@endforeach

Converted the array in to a collection

it worked.

Activity icon

Started a new Conversation Collection - Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

In Tinker

>>> $collection->get('attributes');
=> [
     "name" => "original name",
     "text" => "Lorum",
   ]

in the view

@foreach($activities as $activity)
	{{$activity->changes->get('attributes')}}
@endforeach

gives this error

htmlspecialchars() expects parameter 1 to be string, array given (View:

Is there a collection method that i could use and sort this out

or what whould be the way to get what i achieved in tinker

Apr
25
3 months ago
Activity icon

Awarded Best Reply on 2 Bootstrap Themes On 1 Site? -- One For Dashboard, Other For UI/UX

@dronesx

Yes. That is possible. Have separate layouts.

layouts\admin.blade.php
layouts\frontend.blade.php

and then have separate partials

partials\admins\header.blade.php
partials\admins\footer.blade.php
...
partials\frontend\header.blade.php
partials\frontend\footer.blade.php
...
Apr
24
3 months ago
Activity icon

Replied to Route Naming Convention - Check

@michaloravec Thank you for the reply. Actually i was more focusing on the case sensitivity , underscores etc... best practices

Apr
23
3 months ago
Activity icon

Started a new Conversation Route Naming Convention - Check

Could you please check and confirm whether the following is correct


//Routes with Folder Structure        
Route::get('/prices/{price}/edit', 'Employees\[email protected]')->name('employees.prices.edit');
Route::patch('/prices/{price}/update', 'Employees\[email protected]')->name('employees.prices.update');
Route::get('/prices/create', 'Employees\[email protected]')->name('employees.prices.create');
Route::get('/prices/{price}', 'Employees\[email protected]')->name('employees.prices.show');
Route::delete('/prices/{price}', 'Employees\[email protected]')->name('employees.prices.destroy');
Route::get('/prices', 'Employees\[email protected]')->name('employees.prices.index');
Route::post('/prices', 'Employees\[email protected]')->name('employees.prices.store');

Route::get('employees/usertypes/create', 'Employees\[email protected]')->name('employees.user_types.create');

Apr
22
3 months ago
Activity icon

Replied to Error: EINVAL: Invalid Argument, Mkdir 'C:\Users\Peter.000\'C:\Users\User\AppData\Roaming\npm''

@siangboon that link was very helpful. Was able to sort the issue. Thank you very much :)

Activity icon

Replied to How Can I Avoid Doing The Same Things Over And Over

Up to now , Custom made snippets seems like the way to go ahead

Activity icon

Replied to How Can I Avoid Doing The Same Things Over And Over

@artcore thanks for the reply. I wonder what other ways are available.

I think may be writing your own artisan commands could be another option

Activity icon

Replied to Error: EINVAL: Invalid Argument, Mkdir 'C:\Users\Peter.000\'C:\Users\User\AppData\Roaming\npm''

I was able to create another windows account and run npm from there. However, still couldn't find out a way to run npm from my default windows user account (C:\Users\Peter.000)

Activity icon

Started a new Conversation Error: EINVAL: Invalid Argument, Mkdir 'C:\Users\Peter.000\'C:\Users\User\AppData\Roaming\npm''

I have installed node 12.16.2

Unfortunately, when i run

npm

i am getting an error

I think this is due to some default user account issue occurred after i updated windows 10

Previously my user account was at C:\Users\Peter

after the windows 10 update it is now at C:\Users\Peter.000

I doubt that this has a direct connection to the error mentioned in the subject

Activity icon

Replied to 2 Bootstrap Themes On 1 Site? -- One For Dashboard, Other For UI/UX

@dronesx you are welcome. Happy to help :) Please mark this as solved if you got your answer.

Activity icon

Replied to 2 Bootstrap Themes On 1 Site? -- One For Dashboard, Other For UI/UX

@dronesx

Yes. That is possible. Have separate layouts.

layouts\admin.blade.php
layouts\frontend.blade.php

and then have separate partials

partials\admins\header.blade.php
partials\admins\footer.blade.php
...
partials\frontend\header.blade.php
partials\frontend\footer.blade.php
...
Activity icon

Replied to How Can I Have To Get Routs That Go To The Same Page

@tudosm

try having [email protected]

Route::get('/shop/category/{category}', '[email protected]')->name('shop.category.show');	
Apr
21
3 months ago
Activity icon

Replied to How Can I Avoid Doing The Same Things Over And Over

I think different developers have different experience / ideas

For example

1). What about developing your own set of packages to achieve kind of modular approach(not sure about this though) https://github.com/spatie

2). https://medium.com/@destinyajax/how-to-build-modular-applications-in-laravel-the-plug-n-play-approach-part-1-13a87f7de06

3). https://github.com/InfyOmLabs/laravel-generator CRUDs can be generated instantly and then you can customize according to your requirements

a model.json file is created. Something like this

[
    {
        "name": "id",
        "dbType": "increments",
        "htmlType": null,
        "validations": null,
        "searchable": false,
        "fillable": false,
        "primary": true,
        "inForm": false,
        "inIndex": false,
        "inView": false
    },
    {
        "name": "name",
        "dbType": "string",
        "htmlType": "text",
        "validations": "required",
        "searchable": true,
        "fillable": true,
        "primary": false,
        "inForm": true,
        "inIndex": true,
        "inView": true
    },
    {
        "name": "description",
        "dbType": "string",
        "htmlType": "textarea",
        "validations": "required",
        "searchable": true,
        "fillable": true,
        "primary": false,
        "inForm": true,
        "inIndex": true,
        "inView": true
    },
    {
        "name": "created_at",
        "dbType": "timestamp",
        "htmlType": null,
        "validations": null,
        "searchable": false,
        "fillable": false,
        "primary": false,
        "inForm": false,
        "inIndex": false,
        "inView": true
    },
    {
        "name": "updated_at",
        "dbType": "timestamp",
        "htmlType": null,
        "validations": null,
        "searchable": false,
        "fillable": false,
        "primary": false,
        "inForm": false,
        "inIndex": false,
        "inView": true
    }
]

5). Sometimes the views might look the same so you could copy the entire folder and do minor changes (create.blade.php, edit.blade.php, index.blade.php, show.blade.php etc...)

6). What about forking your project from a certain point where it seems like common stuff can be applicable for most of the similar kind of projects etc..

7). Considering the option to delay on updating you laravel project between versions. May be re-writing the entire application after 4 / 5 years (Since then most of the technologies have changed including the frontend (May be this approach raise security concerns , and mostly it can be due to third party plugins ?)

Activity icon

Started a new Conversation How Can I Avoid Doing The Same Things Over And Over

Some of the things i found out was

  1. Have your own set of packages
  2. Try https://github.com/nWidart/laravel-modules
  3. Try CRUD code generators etc...
  4. Try to write code in a way that you could use it over and over (Using inheritance etc...)
  5. What about copying and pasting code from your earlier projects ?
  6. What about having one big project with all what you know and kind of using it as a reference

What are your thoughts on these and what would be the pros and cons

Activity icon

Started a new Conversation API - Correct Me If I Am Wrong

As what i understand , when we deal with api related routes, only the required routes will be under routes/api.php

Ordinary routes can be inside routes/web.php

In that case, in most of the web applications routes/web.php will have many routes than routes/api.php

Apr
15
3 months ago
Activity icon

Awarded Best Reply on Class 'Arcanedev\LogViewer\LogViewerServiceProvider' Not Found

@tippin

Solved the issue after completely removing all files and reinstalling from the beginning through version control

Activity icon

Awarded Best Reply on Class 'Predis\Client' Not Found

@tokoiwesley Thanks for the suggestion but this is what solved my issue

Hope it would be helpful for others https://laracasts.com/discuss/channels/laravel/updating-compser-killed-process-in-terminal?page=0

Apr
13
3 months ago
Activity icon

Replied to Get Only The Non Soft Deleted Values From A Custom Pivot Table

@piljac1

That was a mistake done by my side. Sorry about that. I have changed the subject.