jeudi 18 octobre 2018

Laravel - Internal Server Error and Forbiden Access

I use cPanel tranfer tool to copy the website from a server to another server, but after that, I got Internal Server Error...

To solve that problem I run the command:

sudo chown -R perica:perica /home/perica/public_html/

after that:

sudo find /home/perica -type f -exec chmod 664 {} \; 

sudo find /home/perica -type d -exec chmod 775 {} \;

but I got again the same error.

I also try to sudo find /home/perica -type f -exec chmod 700 {} \; but then I got error

 Forbidden
You don't have permission to access /admin on this server.
Server unable to read htaccess file, denying access to be safe

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Also, my storage folder and bootstrap permission is 777.

What is the problem? I spend 2 days to solve this problem but no success! Please HELP!

UPDATE: I delete .htaccess file and now I see the Laravel folder structure but when I navigate a browser to domain.com/public folder again I got error.



via Chebli Mohamed

DB data's ID and paging the data differently with Laravel

I've table in DB which has estate datas. Now I'am retrieving those datas on the main blade. But also I want to retrieve those data separatly by their ID on another page. Do I need to create html table in a blade each of every ID? Or can I make it in just one blade? Or any idea?

Thank you!



via Chebli Mohamed

mardi 16 octobre 2018

My pagination not going next page, returns main page

I do pagination to table. But when I click the numbers just return the main page and Url shows like this: http://example/?q=?=大阪&page=2

This how I calling the links for pagination on view.blade



And this is the controller:

$q = $request->q;
        if ($q !== null && trim($q) !== ""){//here

            $estates = \DB::table('allestates')
                ->where("building_name","LIKE", "%" . $q . "%")
                ->orWhere("address","LIKE", "%" . $q . "%")
                ->orWhere("company_name","LIKE", "%" . $q . "%")
                ->orWhere("region","LIKE", "%" . $q . "%")
                ->orderBy('price')->get();


            $showPerPage = 10;

            $perPagedData = $estates
                ->slice((request()->get('page')) * $showPerPage, $showPerPage)
                ->all();

            $estates = new \Illuminate\Pagination\LengthAwarePaginator($perPagedData, count($estates), $showPerPage, request()
                ->get('page'));


            if(count($estates) > 0){
                return view("search", compact('estates'))->withQuery($q);
            }

        }

What am I missing here? My guess is it couldn't find the next page? But why?



via Chebli Mohamed

lundi 15 octobre 2018

Query a list of value of a specific column - Laravel

I'm trying to query a list as an array directly out of a table of my database without having to create another foreach loop and construct one myself.


I try

return Response::json(Skill::select('name')->get());

I get

[{"name":"Vagrant"},{"name":"Docker"},{"name":"Gulp"},{"name":"Heroku"},{"name":"RequireJS"},{"name":"AngularJS"},{"name":"Composer "},{"name":"NPM"},{"name":"MySQL"},{"name":"Sublime Text"},{"name":"Laravel"},{"name":"PyCharm"},{"name":"Mac OS X"},{"name":"Windows"},{"name":"Ubuntu"},{"name":"Cent OS"},{"name":"Photoshop"},{"name":"Illustrator"},{"name":"MobaXTerm"},{"name":"Terminal"},{"name":"iMovie"},{"name":"Final Cut"},{"name":"GitHub"},{"name":"BitBucket"},{"name":"Selenium"},{"name":"Python"},{"name":"Bower"},{"name":"Sass"},{"name":"Digital Ocean"},{"name":"Linode"},{"name":"Siteground"},{"name":"Go Daddy"},{"name":"Shopify"},{"name":"Facebook"},{"name":"Twitter"},{"name":"Salesforce"},{"name":"OAuth 2.0"},{"name":"SAML 2.0"},{"name":"OpenID Connect"},{"name":"PostgreSQL"},{"name":"Bash"},{"name":"PHP"},{"name":"Google Map"},{"name":"Google Translation"},{"name":"Instagram"},{"name":"LESS"},{"name":"Geolocation API"},{"name":"Xcode"},{"name":"Atom"},{"name":"Webpack"},{"name":"AWS Console"},{"name":"Secure Shell"},{"name":"Node"},{"name":"Yarn"},{"name":"Pod"},{"name":"EC2"},{"name":"Amazon ECS"},{"name":"S3"},{"name":"Amazon RDS"},{"name":"Camtasia"},{"name":"Core Data"},{"name":"Realm"},{"name":"VS Code"},{"name":"TextMate"},{"name":"TextWrangler"},{"name":"Laravel Elixir"},{"name":"Virtual Machine"},{"name":"Open  Stack"},{"name":"Redis"},{"name":"Local Storage"},{"name":"Protractor"},{"name":"Jest"},{"name":"Mocha"},{"name":"Chai"},{"name":"SinonJS"},{"name":"AWS"},{"name":"HTML"},{"name":"CSS"},{"name":"Javascript"},{"name":"Sketch"},{"name":"iOS"},{"name":"Express"},{"name":"Angular"},{"name":"React Native"},{"name":"jQuery"},{"name":"Nginx"},{"name":"Apache"},{"name":"PayPal"},{"name":"Square "},{"name":"Disqus"},{"name":"YouTube"},{"name":"Swagger"},{"name":"GitLab"},{"name":"Amazon ECR "},{"name":"Jira"},{"name":"Trello "},{"name":"Evernote "},{"name":"Confluence "},{"name":"Word"},{"name":"CodeBox"},{"name":"Markdown"},{"name":"Noteability"},{"name":"Kamar"},{"name":"Jasmine"},{"name":"Swift"},{"name":"Coda"},{"name":"Postman"},{"name":"Wireshark"},{"name":"Transmit"},{"name":"WinSCP"},{"name":"Navicat Premium"},{"name":"Kaleidoscope"},{"name":"Mind Note "},{"name":"Divvy"},{"name":"Duet"},{"name":"Draw.io"},{"name":"Google Draw"},{"name":"VMWare Fusion "},{"name":"Virtualbox"},{"name":"QuickBooks"},{"name":"Chat.io"},{"name":"FusionCharts"},{"name":"Google Chart"},{"name":"J Player"},{"name":"CKEditor"}]

