obink

Member Since 2 Months Ago

Experience Points
1,350
Total
Experience

3,650 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
0
Lessons
Completed
Best Reply Awards
0
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.

  • Community Pillar

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

Level 1
1,350 XP
Dec
04
18 hours ago
Activity icon

Replied to Laravel Create And Passing Id In Route

@michaloravec, Michal, SORRY... it was a grave mistake.

the error was saying in my app.blade. it was a route in the navigation I didn't change yet.

so sorry, and ty for your time.. it's all good. it was all my careless. lol

Activity icon

Replied to Laravel Create And Passing Id In Route

{{dd($homework->id)}}
    {{-- <a href="{{ route('students.quiz', ['id'=>$homework->id]) }}" class="btn btn-primary">{{$homework->name}} </a> --}}

it's a 2, it's number 2, the 2nd row of homework's table

Activity icon

Replied to Laravel Create And Passing Id In Route

I did try to moveroute::resource, or even I try deleting it. it doesn't change my luck.

and for all the records

GET|HEAD  | quiz/create/{id}            | students.quiz                | App\Http\Controllers\[email protected]               | web        | auth       |                                          

the route is already planted in route:list but when I called it in the view, it keeps returning an error.

it's like Laravel trying to tell me that, I need to put the id, but I did put the id

Activity icon

Started a new Conversation Laravel Create And Passing Id In Route

Web Route

route::name('students.')->middleware('auth')->group(function(){
    Route::resource('quiz', 'ResultController');
    Route::get('quiz/create/{id}', [
        'as' => 'quiz',
        'uses' => '[email protected]'
    ]);


});

Controller

public function createFromHomework($id)
    {
    return 'inside';
    }

View

<a href="{{ route('students.quiz', ['id'=>$homework->id]) }} " class="btn btn-primary">{{$homework->name}} </a>

returning error like

Missing required parameters for [Route: students.quiz] [URI: quiz/create/{id}].

please help.

Dec
03
1 day ago
Activity icon

Started a new Conversation Laravel Javascript, Add And Delete Table's Row Getting Jumpy

I'm at the endpoint of logic and level of understanding

I have a table with an add and delete row it works great in Laravel create..

but when it comes to Laravel edit it becomes something I don't understand.

View

<tbody>
    @foreach (old('questionsets', $homework->withQuestions->count() ? $homework->withQuestions : ['']) as $questions)
    <tr id="question{{$loop->index}}">
        <td>
            <select name="questions[]" class="form-control">
                <option value="">-- choose question --</option>
                @foreach ($theQuestions as $item)
                    <option value="{{ $item->id }}"
                        @if (old('questions.' . $loop->parent->index, optional($questions)->id) == $item->id) selected @endif
                        >
                        {{ $item->question }}
                    </option>
                @endforeach
            </select>
        </td>
    </tr>
    @endforeach
    <tr id="question{{ count(old('questions', $homework->withQuestions->count() ? $homework->withQuestions : [''])) }}"></tr>
</tbody>

this is a button to make things work, just right below the related table.

<div class="row text-right">
<div class="row text-right">
    <div class="col-md-12">
        <button id="add_row" class="btn btn-warning pull-left">+ Add Row</button>
        <button id='delete_row' class="pull-right btn btn-danger">- Delete Row</button>
    </div>
</div>

Javascript

@section('addRow')
    <script>
        $(document).ready(function(){
            let row_number = 1;
        $("#add_row").click(function(e){
            e.preventDefault();
            let new_row_number = row_number - 1;
            $('#question' + row_number).html($('#question' + new_row_number).html()).find('td:first-child');
            $('#questions_table').append('<tr id="question' + (row_number + 1) + '"></tr>');
            row_number++;
        });

        $("#delete_row").click(function(e){
            e.preventDefault();
            if(row_number > 1){
            $("#question" + (row_number - 1)).html('');
            row_number--;
            }
        });
        });
    </script>
@endsection

What I'd like to inform is, when the edit view of Laravel is opened, the table is full of my data which is great. and when I want to add another row or deleting the previous row it's not working smoothly.

Deleteing row I have to add another row to delete the previous one,

Adding new row after I ran add row is filled with my previous data, which is I want it to be blank.

