aajiboo

Experience

1,310

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 3 Lessons Completed
  • 0 Favorites

15th May, 2018

aajiboo started a new conversation Path Problem • 1 week ago

I have a problem with the path I can not see the picture of the base this is the fonction in the controller

public function uploadProfilePhoto(Request $request, $username){

       $response = array();
       $response['code'] = 400;
       if (!$this->secure($username, true)) return Response::json($response);

       $messages = [
           'image.required' => trans('validation.required'),
           'image.mimes' => trans('validation.mimes'),
           'image.max.file' => trans('validation.max.file'),
       ];
       $validator = Validator::make(array('image' => $request->file('image')), [
           'image' => 'required|mimes:jpeg,jpg,png,gif|max:2048'
       ], $messages);

       if ($validator->fails()) {
           $response['code'] = 400;
           $response['message'] = implode(' ', $validator->errors()->all());
       }else{
           $file = $request->file('image');

           $file_name = md5(uniqid() . time()) . '.' . $file->getClientOriginalExtension();
           if ($file->storeAs('public/uploads/profile_photos', $file_name)){
               $response['code'] = 200;
               $this->user->profile_path = $file_name;
               $this->user->save();
               $response['image_big'] = $this->user->getPhoto();
               $response['image_thumb'] = $this->user->getPhoto(200, 200);
           }else{
               $response['code'] = 400;
               $response['message'] = "Something went wrong!";
           }
       }
       return Response::json($response);

   }

this is the fonction in the model user

 public function getPhoto($w = null, $h = null){
       if (!empty($this->profile_path)){
           $path = 'storage/uploads/profile_photos/'.$this->profile_path;
       }else {
           $path = "images/profile-picture.png";
       }
       if ($w == null && $h == null){
           return url('/'.$path);
       }
       $image = '/resizer.php?';
       if ($w > -1) $image .= '&w='.$w;
       if ($h > -1) $image .= '&h='.$h;
       $image .= '&zc=1';
       $image .= '&src='.$path;
       return url($image);
   }

and this is the blade.php page

<div class="user-card">
   <div class="cover @if(!$user->getCover()){{ 'no-cover' }}@endif" style="background-image: url('{{ $user->getCover() }}')"></div>
   <div class="detail">
       <div class="image">
           <a data-fancybox="group" href="{{ $user->getPhoto() }}">
               <img class="img-circle @if($user->sex == 1){{ 'female' }}@endif" src="{{ $user->getPhoto(70, 70) }}" alt="" />
           </a>
       </div>
       <div class="info">
           <a href="{{ url('/'.$user->username) }}" class="name">{{ $user->name }}</a>
           <a href="{{ url('/'.$user->username) }}" class="username">{{ '@'.$user->username }}</a>
       </div>
       <div class="clearfix"></div>
   </div>
</div>

14th May, 2018

aajiboo left a reply on Invalid Argument Supplied For Foreach() • 1 week ago

array:1 [▼ "_token" => "LIwYBMfdYtsUlxGg478pC7sA6tTfnzcOd1QfiIHE" ]

aajiboo left a reply on Invalid Argument Supplied For Foreach() • 1 week ago

no think this is the code of the blade

  <form id="form-profile-hobbies" method="post" action="{{ url('/'.$user->username.'/save/hobbies') }}">

                {{ csrf_field() }}

                <div class="modal-body">
                    <div class="form-group">
                        <label>Hobbies:</label>
                        <div class="row">
                            <div class="col-xs-12">
                                <select class="form-control select2-multiple" name="hobbies[]" multiple="multiple" style="width: 100%">
                                    @foreach($hobbies as $hobby)
                                        <option value="{{ $hobby->id }}" @if($user->hasHobby($hobby->id)){{ 'selected' }}@endif>{{ $hobby->name }}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="submit" class="btn btn-success">Save</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                </div>
            </form>

aajiboo started a new conversation Invalid Argument Supplied For Foreach() • 1 week ago

I have this error "Invalid argument supplied for foreach()" in this part of code

