yelnya

yelnya

Member Since 3 Years Ago

Experience Points 1,480
Experience Level 1

3,520 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 6
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

14 Aug
3 days ago

yelnya started a new conversation Cannot Make Gregwar/Image Working In Laravel

I installed the Gregwar/Image package ( https://github.com/Gregwar/Image ) to laravel, I changed the caching directory to $cacheDir = '/public/cache/images/';, I can generate cached image in php artisan tinker, but when I use it in blade template or controller I get the http://localhost/testsite/public/cache/images//f/a/l/l/b/fallback.jpg error url instead, I have narrowed down the problem to: Gregwar\Image\Adapter\GD and this function:

    protected function openJpeg($file)
    {
        if (file_exists($file) && filesize($file)) {
            $this->resource = @imagecreatefromjpeg($file);
        } else {
            $this->resource = false;
        }
    }

the code inside if (file_exists($file) && filesize($file)) { never runs and filesize() returns NOTHING using print_r or dd(), I have no idea how to fix this, the weird thing is it works in php artisan tinker but NOT on the actual site

yelnya left a reply on Intervention Image - Cached But Slow

hi, I tried using Gregwar Image, using it as a helper function like:

gregwar_image( $width = 100, $height = 100, $method = 'zoomCrop', String $path )

it is working in php artisan tinker, but when I use it as an attribute in model or in blade template it keeps giving me: public/cache/images//f/a/l/l/b/fallback.jpg all the time

do you know what I did wrong? thanks

24 Apr
1 year ago

yelnya left a reply on Laravel Whoops Error Broken After Upgrading From 5.4 To 5.5, Now Only Shows 500 Internal Server Error Page Without Specifics

I found many of these in the log file:

[2018-04-24 06:24:50] local.ERROR: Call to undefined method Whoops\Handler\PrettyPageHandler::setApplicationPaths() {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to undefined method Whoops\Handler\PrettyPageHandler::setApplicationPaths() at C:\xampp\htdocs\foodcrush\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php:378) [stacktrace]

yelnya started a new conversation Laravel Whoops Error Broken After Upgrading From 5.4 To 5.5, Now Only Shows 500 Internal Server Error Page Without Specifics

So I upgraded from Laravle 5.4 to 5.5 following the steps at https://laravel.com/docs/5.5/upgrade and the whoops is broken and no longer showing the specifc details of the error, now all I get is either blank page or 500 internal server error

30 Aug
1 year ago

yelnya left a reply on Collect The Email Field Manually From Facebook Login User Who Declined Email Permission

@aurawindsurfing 1. The user can deny the Facebook Email permission or 2. The user registered a Facebook account with a mobile phone number ( no email )

29 Aug
1 year ago

yelnya started a new conversation Collect The Email Field Manually From Facebook Login User Who Declined Email Permission

hi, I have created a form ( firstname, Lastname, name, email, fb_provider_id ) for FB Users who denied the FB 'Email' permission to input the 'Email' field to complete the registration.

here is the flow:

Facebook login > store FB provider data ( fb_id, token etc ) to DB > goto Email Input Form > User fill up and submit form > Register User & associate FB provider with registered User

the problem is the 'FB Email Input Form' can be accessed with the route, anyone can visit the form accidentally and submit values to exploit it,

how can I make sure that only the User with the provider data is allowed to view the 'FB Email Input Form' only during registration?

I am currently using this:

return redirect()->action( '[email protected]', ['userdata' => $userdata] );

in the another function 'facebookLogin()' in the SocialLoginController to prevent User from accessing the 'FacebookRegistrationForm' page accidentally, and '[email protected]' have no route registered to it.

is this the correct way to solve this?

19 Aug
1 year ago

yelnya started a new conversation Pivot Table With A One-to-one And One-to-many Relationship

hi,

If I have the tables 'category', 'state', 'categorystate',

and 1x category have only 1x state

but 1x state can belong to many category,

how do I define the pivot table?

17 Apr
2 years ago

yelnya left a reply on How To Switch Language With Routes?

I followed the method used in:


https://laracasts.com/discuss/channels/tips/example-on-how-to-use-multiple-locales-in-your-laravel-5-website

with the Language Middleware handle:


    public function handle($request, Closure $next)
    {
        // Make sure current locale exists.
        $locale = $request->segment(1);

        // If provided Locale not in Available Locale Array
        if ( !in_array($locale, config('translatable.locales'))) {

            $segments = $request->segments();
            $segments[0] = config('app.fallback_locale');

            return Redirect::to(implode('/', $segments));
        }


        // Else, Set Current Locale
        App::setLocale($locale);

        return $next($request);
    }

and the people in https://laravel.io/chat said this is not the best way to make it work

quote:


All urls now have a locale segment/parameter that the url generated needs to know about. You can either specify that in every call to url() and route(), or register your values as default values. 

URL:defaults(array('locale' => $theLocale)) in your middleware to let all action()/route()/... know about this locale parameter... 

but I am not sure how and where to do that

15 Apr
2 years ago

yelnya started a new conversation How To Switch Language With Routes?

hi, I am using : dimsav/laravel-translatable

and I am not sure how to create a panel where I can choose & switch between language like 'Fr' and 'Eng'

from the demo of the package, language can be changed with: App::setLocale('en');

and the current locale can be obtained with: App::getLocale();

can someone show me a simple example of how the route/view/controller look like?

thank you

31 Mar
2 years ago

yelnya left a reply on Seperating User Table Into User ( User Details ) And Normal_acc ( Password Etc )

@vipin93 hi, can you show an example of how to do this with the default auth user model and in login controller please?

29 Mar
2 years ago

yelnya started a new conversation Cannot Install Laravel/socialite For Laravel 5.3

I am unable to install laravel/socialite with:

composer require laravel/socialite

I am getting:

Using version ^3.0 for laravel/socialite
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.3.30
    - Conclusion: don't install laravel/framework v5.3.30
    - laravel/socialite v3.0.0 requires illuminate/support ~5.4 -> satisfiable by illuminate/support[v5.4.0, v5.4.13, v5.4.9].
    - laravel/socialite v3.0.2 requires illuminate/support ~5.4 -> satisfiable by illuminate/support[v5.4.0, v5.4.13, v5.4.9].
    - laravel/socialite v3.0.3 requires illuminate/support ~5.4 -> satisfiable by illuminate/support[v5.4.0, v5.4.13, v5.4.9].
    - laravel/socialite v3.0.4 requires illuminate/support ~5.4 -> satisfiable by illuminate/support[v5.4.0, v5.4.13, v5.4.9].
    - don't install illuminate/support v5.4.0|don't install laravel/framework v5.3.30
    - don't install illuminate/support v5.4.13|don't install laravel/framework v5.3.30
    - don't install illuminate/support v5.4.9|don't install laravel/framework v5.3.30
    - Installation request for laravel/framework (locked at v5.3.30, required as 5.3.*) -> satisfiable by laravel/framework[v5.3.30].
    - Installation request for laravel/socialite ^3.0 -> satisfiable by laravel/socialite[v3.0.0, v3.0.2, v3.0.3, v3.0.4].


Installation failed, reverting ./composer.json to its original content.

if I use:

composer require laravel/socialite ^2.0

I get:


./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing guzzle/guzzle (v3.8.1)
    Downloading: 100%

  - Installing league/oauth1-client (1.6.2)
    Downloading: 100%

  - Installing guzzlehttp/streams (2.1.0)
    Downloading: 100%

  - Installing guzzlehttp/guzzle (4.2.4)
    Downloading: 100%

  - Installing laravel/socialite (v2.0.0)
    Downloading: 100%

Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize


  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Call to undefined method Illuminate\Foundation\Application::bindShared()


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

Installation failed, reverting ./composer.json to its original content.


yelnya started a new conversation Seperating User Table Into User ( User Details ) And Normal_acc ( Password Etc )

I want seperate the default User auth table, into 'User' table ( user details ... ) and 'normal_acc' ( Password ..etc ),

how do I modify the default authentication to get the password from another table and verify the password?

I am working with legacy social login tables where each social login has its own table like 'facebook_acc', 'googleplus_Acc', 'twitter_acc' etc storing the social id & for normal login 'normal_acc' that only contains user password

20 Mar
2 years ago

yelnya left a reply on Custom Laravel User Register Password_hash & Login Password_verify Method

I do have a old project which uses password_hash/password_verify but with different parameters, but I have no idea where should I start

yelnya started a new conversation Custom Laravel User Register Password_hash & Login Password_verify Method

hi, I want to change the way of user registration password_hash & password_verify when a user login, is that possible?

15 Mar
2 years ago

yelnya started a new conversation Yajra Datatable: How To Show Datatable Instead Of Returning JSON?

I have a function in the restaurantController with this function in it:


    // Show the Restaurant Working hours
    public function showResWorkingHours($id)
    {
        $restaurant = $this->restaurantRepository->findWithoutFail($id);

    // eloquent : restaurant =>hasMany => workinghours
        $res_workingHours = $restaurant->workingHours();


        if (empty($res_workingHours)) {
            Flash::error('Restaurant Do not have working hours');

            return redirect(route('restaurant.index'));
        }

        $test = Datatables::of($res_workingHours)
            ->addColumn('action', 'restaurant.resworkinghour_datatables_actions')
            ->make();

        return $test->render('res_working_hours.index');

    }

I want to display a datatable in the view, but I am getting:

FatalThrowableError in restaurantController.php line 139:
Call to undefined method Illuminate\Http\JsonResponse::render()

But If I changed the return to: return $test, I get the JSON.

So, How do I make it return a Datatable object instead?

The Yajra\Datatables documentation did not clearly explains how to do this,

So I hope that someone can help me out here

14 Mar
2 years ago

yelnya left a reply on How To Get Unique IDs From A 'belongsTo' To A 'hasMany' Table?

the 'working_hour' table contains the column 'shop_id', 'day' and 'working_hour'.

'day' will be '1-7' and 'working_hour' will be like '1100-1500,1800-2200' 'closed' etc

so there will be 7 rows for each restaurant

13 Mar
2 years ago

yelnya started a new conversation Yajra Datatable: How To Show Datatable

I have a function in a restaurant controller to show the data in datatable:

// Show the Restaurant Working hours public function showResWorkingHours($id) { $restaurant = $this->restaurantRepository->findWithoutFail($id);

    if (empty($res_workingHours)) {
        Flash::error('Restaurant Do not have working hours');

        return redirect(route('restaurant.index'));
    }

    $test = Datatables::of($res_workingHours)
        ->addColumn('action', 'res_working_hours.datatables_actions')
        ->make();

    return $test->render('res_working_hours.index');

    // return view('res_working_hours.index')->with('resWorkingHour', $res_workingHours);
}

but instead it is showing the JSON instead:

{"draw":0,"recordsTotal":7,"recordsFiltered":7,"data":[[1,1,1,"1100-1500,1800-2200","<form method="POST" action="http://localhost/fc_project_a/public/resWorkingHours/1" accept-charset="UTF-8"><input name="_method" type="hidden" value="DELETE"><input name="_token" type="hidden" value="dTgZPQrdxRuJyOPiUK469qRZpJQQL7Ny45v7NZcK">\n\n <a href="http://localhost/fc_project_a/public/resWorkingHours/1" class='btn btn-default btn-xs'>\n <i class="glyphicon glyphicon-eye-open"></i>\n </a>\n <a href="http://localhost/fc_project_a/public/resWorkingHours/1/edit" class='btn btn-default btn-xs'>\n ....

what I did wrong here?

yelnya started a new conversation How To Get Unique IDs From A 'belongsTo' To A 'hasMany' Table?

I have a table 'shop' that has a 'hasMany' relationship to 'working_hour', 'working_hour' has a 'belongsTo' relationship to 'shop',

How do I get only unique IDs of shop with eloquent from 'working_hour'?

06 Mar
2 years ago

yelnya started a new conversation How To Code A Backend Sidebar Dynamic Menu That Loads Names From A Table Column?

hi,

how do I code a backend sidebar dynamic menu that loads names from a table column?

do I need to create a menu controller?

how do I make it available on every backend page?

01 Mar
2 years ago

yelnya started a new conversation Laravel Datatables, Return Only Specific Rows

I am using Yajra\Datatables\Services\DataTable

I have a controller with:

use App\DataTables\restaurantsDataTable;

class restaurantsController extends AppBaseController {

public function index(restaurantsDataTable $restaurantsDataTable)
{
    return $restaurantsDataTable->render('restaurants.index');
}

....

}

and the App\DataTables\restaurantsDataTable with:

use App\Models\restaurants; use Form; use Yajra\Datatables\Services\DataTable;

class restaurantsDataTable extends DataTable {

/**
 * @return \Illuminate\Http\JsonResponse
 */
public function ajax()
{
    return $this->datatables
        ->eloquent($this->query())
        ->addColumn('action', 'restaurants.datatables_actions')
        ->make(true);
}

/**
 * Get the query object to be processed by datatables.
 *
 * @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
 */
public function query()
{
    $restaurants = restaurants::query();

    return $this->applyScopes($restaurants);
}

/**
 * Optional method if you want to use html builder.
 *
 * @return \Yajra\Datatables\Html\Builder
 */
public function html()
{
    return $this->builder()
        ->columns($this->getColumns())
        ->addAction(['width' => '10%'])
        ->ajax('')
        ->parameters([
            'dom' => 'Bfrtip',
            'scrollX' => false,
            'buttons' => [
                'print',
                'reset',
                'reload',
                [
                     'extend'  => 'collection',
                     'text'    => '<i class="fa fa-download"></i> Export',
                     'buttons' => [
                         'csv',
                         'excel',
                         'pdf',
                     ],
                ],
                'colvis'
            ]
        ]);
}

/**
 * Get columns.
 *
 * @return array
 */
private function getColumns()
{
    return [
        'res_name' => ['name' => 'res_name', 'data' => 'res_name'],
        'res_image' => ['name' => 'res_image', 'data' => 'res_image', 'visible' => false],
        'res_image_date' => ['name' => 'res_image_date', 'data' => 'res_image_date', 'visible' => false],
        'res_address' => ['name' => 'res_address', 'data' => 'res_address'],
        'res_state' => ['name' => 'res_state', 'data' => 'res_state'],
        'res_location' => ['name' => 'res_location', 'data' => 'res_location'],
        'res_area' => ['name' => 'res_area', 'data' => 'res_area'],
        'res_telephone' => ['name' => 'res_telephone', 'data' => 'res_telephone', 'visible' => false],
        'res_min_price' => ['name' => 'res_min_price', 'data' => 'res_min_price', 'visible' => false],
        'res_max_price' => ['name' => 'res_max_price', 'data' => 'res_max_price', 'visible' => false],
        'res_latitude' => ['name' => 'res_latitude', 'data' => 'res_latitude', 'visible' => false],
        'res_longitude' => ['name' => 'res_longitude', 'data' => 'res_longitude', 'visible' => false],
        'res_chain' => ['name' => 'res_chain', 'data' => 'res_chain', 'visible' => false],
        'res_new' => ['name' => 'res_new', 'data' => 'res_new', 'visible' => false],
        'res_offer' => ['name' => 'res_offer', 'data' => 'res_offer', 'visible' => false],
        'res_type_state' => ['name' => 'res_type_state', 'data' => 'res_type_state', 'visible' => false]
    ];
}

/**
 * Get filename for export.
 *
 * @return string
 */
protected function filename()
{
    return 'restaurants';
}

}

How do I customize the:

public function index(restaurantsDataTable $restaurantsDataTable) { return $restaurantsDataTable->render('restaurants.index'); }

to return some table rows that matched some ids? like:

App\Models\restaurants::where('res_id', '=', 1)->get();

28 Feb
2 years ago

yelnya started a new conversation Infyom Generator: Paginate Command Not Generating According To Input

I am using Laravel Infyom generator to generate from a table with this command:

php artisan infyom:api_scaffold --fromTable --tableName= --primary= --paginate=15 --save

but after the files are generated, in the view, the pagination per page is still 10

http://prntscr.com/eedbbt

I am using "yajra/laravel-datatables-oracle" with infyom.

I tried changing value to '15', '20' but it will still generate only 10

I have asked the same question at Infyom github, but from the look of the response rate of the other questions, I dont think I am going to get any reply, so I hope someone can hlpe me here

yelnya started a new conversation Adding Scss Sass Files Into Gulpfile.js, But

in Laravel 5.3, my gulpfile.js looks like this:

elixir(function(mix) {

mix.sass([
    'app.scss',
    'fonts-googleapis-raleway.scss',
    '_all-skins.min.scss',
    'AdminLTE.min.scss',
    'bootstrap.min.scss',
    'font-awesome.min.scss',
    'fonts-googleapis-raleway.scss',
    'select2.min.scss'
], 'public/assets/css');


mix.webpack(
    'app.js'
);

});

I have gulp watch enabled but, all the CSS from these files are not added to the app.css in public folder

21 Feb
2 years ago

yelnya started a new conversation How To

hi, I am new to laravel and am not sure how to code this:

restaurant owner role -> only grant edit access ( no delete or create ) to their own restaurant data

restaurant owner only be able to access the restaurant data after super admin granted access to that specific restaurant

if restaurant owner not yet granted access to restaurant, will show blank page with warning in backend instead