I tried to change this row

<tr id="question{{ count(old('questions', $homework->withQuestions->count() ? $homework->withQuestions : [''])) }}"></tr>

but still can't find the right method to fix this, I need help. please help!

Dec
01
3 days ago
Activity icon

Replied to Laravel Variable From Edit Become Blank

it returning this

|        | GET|HEAD  | homeworks/{homework}/edit   | admin.homeworks.edit         | App\Http\Controllers\[email protected]                          | web        |

it is working but it doesn't hurt if I know why. let's keep the conversation until I know why, if you don't mind. :D

Activity icon

Replied to Laravel Variable From Edit Become Blank

hi @neilstee it is working now. sorry for the trouble. I change function parameter with id

public function edit($id)

and findOrFail the homework. Even I don't know why, but it works. And I'm using Route::resource for everything.

Nov
30
4 days ago
Activity icon

Started a new Conversation Laravel Variable From Edit Become Blank

I don't understand if I can explain this properly, but I'll try.

at index, I put the edit and delete button in loop

<a href="{{route('admin.homeworks.edit', $homework->id)}} " class="btn-sm btn-primary">Edit</a>
<a href="{{route('admin.homeworks.deleteStatus', $homework->id)}} " class="btn-sm btn-danger">Delete</a>

this $homework->id become a blank variable inside of my controller

public function edit(Homeworks $homeworks)
    {
        $levels = Level::orderBy('name', 'asc')
        ->where('deleteStatus', '0')
        ->get();

dd($homeworks);

        return view('admin.homeworks.edit', compact('levels', 'homeworks'));
    }

this is what $homeworks return

please help me to fix this, I need help....

Nov
23
1 week ago
Activity icon

Replied to Implement Gate For User's Role Inside A User Table

hi @rodrigo.pedra I just tried yours once and it worked like a charm. And luckily this project is in laravel 7

this Optional() thing is new to me.

thanks again.

Activity icon

Started a new Conversation Implement Gate For User's Role Inside A User Table

I have this schema of User table

        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('email')->unique()->nullable();
            $table->string('username')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->string('role')->default('kids');
            $table->tinyInteger('deleteStatus')->default('0');
            $table->rememberToken();
            $table->timestamps();
        });

and I think this project just has a single role for each users, so I'm trying to implement a gate for this peculiar role. Let Say a teacher and a student.

in my app User, I'm made a teacher function

public function hasRole($role)
    {
        if($this->where('role', $role)->first()){
            return true;
        }

        return false;
    }

in my AuthServiceProvider, I'm adding this

Gate::define('teacher', function($user){
return $user->hasRole('teacher');
});

and inside of users.index, I began testing it and it fails me.

@can('teacher')
<a href="{{route('users.edit', $user->id)}} " class="btn-sm btn-primary">test</a>
@endcan

I know the other method, using a Role table and make it many to many relationships. But I think that won't be necessary.

how to do this, please help.

Nov
19
2 weeks ago
Activity icon

Replied to How To Remove Some Packages / Vendor?

how to remove the published vendor? Is it from composer.json? or maybe should I manually delete related folders?

Activity icon

Replied to How To Remove Some Packages / Vendor?

So, is that a two different ways thing? or is that a single way with 2 steps?

Activity icon

Started a new Conversation How To Remove Some Packages / Vendor?

What is the most effective and efficient method to undo the package I just installed and published with composer??

like composer require some-bundle/for-laravel and PHP artisan vendor:publish

it's very very uncomfortable for backing up a project every day before installing the bundle, and deleting a whole project if we found out this bundle doesn't suit me.

can we also undo this with artisan? or composer?

Nov
12
3 weeks ago
Activity icon

Replied to Laravel Get Visitor's IP, Location, And City

it helps, like a lot. thanks, @rodrigo.pedra. I tested it in many different static IPs from each country and it works, now what I need to do just to store the city and region into my database. once again. thanks.

Nov
11
3 weeks ago
Activity icon

Replied to Laravel Get Visitor's IP, Location, And City

Hi again @rodrigo.pedra, ya I Just realized it yesterday, about test it in local would come false return.

// Returns instance of Stevebauman\Location\Position on success, otherwise false (for example for local network ip addresses)

