Member Since 2 Years Ago
Jakarta
260 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
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.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Replied to One To Many
Currently:
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
//
protected $table = 'category';
}
Should I write this function
public function blog()
{
return $this->belongsTo('Blog::class', 'ctg_id', 'id');
}
It still does not work even after I add that function. I don't know how to reference it?
Replied to One To Many
Try to focus on the category and the result of dd($data);
I would like it to link with category table but it does not work.
Replied to One To Many
I have another case:
BlogController.php
public function index()
{
//
$data = Blog::with('category')->get();
dd($data);
return view('admin.blog.blog')->with('list', $data);
}
Blog.php
class Blog extends Model
{
//
protected $table = 'blog';
public function comment()
{
return $this->hasMany(Comment::class, 'post_id', 'id');
}
public function category()
{
return $this->hasOne(Category::class, 'id', 'ctg_id');
}
}
This result dd($data); does not show a link to category table. I wonder why?
Replied to Combo Box
I get another error:
$data is undefined
Make the variable optional in the blade template. Replace {{ $data }} with {{ $data ?? '' }}
I revise the frontend to this:
add_blog.blade.php
<tr>
<td>Category</td>
<td>
<select name="ctg_id">
@if($data)
@foreach($data as $ctg)
<option value="{{ $ctg->id }}">{{ $ctg->ctg_name }}</option>
@endforeach
@endif
</select>
</td>
</tr>
the error still remains.
Replied to Combo Box
Now, I am having a problem with storing the data:
add_blog.blade.php
<tr>
<td>Category</td>
<td>
<select>
@foreach($data as $ctg)
<option value="{{ $ctg->id }}" name="ctg_id">{{ $ctg->ctg_name }}</option>
@endforeach
</select>
</td>
</tr>
BlogController.php
public function store(Request $request)
{
//
$this->validate($request, [
'title' => 'required',
'content' => 'required|max:2000',
'image' => 'required|image|mimes:jpg,jpeg,png|max:10000|dimensions:min_width=500,min_height=200,max_width=800,max_height=500',
'ctg_id' => 'required'
]);
$blog = new Blog;
//storage/app/web_portfolio/random.jpeg
$path = $request->file('image')->store('public/web_portfolio');
Log::info('path :'.$path);
$blog->image = $path;
$blog->title = $request->title;
$blog->content = $request->content;
$blog->ctg_id = $request->ctg_id;
$blog->save();
Session::flash('flash', 'Successfully add data');
return view('admin.blog.add_blog');
}
The ctg id field is required.
Why ctg id required message appears? I already choose the option.
Replied to Combo Box
I think I create a mistake in the controller:
public function create()
{
//
$data = Category::pluck('id', 'ctg_name');
return view('admin.blog.add_blog')->with('data', $data);
}
Trying to get property 'id' of non-object (View: D:\xampp2\htdocs\sehatbeneran_blog\resources\views\admin\blog\add_blog.blade.php)
The id suppose to be there. I already check with dd($data).
Started a new Conversation Combo Box
PageController.php
public function index()
{
//
$data = Page::all();
$data2 = Category::pluck('id', 'ctg_name');
return view('admin.page.page')->with('list', $data);
}
How to pass $data and $data2 to view ?
In frontend is like this correct?
<tr>
<td>Category</td>
<td>
<select>
@foreach($data2 as $ctg)
<option value="{{ $ctg->id }}">{{ $ctg->ctg_name }}</option>
@endforeach
</select>
</td>
</tr>
Replied to Migrate
Why do I have to alter the class name to: class CreateTablePage extends Migration
in order to work?
note: I rename the migration file name.
Started a new Conversation Migrate
When trying to migrate a table I get this:
D:\xampp2\htdocs\sehatbeneran_blog>php artisan migrate --path=database\migrations\2019_12_06_033947_create_table_page.php
Symfony\Component\Debug\Exception\FatalThrowableError : Class 'CreateTablePage' not found
Started a new Conversation One To Many
I would like to create eloquent relationship. Please check if the connection is correct:
class Blog extends Model
{
//
protected $table = 'blog';
public function comment()
{
return $this->hasMany(Comment::class, 'id', 'post_id');
}
}
blog.id --> connected to --> comment.post_id
The second item in the bracket suppose to be blog.id or comment.post_id ?
Replied to Using Custom Fonts
I finally solved the error. There is one more thing:
font-family: 'Ubuntu-R', 'mauerMtrpl', 'Libre Franklin', 'Helvetica Neue', Helvetica, Arial, sans-serif;
One css theme is using a long list of font family. Which font family will be executed?
Started a new Conversation Using Custom Fonts
When trying to update fonts:
@font-face {
font-family: 'Ubuntu-R';
src: url('fonts/Ubuntu/Ubuntu-R.ttf') format('truetype');
}
@font-face {
font-family: 'Ubuntu-B';
src: url('fonts/Ubuntu/Ubuntu-B.ttf') format('truetype');
}
This line: src: url('fonts/Ubuntu/Ubuntu-R.ttf') format('truetype');
@font-face declaration doesn't follow the fontspring bulletproof syntax
I am using Firefox but would like it to works in all browser.
ref: https://stackoverflow.com/questions/33475526/cant-understand-the-bulletproof-font-face-css-rule
Any clue why? I still do not understand which one to fix.
Started a new Conversation Developing Wordpress Theme
Anyone ever develop wordpress theme? What is a good ebook for developing wordpress 5.x wordpress theme?
Any recommendation?
Started a new Conversation Validation Using Request
Hello,
I am trying to use request for validation:
ref: https://laravel.com/docs/5.7/validation#form-request-validation
Here is my existing validation:
modules/ProductPriceList/Http/Requests/Store.php
<?php
namespace Modules\ProductPriceList\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class Store extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'sku' => 'required|unique:product_price_lists,sku,NULL,id,deleted_at,NULL,digits:13',
'sku_external' => 'nullable|unique:product_price_lists,sku_external,NULL,id,deleted_at,NULL',
'product_catalog_id' => 'required',
'variant' => 'required',
'bin_code' => 'required',
'unit' => 'nullable|string',
'price' => 'required|integer',
'price_before_discount' => 'nullable|integer|gte:price'
// 'min_value' => 'required|numeric|min:0',
// 'max_value' => 'required|numeric|min:0',
];
}
modules/ProductPriceList/Http/Requests/Update.php
<?php
namespace Modules\ProductPriceList\Http\Requests;
class Update extends Store
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$skuExternal = 'nullable|unique:product_price_lists,sku_external,';
return [
'sku' => 'required|unique:product_price_lists,sku,' . $this->productPriceList->id . ',id,deleted_at,NULL',
'sku_external' => $skuExternal . $this->productPriceList->id . ',id,deleted_at,NULL',
'product_catalog_id' => 'required',
'variant' => 'required',
'bin_code' => 'required',
'unit' => 'nullable|string',
'price' => 'required|integer',
'price_before_discount' => 'nullable|integer|gte:price'
// 'min_value' => 'required|numeric|min:0',
// 'max_value' => 'required|numeric|min:0',
];
}
First, I wonder why it uses extends Store instead of extends FormRequest?
Next, under which directory would you write:
php artisan make:request Store
So that the request will appears on the correct module folder?
Next, why would people use php artisan make:request Store to validate when you could do it in the controller?
Replied to Get Sku Less Then 13 Digit
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FULL OUTER JOIN product_catalogs c ON l.product_catalog_id=c.id FULL OUTER JOIN' at line 3
Replied to Get Sku Less Then 13 Digit
How to do full outer join?
SELECT t.name, l.sku
FROM product_price_lists l
FULL OUTER JOIN product_catalogs c ON l.product_catalog_id=c.id
FULL OUTER JOIN product_catalog_translations t ON l.product_catalog_id=t.id
WHERE LENGTH(l.sku) < 13;
There is a syntax error
Started a new Conversation Get Sku Less Then 13 Digit
I am trying to select sku < 13 digit. How?
SELECT * FROM `product_price_lists` WHERE len(sku) < 13
I did this in phpmyadmin:
#1305 - FUNCTION sesaid_sesa.len does not exist
ref: https://www.sqlteam.com/forums/topic.asp?TOPIC_ID=147943
Awarded Best Reply on Proofread Help
I am going to cancel the offer since I just find someone who can help me out.
Replied to Proofread Help
I am going to cancel the offer since I just find someone who can help me out.
Replied to Filemanager
I wonder if that file manager is integrated with ckeditor or tinymce ?
How do you insert the image to ckeditor for example?
Started a new Conversation Proofread Help
Hello,
I need someone to help me proofread my IT paper. It will be sent to International journal. Basically checking if my English is okay. The title is about php security. It's 15 pages long and my budget is US$ 25.00. Since there is an expensive transfer fee to oversees, so I prefer as I return I will buy anything you want up to US$ 25.00 (including shipping fee) on online store with my account. If anyone interested please send me an email to [email protected] and let me know your skype id.
Replied to Npm Run Dev Error
You mean cannot create test.css in public/css folder? See I login as Admin and as admin the permission is full control, only user that has read only permission.
It doesn't make sense.
Replied to Npm Run Dev Error
I finally found the problem:
webpack.mix.js
.styles('resources/css/test.css', 'public/css')
.version();
I think the .styles might cause problem. After I deleted both of them it works. Any clue why?
Replied to Camel Caps Format
D:\xampp2\htdocs\sesa_final\sesa-e-commerce>composer run check-quality
! find app -type f -name ".php" -exec php -l {} ; | grep -v 'No syntax errors' '!' is not recognized as an internal or external command, operable program or batch file. Script ! find app -type f -name ".php" -exec php -l {} ; | grep -v 'No syntax errors' handling the check-quality event returned with error code 255
Any clue why?
Replied to Npm Run Dev Error
Did these:
npm cache clean --force
delete node_modules (manually)
npm install
npm run dev
Still the same errors :
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Replied to Camel Caps Format
D:\xampp2\htdocs\sesa_final\sesa-e-commerce>phpcs --colors --standard=vendor\suitmedia\php-code-standards\Suitmedia\modules\TimeSlot\Http\Controllers\TimeSlotController.php ERROR: the "vendor\suitmedia\php-code-standards\Suitmedia\modules\TimeSlot\Http\Controllers\TimeSlotController.php" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend
Any space between Suitmedia\ and modules ?
What is "scripts": { in composer json for? How to call it ?
Replied to Camel Caps Format
D:\xampp2\htdocs\sesa_final\sesa-e-commerce>phpcs --colors --standard=vendor/suitmedia/php-code-standards/Suitmedia/modules\TimeSlot\Http\Controllers\TimeSlotController.php ERROR: the "vendor/suitmedia/php-code-standards/Suitmedia/modules\TimeSlot\Http\Controllers\TimeSlotController.php" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend
I don't understand what it means?
Replied to Camel Caps Format
composer.json
"check-quality": [
"! find app -type f -name \"*.php\" -exec php -l {} \; | grep -v 'No syntax errors'",
"vendor/bin/phpcs --colors --standard=vendor/suitmedia/php-code-standards/Suitmedia/ app/",
"vendor/bin/phpcs --colors --ignore=views,TableView --standard=vendor/suitmedia/php-code-standards/Suitmedia/ modules/",
"vendor/bin/phpcs --colors --ignore=views,TableView --standard=vendor/suitmedia/php-code-standards/Suitmedia/ LivingModules/"
],
Doe it mean using PHPCS codestandard?
Replied to Npm Run Dev Error
D:\xampp2\htdocs\sesa_final\sesa-e-commerce>rmdir node_modules
The directory is not empty.
Replied to Npm Run Dev Error
Under which brackets? laravel-mix/package.json have a lot of brackets:
"dependencies": {
?
D:\xampp2\htdocs\sesa_final\sesa-e-commerce>rm -rf node_modules 'rm' is not recognized as an internal or external command, operable program or batch file.
Replied to Camel Caps Format
Hey the syntax different:
D:\xampp2\htdocs\sesa_final\sesa-e-commerce\vendor\bin>phpcs D:\xampp2\htdocs\sesa_final\sesa-e-commerce\modules\TimeSlot\Http\Controllers\TimeSlotController.php
1 | ERROR | [x] End of line character is invalid; expected "\n"| | but found "\r\n"
2 | ERROR | [ ] Missing file doc comment
14 | ERROR | [ ] Missing class doc comment
18 | ERROR | [ ] Missing function doc comment
23 | ERROR | [ ] Missing function doc comment
25 | WARNING | [ ] Line exceeds 85 characters; contains 87
| | characters
30 | ERROR | [ ] Missing function doc comment
38 | ERROR | [ ] Missing function doc comment
42 | WARNING | [ ] Line exceeds 85 characters; contains 86
| | characters
48 | WARNING | [ ] Line exceeds 85 characters; contains 86
| | characters
52 | ERROR | [ ] Missing function doc comment
66 | ERROR | [ ] Missing function doc comment
77 | ERROR | [ ] Missing function doc comment
148 | ERROR | [ ] Missing function doc comment
153 | ERROR | [ ] Missing function doc comment
162 | WARNING | [ ] Line exceeds 85 characters; contains 115
| | characters
166 | ERROR | [ ] Missing function doc comment
170 | WARNING | [ ] Line exceeds 85 characters; contains 86
| | characters
177 | ERROR | [ ] Missing function doc comment
190 | ERROR | [ ] Missing function doc comment
213 | ERROR | [ ] Missing function doc comment
215 | WARNING | [ ] Line exceeds 85 characters; contains 94
| | characters
217 | WARNING | [ ] Line exceeds 85 characters; contains 93
| | characters
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 91ms; Memory: 12Mb
I already pass the gitlab test when these errors does not exist in gitlab. My point is I would like an equal test just like gitlab test.
Replied to Npm Run Dev Error
C:/Users/ACER/AppData/Roaming/npm-cache/logs/2019-11-29T1304_05_357Z-debug.log C:\Users\ACER\AppData\Roaming\npm-cache_logs\2019-11-29T13_04_05_465Z-debug.log
https://drive.google.com/open?id=1TbWL-pu6_GMnGiHA_8UHV0I1MOSC2z1J
https://drive.google.com/open?id=13Ak88ALryLuA7nLBaSYkJlonjt9dElA3
I am using Windows and also gitlab. Should I reinstalled a fresh new laravel project? I also do not know which file to copy if I copy the whole files then what's the point? Please advice if anyone can help me solve the issue by seeing the error message.
Started a new Conversation Npm Run Dev Error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I am getting this error message and trying to fix it:
This is what I did:
delete vendor delete node_modules
npm install composer install npm run dev
It does not works!
ref: https://github.com/JeffreyWay/laravel-mix/issues/1072
I am using Win 10. There is no way to install a fresh new laravel since I have a big project. It will takes a long time to do that.
Replied to Camel Caps Format
ok, I would like a testing system on local that could help me pass the gitlab code quality test. Is PHP_CodeSniffer the right test for that?
{ "require-dev": { "squizlabs/php_codesniffer": "3.*" } }
3
D:\xampp2\htdocs\sesa_final\sesa-e-commerce\vendor\bin>phpcs -h
Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors] [--stdin-path=] [--report=] [--report-file=] [--report-=] ... [--report-width=] [--generator=] [--tab-width=] [--severity=] [--error-severity=] [--warning-severity=] [--runtime-set key value] [--config-set key value] [--config-delete key] [--config-show] [--standard=] [--sniffs=] [--exclude=] [--encoding=] [--extensions=] [--ignore=] [--bootstrap=] [--file-list=] ... Set runtime value (see --config-set) -n Do not print warnings (shortcut for --warning-severity=0) -w Print both warnings and errors (this is the default) -l Local directory only, no recursion
...
number 3 instead of showing the test result, it shows all these info.
I also try :
D:\xampp2\htdocs\sesa_final\sesa-e-commerce\vendor\bin>phpcs -n
but it takes forever.. any clue how to test the error message?
Replied to Camel Caps Format
Another message:
$this->store8($date);
}
return back()->withSuccess('1 minggu sudah ditambahkan');
} else {
60 | ERROR | [ ] Double space found line 60: return back()->withSuccess('1 minggu sudah ditambahkan');
What's wrong with line 60 ?
Started a new Conversation Camel Caps Format
I have to pass the gitlab codequality test:
I get this error message:
52 | ERROR | [ ] Public method name 38 | | "TimeSlotController::addAWeekTimeSlot" is not in 39 | | camel caps format
I don't know why it is not in camel caps format I thought I already fixed it?
I can't really find a good reference in google:
Started a new Conversation Website Within Website
Can you open one website within another website?
For example:
www.main-website.com
and you want to put: www.blog-main-website.com
inside www.main-website.com using www.main-website.com header and footer. Is this possible?
Replied to Linux Web Server
I try to install nginx:
[email protected]:/home/davy_yg/Downloads# sudo ufw app list
Available applications:
CUPS
Nginx Full
Nginx HTTP
Nginx HTTPS
[email protected]:/home/davy_yg/Downloads# sudo ufw allow 'Nginx HTTP'
Rules updated
Rules updated (v6)
[email protected]:/home/davy_yg/Downloads# sudo ufw status
Status: inactive
ref: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04-quickstart
I wonder why the status is inactive?
[email protected]:/home/davy_yg/Downloads# systemctl status nginx
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en
Active: inactive (dead)
Docs: man:nginx(8)
~
~
lines 1-4/4 (END)
What does it mean? Is the nginx ready? And why it stucks right there?
Replied to Linux Web Server
What about nginx is it compatible when you export the SQL file to XAMPP (in Windows) ?
Started a new Conversation Linux Web Server
Hello,
I want to program php laravel on linux since the code quality checked does not work in my Win 10. I want to test it if it works in Linux. It works in other developer linux sistem.
Now, I wonder what is a good web server to installed? I am using xampp in Windows so whatever web server that I am using in Linux should be compatible when I export the SQL file to win 10 XAMPP.
Replied to Install Xampp In Linux
Is that nginx ? It's funny that I installed xampp-linux and after I am done, I can't even find where I installed it. There is no short cut either in the desktop.
I can find this path: opt\lampp\apache2\htdocs
What is that ? Is that the xampp-linux that I installed?
Started a new Conversation Torent
Hello,
I once installed kazza for P2P a long time ago and there are alot of virus on my PC. Now, I wonder about torrent, is it save? Since someone recommends it to download important info to advance my IT skills.
Started a new Conversation SEO
Hello,
I am buiding a blog for my ecommerce website. The blog is using a different domain name - and using wordpress. Using a different domain is it beneficial for seo the websites?
Any ideas?
Awarded Best Reply on Install Xampp In Linux
I already find a solution to that prob. thank you.
ref: https://vitux.com/how-to-install-xampp-on-your-ubuntu-18-04-lts-system/
Replied to Install Xampp In Linux
I already find a solution to that prob. thank you.
ref: https://vitux.com/how-to-install-xampp-on-your-ubuntu-18-04-lts-system/
Started a new Conversation Install Xampp In Linux
Hello,
I am trying to install xampp in linux but failed to do. I am using VMware. I downloaded xampp linux version:
[email protected]:/home/davy_yg/Downloads# chmod 755 xampp-linux-x64-7.2.24-0-installer.run [email protected]:/home/davy_yg/Downloads# xampp-linux-x64-7.2.24-0-installer.run xampp-linux-x64-7.2.24-0-installer.run: command not found
Replied to Addressing The Root Folder
It doesn't copy either:
webpack.mix.js
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
mix.copy( 'node_modules/froala-editor/css/froala_editor.pkgd.min.css', 'storage/app/froala-editor /css/froala_editor.pkgd.min.css' );
mix.copy( 'node_modules/froala-editor/js/froala_editor.pkgd.min.js', 'storage/app/froala-editor/js/froala_editor.pkgd.min.js' );
npm run dev
D:\xampp2\htdocs\aws_admin>npm run dev
@ dev D:\xampp2\htdocs\aws_admin npm run development
@ development D:\xampp2\htdocs\aws_admin cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
I check my storage/app folder nothing created.
I already search for the file but cannot find it no where except in nodemodules and the links to reference them.