public function saveHobbies(Request $request, $username){

       if (!$this->secure($username)) return redirect('/404');


       $my_hobbies = Auth::user()->hobbies()->get();


       $list = [];

       foreach($request->input('hobbies') as $i => $id){
           $list[$id] = 1;
       }

aajiboo started a new conversation Invalid Argument Supplied For Foreach() • 1 week ago

I have this error "Invalid argument supplied for foreach()" in this part of code

public function saveHobbies(Request $request, $username){

       if (!$this->secure($username)) return redirect('/404');


       $my_hobbies = Auth::user()->hobbies()->get();


       $list = [];

       foreach($request->input('hobbies') as $i => $id){
           $list[$id] = 1;
       }

12th May, 2018

aajiboo started a new conversation Full Stack Laravel +vuejs • 1 week ago

is full stack laravel and vuejs + mysql classed 3tier architectures or n tier architectures

10th May, 2018

aajiboo started a new conversation Tymon/jwt Unauthficated • 1 week ago

message error unauthficated

aajiboo started a new conversation ErrorException • 1 week ago

I want to run this project I have on my pc version php 7.2.2 and I put in phpstorm: PHP language level 5.6 and I did all the steps to run the project but it shows me this error

(3/3) ErrorException count (): Parameter must be an array or an object that Countable implements (View: C: \ xampp \ htdocs \ laravel-social-network \ resources \ views \ layouts \ app.blade.php) (View: C: \ xampp \ htdocs \ Laravel-social-network \ resources \ views \ layouts \ app.blade.php)

here is the project if someone has a solution to overcome this problem and thank you https://github.com/lvntayn/laravel-social-network

aajiboo left a reply on (3/3) ErrorException • 1 week ago

here is the complete code, I have on my pc version php 7.2.2 and I set in phpstorm php language level 5.6 I made all the steps to run the project but it takes me this error

https://github.com/lvntayn/laravel-social-network

aajiboo left a reply on (3/3) ErrorException • 1 week ago

this is the app.blade.php code

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Styles -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
    <link href="{{ asset('plugins/font-awesome/css/font-awesome.min.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/pace-master/themes/white/pace-theme-flash.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/fancybox/dist/jquery.fancybox.min.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/select2/dist/css/select2.min.css') }}" rel="stylesheet">
    <link href="{{ asset('plugins/bootstrap/css/bootstrap-theme.min.css') }}" rel="stylesheet">
    <link href="{{ asset('css/around.css') }}" rel="stylesheet">

    @yield('header')
</head>
<body>
<div id="app">
    <nav class="navbar navbar-default navbar-static-top navbar-around">
        <div class="container">
            <div class="navbar-header">

                <!-- Collapsed Hamburger -->
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                    <span class="sr-only">Toggle Navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                <!-- Branding Image -->
                <a class="navbar-brand" href="{{ url('/') }}">
                    <img src="{{ asset('images/logo.png') }}" alt="" />
                </a>
            </div>

            <div class="collapse navbar-collapse" id="app-navbar-collapse">
                <!-- Left Side Of Navbar -->
                <ul class="nav navbar-nav">
                    &nbsp;
                </ul>

                <div class="navbar-form navbar-left">
                    <form id="custom-search-input" method="get" action="{{ url('/search') }}">
                        <div class="input-group col-md-12">
                            <input type="text" class="form-control input-lg" name="s" placeholder="search..." />
                            <span class="input-group-btn">
                                <button class="btn btn-info btn-lg" type="button">
                                    <i class="glyphicon glyphicon-search"></i>
                                </button>
                            </span>
                        </div>
                    </form>
                </div>


                <!-- Right Side Of Navbar -->
                <ul class="nav navbar-nav navbar-right">
                    @include('widgets.notifications')
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle parent" data-toggle="dropdown" role="button" aria-expanded="false">

                            <img src="{{ Auth::user()->getPhoto() }}" alt="" />
                            {{ Auth::user()->name }} <span class="caret"></span>
                        </a>

                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <a href="{{ url('/'.Auth::user()->username) }}">
                                    <i class="fa fa-user"></i> My Profile
                                </a>
                            </li>
                            <li>
                                <a href="{{ url('/settings') }}">
                                    <i class="fa fa-cog"></i> Settings
                                </a>
                            </li>
                            <li>
                                <a href="{{ route('logout') }}"
                                   onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                    <i class="fa fa-sign-out"></i> Logout
                                </a>

                                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                    {{ csrf_field() }}
                                </form>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="main-content">
        @yield('content')
    </div>

    <div class="container">
        @include('widgets.footer')
    </div>
</div>
<div class="loading-page">
    <img src="{{ asset('images/rolling.gif') }}" alt="">
</div>
@include('widgets.error')
<!-- Scripts -->
<script type="text/javascript">
    var BASE_URL = "{{ url('/') }}";
    var REQUEST_URL = "<?=Request::url()?>";
    var CSRF = "{{ csrf_token() }}";
    var WALL_ACTIVE = false;
</script>
<script src="{{ asset('plugins/jquery/jquery-2.1.4.min.js')  }}"></script>
<script src="{{ asset('plugins/pace-master/pace.min.js') }}"></script>
<script src="{{ asset('plugins/bootstrap/js/bootstrap.min.js') }}"></script>
<script src="{{ asset('plugins/jquery.serializeJSON/jquery.serializejson.min.js') }}"></script>
<script src="{{ asset('plugins/fancybox/dist/jquery.fancybox.min.js') }}"></script>
<script src="{{ asset('plugins/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('plugins/bootstrap3-dialog/dist/js/bootstrap-dialog.min.js') }}"></script>
<script src="{{ asset('plugins/select2/dist/js/select2.full.min.js') }}"></script>
<script src="//maps.google.com/maps/api/js?key=<?=config('googlemaps.key')?>"></script>
<script src="{{ asset('plugins/gmaps/gmaps.min.js') }}"></script>
<script src="{{ asset('js/around.js') }}"></script>
<script src="{{ asset('js/wall.js') }}"></script>
<script src="{{ asset('js/notifications.js') }}"></script>
@yield('footer')
<script type="text/javascript">
    @if(!Auth::user()->has('location'))

            autoFindLocation();

    @endif
</script>
</body>
</html>

this is the home.blade.php

@extends('layouts.app')

@section('content')
    <div class="h-20"></div>
    <div class="container">
        <div class="row">
            <div class="col-md-3">
                @include('widgets.sidebar')
            </div>
            <div class="col-xs-12 col-md-3 pull-right">
                <div class="hidden-sm hidden-xs">
                    @include('widgets.suggested_people')
                </div>
            </div>
            <div class="col-md-6">
                @include('widgets.wall')
            </div>
        </div>
    </div>
@endsection

@section('footer')
    <script type="text/javascript">
        WALL_ACTIVE = true;
        fetchPost(0,0,0,10,-1,-1,'initialize');
    </script>
@endsection

and this is the HomeController.php

<?php

namespace App\Http\Controllers;

use App\Library\IPAPI;
use App\Library\sHelper;
use App\Models\Group;
use App\Models\Hobby;
use App\Models\Post;
use App\Models\User;
use DB;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;


class HomeController extends Controller
{

    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {

        $user = Auth::user();

        $wall = [
            'new_post_group_id' => 0
        ];





        return view('home', compact('user', 'wall'));


    }


    public function search(Request $request){


        $s = $request->input('s');
        if (empty($s)) return redirect('/');


        $user = Auth::user();

        $posts = Post::leftJoin('users', 'users.id', '=', 'posts.user_id')
            ->where(function($query) use ($user) {

                $query->where('users.private', 0)->orWhere(function($query) use ($user){
                    $query->whereExists(function ($query) use($user){
                        $query->select(DB::raw(1))
                            ->from('user_following')
                            ->whereRaw('user_following.following_user_id = users.id and user_following.follower_user_id = '.$user->id);
                    });
                })->orWhere(function($query) use ($user){
                    $query->where('users.private', 1)->where('users.id', $user->id);
                });

            })->where('posts.content', 'like', '%'.$s.'%')->where('posts.group_id', 0)
            ->groupBy('posts.id')->select('posts.*')->orderBy('posts.id', 'DESC')->get();

        $comment_count = 2;

        $users = User::where('name', 'like', '%'.$s.'%')->orWhere('username', 'like', '%'.$s.'%')->orderBy('name', 'ASC')->get();

        return view('search', compact('users', 'posts', 'user', 'comment_count'));

    }




}

aajiboo started a new conversation (3/3) ErrorException • 1 week ago

when I'm redirecting to home I have this problem

count(): Parameter must be an array or an object that implements Countable (View: C:\xampp\htdocs\laravel-social-network\resources\views\layouts\app.blade.php) (View: C:\xampp\htdocs\laravel-social-network\resources\views\layouts\app.blade.php)

8th May, 2018

aajiboo left a reply on Laravel Vuejs - Search Addresses And Store In Database • 2 weeks ago

searh addresse in google maps , database is mysql

aajiboo started a new conversation Laravel Vuejs - Search Addresses And Store In Database • 2 weeks ago

how can i Search addresses and store in database with vuejs

1st May, 2018

aajiboo left a reply on Display Image Of The Database • 3 weeks ago

thank you very much it works

aajiboo started a new conversation Display Image Of The Database • 3 weeks ago

I want to display an image of the database with a dynamic path but the instruction does not work <img src = "{{url ('../')}}/ public / img / {{Auth :: user () -> pic}}"

17th April, 2018

aajiboo started a new conversation Show Connected User Information • 1 month ago

I am a beginner in laravel and I want a sample code that can display the connected user information and thank you.

16th April, 2018

aajiboo started a new conversation Npm WARN Deprecated [email protected]: Gulp-util Is Deprecated • 1 month ago

npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

15th April, 2018

aajiboo left a reply on Laravel Vuejs Lawfirm • 1 month ago

Thkns But whos jeff rey? Can u suggest a tutorial ?

aajiboo started a new conversation Laravel Vuejs Lawfirm • 1 month ago

can any one helps me about laravel vuejs for lawfirm project, any tips or anyhelp?

4th April, 2018

aajiboo started a new conversation Table Association Won't Work • 1 month ago

Table SkillsUser herited from Skills and Users How do I make the association Many to Many This is the model code :

Users

16th March, 2018

aajiboo started a new conversation Laravel Vuejs Boiterplate • 2 months ago

does anyone know a tutorial about how make crud in boiterplate admin panel ?

15th March, 2018

aajiboo started a new conversation Laravel Vuejs • 2 months ago

Does anyone knows any laravel+ vuejs admin panel with frontend?

8th February, 2018

aajiboo left a reply on SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'forge.decisions' Doesn't Exist • 3 months ago

i added the username and it works thnks

aajiboo left a reply on SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'forge.decisions' Doesn't Exist • 3 months ago

now i've got another exception in register : QueryException SQLSTATE[HY000]: General error: 1364 Field 'username' doesn't have a default value (SQL: insert into users (name, email, password, updated_at, created_at) values (bb, [email protected], $2y$10$CoPaTVY5XIDpwRsbXt2wcuipDOnecL0AKx66qwKs4d8gnlrsvFqYK, 2018-02-08 15:30:44, 2018-02-08 15:30:44))

aajiboo left a reply on SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'forge.decisions' Doesn't Exist • 3 months ago

In Facade.php line 221:

Call to undefined method Illuminate\Database\Schema\MySqlBuilder::has()

aajiboo started a new conversation SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'forge.decisions' Doesn't Exist • 3 months ago

I followed this tutorial and started to build an application ( https://github.com/AshrafBasry/Law ). but the problem is when i try to create a new instance from this project it shows an error and could not complete the installation. i run composer install and the error was following: In Connection.php line 647:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forge.decisions' doesn't exist (SQL: select count(*) as aggregate from decisions where done = 0)

In Connection.php line 319:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forge.decisions' doesn't exist

Script php artisan optimize handling the post-install-cmd event returned with error code 1

aajiboo started a new conversation Base Table Or View Not Found: 1146 Table Doesn't Exist • 3 months ago

I followed this tutorial and started to build an application ( https://github.com/AshrafBasry/Law ). but the problem is when i try to create a new instance from this project it shows an error and could not complete the installation. i run composer install and the error was following: In Connection.php line 647:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forge.decisions' doesn't exist (SQL: select count(*) as aggregate from decisions where done = 0)

In Connection.php line 319:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'forge.decisions' doesn't exist

Script php artisan optimize handling the post-install-cmd event returned with error code 1

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.