but then I tried testing it in here $position = Location::get('192.168.1.1'); and it still returning false.

honestly, I never try Location::get in route, because my aim is to record the IP and Cities when somebody hit the product's details public function show

Do you or anyone else manage to get this Location::get($position) inside the controller successfully?

and another thing is what should I import in my controller actually? Is it the facades or the location/location?

Activity icon

Replied to Laravel Get Visitor's IP, Location, And City

Yes that was typo. but it still returning false. I just deleted $position1 and use Stevebauman\Location\Location; and still no luck. :/ what happened with this package?

Activity icon

Replied to Laravel Get Visitor's IP, Location, And City

hi @kumaravel and also @laracoft I have these line on top

use Stevebauman\Location\Location;
use Stevebauman\Location\Facades\Location as FacadesLocation;

and I'm having these under the function show

$position = Location::get($whoIsIp);
$poisiton2 = FacadesLocation::get($whoIsIp);

if I dump the $position2 the result is always false

Activity icon

Replied to Laravel Get Visitor's IP, Location, And City

hi @rodrigo.pedra , do you mean by this?

'driver' => Stevebauman\Location\Drivers\IpApi::class,

or do you want to see the whole config?

and by any chances, I just check up something and retrying everything, and I got another error message like this

ErrorException
Non-static method Stevebauman\Location\Location::get() should not be called statically
http://127.0.0.1:8000/catalogue/2

Do you or anyone by any chance know what is this? it wasn't like this before.

Nov
10
3 weeks ago
Activity icon

Replied to Laravel Get Visitor's IP, Location, And City

hi @automica, I did the publish with php artisan vendor:publish and picking number of stevebauman location location package.

isn't that the same thing?

Nov
09
3 weeks ago
Activity icon

Started a new Conversation Laravel Get Visitor's IP, Location, And City

I currently making a dashboard page which required tracking the visitors, this page is about, how much this certain page being view, and who saw this page and content inside.

I tried a package named cyrildewit/eloquent-viewable and it working fine for counting the viewer. but I can't seem to find how to check "who are they ?" in this package.

so I installed another package called stevebauman/location, the features it's so promising, we can check the location of visitor's cities, countries, and anything else.

but after running a simple test with this, under my CatalogueController, public function show($product)

$whoIsIp = request()->ip();
        $position = Location::get($whoIsIp);
        dd($position);

this error message displaying in my browser

Stevebauman\Location\Exceptions\DriverDoesNotExistException
The location driver [] does not exist.
http://127.0.0.1:8000/catalogue/1

please help.

this is my full code of that function

public function show($product)
    {
        $product = Product::find($product);
        views($product)->record();

        $images = $product->images;
        $whoIsIp = request()->ip();
        $position = Location::get($whoIsIp);
        dd($position);


        return view('product', compact('product', 'images'));
    }

Oct
29
1 month ago
Activity icon

Started a new Conversation Laravel 404, In New Existing Route And Controller

I know this is an old question, but I read enough and still failing to understand.

therefore I ask, as the title is explaining enough.

this is what I did so far Web route

Route::resource('invoice', 'InvoiceController');
Route::get('invoice/{id}/deleteStatus', '[email protected]')->name('invoice.deleteStatus');
Route::get('/invoice/customCreatePrices', '[email protected]')->name('invoice.customCreatePrices');

PHP artisan route:list

so a little explanation from this picture, I have 2 custom new routes, one is deleteStatus and the other is customCreatePrices. Thing is, the deleteStatus route is doing just fine and smooth, but the customCreatePrices is the problem route with 404 issue in a link called for a route <a href="{{route('invoice.customCreatePrices')}} ">Custom Create</a>.

InvoiceController

    public function customCreatePrices()
    {
        return 'hello';
    }

did I do something wrong?

Oct
17
1 month ago
Activity icon

Replied to Laravel Carbon And Momentjs

hi @sinnbeck, oh right. I'm using tempus dominus.

Oct
16
1 month ago
Activity icon

Started a new Conversation Laravel Carbon And Momentjs

Tried so many different ways, but still got a variety of errors.

this time, I got this error