I was trying to get these

["Vagrant","Docker","Gulp","Heroku","RequireJS","AngularJS","Composer ","NPM","MySQL","Sublime Text","Laravel","PyCharm","Mac OS X","Windows","Ubuntu","Cent OS","Photoshop","Illustrator","MobaXTerm","Terminal","iMovie","Final Cut","GitHub","BitBucket","Selenium","Python","Bower","Sass","Digital Ocean","Linode","Siteground","Go Daddy","Shopify","Facebook","Twitter","Salesforce","OAuth 2.0","SAML 2.0","OpenID Connect","PostgreSQL","Bash","PHP","Google Map","Google Translation","Instagram","LESS","Geolocation API","Xcode","Atom","Webpack","AWS Console","Secure Shell","Node","Yarn","Pod","EC2","Amazon ECS","S3","Amazon RDS","Camtasia","Core Data","Realm","VS Code","TextMate","TextWrangler","Laravel Elixir","Virtual Machine","Open  Stack","Redis","LocalStorage","Protractor","Jest","Mocha","Chai","SinonJS","AWS","HTML","CSS","Javascript","Sketch","iOS","Express","Angular","React Native","jQuery","Nginx","Apache","PayPal","Square ","Disqus","YouTube","Swagger","GitLab","Amazon ECR ","Jira","Trello ","Evernote ","Confluence ","Word","CodeBox","Markdown","Noteability","Kamar","Jasmine","Swift","Coda","Postman","Wireshark","Transmit","WinSCP","Navicat Premium","Kaleidoscope","Mind Note ","Divvy","Duet","Draw.io","Google Draw","VMWare Fusion ","Virtualbox","QuickBooks","Chat.io","FusionCharts","Google Chart","J Player","CKEditor"]


Questions

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!



via Chebli Mohamed

jeudi 11 octobre 2018

DOKU Payment Gateway for PHP Integration?

I want to ask about how to make doku payment integration to my website (laravel). Now I'm already have all the credentials needed(mallid, merchant) but i dont know how to start, if there's any refference it will help me, thank you.



via Chebli Mohamed

mardi 9 octobre 2018

Select top from group

I have model Message:

 protected $fillable = [
        'id','text','girl_id','date' ];

How to choose the last message by date for each girl_id?

My code:

   $messages=Message::select(['id','text','girl_id','date'])
                    ->groupBY('girl_id')
                    ->orderBY('date')
                    ->take(1)
                    ->get();



via Chebli Mohamed

lundi 8 octobre 2018

Article, Comment and User relationship in Laravel 5.1

I made a blog where you can CRUD articles and post comments. Everything is fine and working good.

I just want to make Laravel to do the magic when the User posts a comment to an article and instead of hard-coding article_id and user_id.

Comment::create([
    'body' => request('body'),
    'article_id' => $article->id,
    'user_id' => Auth::User()->id]
);

Is it possible to use Laravel's Eloquent relationships to chain up some functions/methods and simplify it a little bit?



via Chebli Mohamed