Carbon\Exceptions\InvalidFormatException Unexpected data found. The separation symbol could not be found Data missing

I hope this post will end my suffer,

I have this moment js locale in the layouts.app

$('#deliveryOdate').datetimepicker({
format:'LL',
locale: 'id',
})

and I don't know if these things are related, but to another information, I put some change too in here

// App\Providers\AppServiceProvider

public function boot()
{
	config(['app.locale' => 'id']);
	Carbon::setLocale('id');
	date_default_timezone_set('Asia/Jakarta');

}

and here

// config/app.php

    'timezone' => 'Asia/Jakarta',
    'locale' => 'id',
    'faker_locale' => 'id_ID',

and lastly in function store, right inside of Post::create

I have this

'deliveryOrder' => Carbon::createFromFormat('Y-m-d H:i:s', $request->deliveryOrder)->toDateTimeString(),

Question is, how to change momentJs locale format into acceptable date format and inserting it into MySQL?

please help me.

Oct
10
1 month ago
Activity icon

Replied to Composer Memory_Limit Allowed Size 1610612736

wow, it is something new for me. I'll try this. ty @laracoft

Activity icon

Awarded Best Reply on Composer Memory_Limit Allowed Size 1610612736

After all that I did, finally, I used Git Bash to do this

COMPOSER_MEMORY_LIMIT=-1 composer -v require spatie/laravel-permission

and it worked. I used CMD from windows from all the time, so git bash is the clue.

Activity icon

Replied to Composer Memory_Limit Allowed Size 1610612736

After all that I did, finally, I used Git Bash to do this

COMPOSER_MEMORY_LIMIT=-1 composer -v require spatie/laravel-permission

and it worked. I used CMD from windows from all the time, so git bash is the clue.

Activity icon

Started a new Conversation Composer Memory_Limit Allowed Size 1610612736

I'm trying to include laravel/spatie inside my project but can't make any progress because of composer memory limit.

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

and I'm using wamp for PHP, and this is my PHP version

PHP 7.3.12 (cli) (built: Nov 19 2019 13:58:02) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies

I already change php.ini file and restarting wamp memory_limit = -1

and trying several times after changing this and that about composer and keep getting another error message like,

php COMPOSER_MEMORY_LIMIT=-1
Could not open input file: COMPOSER_MEMORY_LIMIT=-1
php composer.phar COMPOSER_MEMORY_LIMIT=-1
Could not open input file: composer.phar

I googled it and some people make this right with the above tricks, anyone like me, or is it just me?

have anyone done this before?

Oct
08
1 month ago
Activity icon

Replied to Laravel 8 Jetstream Custom Registration

Hi @vayu the registration is working just fine and also for the login too.

but I or we need to change name in the app layout or top navigation navigation-dropdown.blade

this

<div>{{ Auth::user()->name}}</div>

into this

<div>{{ Auth::user()->username }}</div>
Activity icon

Awarded Best Reply on Laravel 8 Jetstream Custom Registration

so after this and that,

this is what I've got.

see this image below FortifyServiceProvider

CreateNewUser::class here is explaining about 4 or more file I need to check and change everything in function create like so

Validator::make($input, [
            'username' => ['required', 'string', 'max:255'],
            'phone' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => $this->passwordRules(),
        ])->validate();

        return DB::transaction(function () use ($input) {
            return tap(User::create([
                'username' => $input['username'],
                'phone' => $input['phone'],
                'email' => $input['email'],
                'password' => Hash::make($input['password']),
            ]), function (User $user) {
                $this->createTeam($user);
            });
        });

IDK how to explain about what am I doing, but it works.

Activity icon

Replied to Laravel 8 Jetstream Custom Registration

so after this and that,

this is what I've got.

see this image below FortifyServiceProvider

CreateNewUser::class here is explaining about 4 or more file I need to check and change everything in function create like so

Validator::make($input, [
            'username' => ['required', 'string', 'max:255'],
            'phone' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => $this->passwordRules(),
        ])->validate();

        return DB::transaction(function () use ($input) {
            return tap(User::create([
                'username' => $input['username'],
                'phone' => $input['phone'],
                'email' => $input['email'],
                'password' => Hash::make($input['password']),
            ]), function (User $user) {
                $this->createTeam($user);
            });
        });

IDK how to explain about what am I doing, but it works.

Activity icon

Replied to Laravel 8 Jetstream Custom Registration

hi @laralink I think I just made a progress. I will share what I know in here

Oct
07
1 month ago
Activity icon

Started a new Conversation Laravel 8 Jetstream Custom Registration

I just tried to change a name input into username so the main objective is, I want to make an accessible login with phone || email || username. But this error stalls me. please help.

I deleted the name field and change it into username. But the validation is somewhere I can't find.

I change every validation that I know like in: Fortify/CreateNewUser and Fortify/CreateNewUserWithTeams

 public function create(array $input)
    {
        Validator::make($input, [
            'username' => ['required', 'string', 'max:255', 'unique:users'],
            'phone' => ['required', 'string', 'max:255', 'unique:users'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password' => $this->passwordRules(),
        ])->validate();

        return User::create([
            'username' => $input['username'],
            'phone' => $input['phone'],
            'email' => $input['email'],
            'password' => Hash::make($input['password']),
        ]);
    }

Point is, I already change name into username

but the validation still saying, like "Whoops! Something went wrong. The name field is required."

please help

Oct
05
1 month ago
Activity icon

Replied to How To Set Locale In Laravel Work With Moment.js?

I already installed it with NPM, does this mean I need to link it again?

Activity icon

Started a new Conversation How To Set Locale In Laravel Work With Moment.js?

so, English is not my daily language and I need my apps to have a familiar language.

about locale and timezone, I already tried these.

app/ config.php

    'timezone' => 'Asia/Jakarta',
    'locale' => 'id',
    'faker_locale' => 'id_ID',

appServiceProvider.php

    public function boot()
    {
        Schema::defaultStringLength(191);
        config(['app.locale' => 'id']);
	    Carbon::setLocale('id');
	    date_default_timezone_set('Asia/Jakarta');
    }

and in my somewhere index.blade.php - datatable javascript

var table = $('#products-out-table').DataTable({
            processing: true,
            serverSide: true,
            ajax: "{{ route('api.productsOut') }}",
            columns: [
                {data: 'date', name: 'date', render:function (data, type, row) {
                    var locale = moment.locale('id');
                    return (moment(data).isValid()) ? moment(data).locale(locale).format("LLLL") : "-";
                }},
                {data: 'customer_name', name: 'customer_name'},
                {data: 'action', name: 'action', orderable: false, searchable: false}
            ]
        });

this column of data below doesn't change my date languages as it should.

 {data: 'date', name: 'date', render:function (data, type, row) {
var locale = moment.locale('id');
return (moment(data).isValid()) ? moment(data).locale(locale).format("LLLL") : "-";
}},

is there something wrong with my code? I read and do what the docs and forums people do. please help

Sep
28
2 months ago
Activity icon

Replied to How To Do An Instagram CURL In Laravel 8?

hi, @neilstee it shows an error of Invalid argument supplied for foreach()

I was hoping someone teach me about guzzle in here tho. but if the primitive scripting PHP like this working, I'll take my chances.

Activity icon

Started a new Conversation How To Do An Instagram CURL In Laravel 8?

I'm new at Laravel and trying to do an Instagram CURL in Laravel.

previously(before Laravel), I put a CURL in a root/PHP/curl.php

function fetchData($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
// Pull and parse data.
$result = fetchData("https://graph.instagram.com/me/media?fields=id,media_url,permalink&access_token=this1st0k3n");
$result = json_decode($result, true);

and using <?php include "php/curl.php";?> at the most top of the page.

but in Laravel otherwise, I tried using a different method,

I tried to put the fetch data in a controller,

or I put it in resource/views/php/curl.blade.php so I called it on the top of the page using @include,

or I just plainly script on the same page like this

{{

function fetchData($url){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
// Pull and parse data.
$result = fetchData("https://graph.instagram.com/me/media?fields=id,media_url,permalink&access_token=this1st0k3n");
$result = json_decode($result, true);
$limit = 6;

}}

@foreach ($result['data'] as $post)
@for ($i = 0; $i < $limit; $i++)
<div class="col-sm-6 col-md-6 col-lg-4 events">
    <div class="portfolio-item">
       <div class="gallery-thumb">
           <a href=" {{$post['permalink']}}"target="_blank">
             <img src="{{$post['media_url']}}" class="img-responsive" alt=""></a>
       </div>
    </div>
 </div>
@endfor
@endforeach

none of these are working, please help me.

Sep
25
2 months ago
Activity icon

Awarded Best Reply on Laravel Jetstream Profile-photos Not Showing

SO this question is already answered in here

https://laracasts.com/discuss/channels/laravel/image-cant-loaded-when-using-laravel-jetstream

by a good guy named @Snapey.

so simply said, you have to change this APP_URL in the .env file

like so, if you are in your localhost you have to know which localhost server are you on.

In my case, it was PHP artisan serve so obviously I change my APP_URL into this http://127.0.0.1:8000, if you are at xampp, change it into localhost/htdocs or whatever your links saying.

Activity icon

Replied to Laravel Jetstream Profile-photos Not Showing

SO this question is already answered in here

https://laracasts.com/discuss/channels/laravel/image-cant-loaded-when-using-laravel-jetstream

by a good guy named @Snapey.

so simply said, you have to change this APP_URL in the .env file

like so, if you are in your localhost you have to know which localhost server are you on.

In my case, it was PHP artisan serve so obviously I change my APP_URL into this http://127.0.0.1:8000, if you are at xampp, change it into localhost/htdocs or whatever your links saying.

Activity icon

Replied to Laravel Jetstream Profile-photos Not Showing

hi @frankielee, about the stored picture, it's a bit odd. I don't know where the photo will be stored

look at these pictures stored

2 pictures with the same hash and the same image stored in two different places. this is a screenshot I just took, and I'm sure uploading multiple pictures while testing this problem.

simply said, where are the other pictures go?

Sep
24
2 months ago
Activity icon

Started a new Conversation Laravel Jetstream Profile-photos Not Showing

Laravel 8 and jetstream, is it really new?

I just tried installing and playing it in fortify but I can't really understand why my profile photo not showing a picture.

update-profile-information-form

<!-- Current Profile Photo -->
<div class="mt-2" x-show="! photoPreview">
<img src="{{ $this->user->profile_photo_url }}"
          alt="{{ $this->user->name }}"
          class="rounded-full h-20 w-20 object-cover">
</div>

.Env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:6IJbdi+QYczKeLT7yOw3OgPsHucXn1KxVUb27hTQKpU=
APP_DEBUG=true
APP_URL=http://POroti

config/filesystems

'public' => [
            'driver' => 'local',
            'root' => storage_path('/public/storage'),
            'url' => env('APP_URL').'/public/storage/',
            'visibility' => 'public',
        ],

I've been trying the storage URL with this storage/app/public/ and that public/storage/ and I keep trying to change the path and can't remember which and what I took in this screenshot. All of the results are the same, the photo not showing

I thought when the laravel jet stream is completely installed. We got all of the scaffolding and doesn't need to change anything for it. Is it just me or anybody gets the same problem as mine?

Sep
23
2 months ago
Activity icon

Started a new Conversation How To Integrate Laravel/Jet And AdminLTE?

Can we combined adminLTE , with Laravel Jet?

I mean, I love the start-up auth of laravel/Jet. and I like the adminLTE's template.

I've been trying installing both of them following their official documentation,

I installed laravel/jet until the end and it is a success, and the next step is I used an NPM to install this adminLTE. - no sign of error.

but why the template of adminLTE is not installed yet? Should I type every section like I type normal HTML with bootstrap, but in this case it's with the adminLTE component.

and o ya, I tried to ran npm run dev it came out an error saying something like

cross-env' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
etc

the question is still, Can we combined adminLTE , with Laravel Jet?

Is there any example or tutoring link that you can share with us about this?

Activity icon

Replied to Retrieve A Single Column With A Peculiar ID From A Database And Put It In At A Different Table

Hi, @sinnbeck Thank you for the link. I'll learn about this Arr::stuff .

Activity icon

Replied to Laravel 5.6.9 : Php Artisan Migrate - Problem

IDK what's good and bad after I changed this. But it works, and that's it! The next problem is the next problem. Thanks @faizannoor

Sep
22
2 months ago
Activity icon

Replied to Retrieve A Single Column With A Peculiar ID From A Database And Put It In At A Different Table

Hi again @silencebringer and thanks again for answering my question, again.

I tried to understand what you were typed but I fail to understand.

this Arr:: something is new for me.

but then again, ty it works beautifully.

Activity icon

Started a new Conversation Retrieve A Single Column With A Peculiar ID From A Database And Put It In At A Different Table

I think this is a PHP confusion, but I put it in Laravel because I try to learn it ATM.

this is what I tried

invoiceController

public function store(Request $request)
    {
        $invoice = invoice::create($request->all());
        $products = $request->input('products', []);
        $quantities = $request->input('quantities', []);
        for ($product=0; $product < count($products); $product++) {
            $pricePoint = DB::table('products')->where('id', $products)->value('price');
            dd($pricePoint);
            if ($products[$product] != '') {
                $invoice->products()->attach([
                    $products[$product] => [
                        'quantity' => $quantities[$product],
                        'subtotal' => $quantities[$product]*$pricePoint,
                    ]
                ]);
        
Product::where('id', $products[$product])->decrement('qty',$quantities[$product]);
            }
        }
    
        return redirect()->route('productsOut.index');
    }

what I've been trying is to get the product's price that will be posted in invoice.create and try to put it in on order_product table as a subtotal value.

So it's like, I pick the product's price and paste it to get a value of subtotal = quantity * price to fill the subtotal column for each row.

$pricePoint = DB::table('products')->where('id', $products)->value('price');

this is what I tried to get the product's prices, I thought it work, but instead of retrieving 3 prices, it just a single price. which is the most top of the product I just store.

dd($products);

dd($pricePoint);

so the variable of $pricePoint I made is a flaw even it is inside the loop, it just retrieves a single price value Instead of retrieving 3 prices..

please help.

Sep
18
2 months ago
Activity icon

Replied to (SQLSTATE[HY000]: General Error: 1364) , After Adding Another Pivot Column

Hi @silencebringer , I just tried your code and attach method. All of the data are stored, very well. Thank you kindly.

and about your question about increment and decrement, this model I made for ordering items from the supplier. So I have to increment the product, no? Thank you again, for your thought.

Activity icon

Replied to (SQLSTATE[HY000]: General Error: 1364) , After Adding Another Pivot Column

@neilstee on a second try, it didn't work as it should. I'm sorry, I should try that sooner. when I checked the database, there are no records of orderPrice and all of em are null

then I searched the of the answer, because nullable() makes everything is Null.

Activity icon

Started a new Conversation (SQLSTATE[HY000]: General Error: 1364) , After Adding Another Pivot Column

This is a relation between Order and Products table which in the Order model

    public function products()
    {
        return $this->belongsToMany(Product::class)->withPivot(['quantity', 'orderPrice']);
    }

an error occurs After I put the "orderPrice" in pivot column, I've got an unreasonable error. which is not making any sense to me because, in this pivot table, I don't have any models for changing the fillable column. or should I make it?

this is the pivot table named order_product, I just put a default value of "->nullable" next to orderPrice. but it don't work either

public function up(){
        Schema::create('order_product', function (Blueprint $table) {
            $table->unsignedInteger('order_id');
            $table->foreign('order_id')->references('id')->on('orders');
            $table->unsignedInteger('product_id');
            $table->foreign('product_id')->references('id')->on('products');
            $table->integer('quantity');
            $table->integer('orderPrice');
        });
        
    }

this is the orderController

public function store(Request $request)
    {
        $order = Order::create($request->all());
        
        $products = $request->input('products', []);
        $quantities = $request->input('quantities', []);
        $pricing = $request->input('orderPrices', []);
        
        
        for ($product=0; $product < count($products); $product++) {
            if ($products[$product] != '') {
                $order->products()->attach(
				$products[$product],
				['quantity' => $quantities[$product]],
				['orderPrice' => $pricing[$product]]
			);
   Product::where('id', $products[$product])->increment('qty',$quantities[$product]);
            }
        }

        return redirect()->route('orders.index');
    }

please help me, what did I do wrong?